anyscale 0.26.47__py3-none-any.whl → 0.26.48__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. anyscale/__init__.py +0 -7
  2. anyscale/_private/anyscale_client/anyscale_client.py +1 -208
  3. anyscale/_private/anyscale_client/common.py +0 -55
  4. anyscale/_private/anyscale_client/fake_anyscale_client.py +19 -46
  5. anyscale/_private/docgen/__main__.py +24 -45
  6. anyscale/_private/docgen/generator.py +32 -16
  7. anyscale/_private/docgen/generator_legacy.py +58 -6
  8. anyscale/_private/docgen/models.md +3 -2
  9. anyscale/_private/workload/workload_config.py +16 -8
  10. anyscale/_private/workload/workload_sdk.py +22 -5
  11. anyscale/client/README.md +4 -1
  12. anyscale/client/openapi_client/__init__.py +2 -1
  13. anyscale/client/openapi_client/api/default_api.py +253 -4
  14. anyscale/client/openapi_client/models/__init__.py +2 -1
  15. anyscale/client/openapi_client/models/{alert_type.py → alert_issue_type.py} +8 -20
  16. anyscale/client/openapi_client/models/baseimagesenum.py +1 -2
  17. anyscale/client/openapi_client/models/cloud.py +31 -3
  18. anyscale/client/openapi_client/models/cloud_deployment.py +30 -3
  19. anyscale/client/openapi_client/models/cloud_with_cloud_resource.py +29 -1
  20. anyscale/client/openapi_client/models/cloud_with_cloud_resource_gcp.py +29 -1
  21. anyscale/client/openapi_client/models/dataset_metrics.py +6 -6
  22. anyscale/client/openapi_client/models/dataset_state.py +2 -1
  23. anyscale/client/openapi_client/models/describe_system_workload_response.py +32 -6
  24. anyscale/client/openapi_client/models/experimental_workspace.py +29 -1
  25. anyscale/client/openapi_client/models/experimental_workspaces_sort_field.py +2 -1
  26. anyscale/client/openapi_client/models/operator_metrics.py +8 -9
  27. anyscale/client/openapi_client/models/operator_status.py +102 -0
  28. anyscale/client/openapi_client/models/organization_usage_alert.py +20 -20
  29. anyscale/client/openapi_client/models/supportedbaseimagesenum.py +1 -2
  30. anyscale/cloud/models.py +330 -0
  31. anyscale/commands/cloud_commands.py +132 -43
  32. anyscale/commands/command_examples.py +54 -134
  33. anyscale/commands/compute_config_commands.py +7 -11
  34. anyscale/compute_config/__init__.py +2 -16
  35. anyscale/compute_config/_private/compute_config_sdk.py +27 -17
  36. anyscale/compute_config/commands.py +14 -44
  37. anyscale/compute_config/models.py +49 -26
  38. anyscale/controllers/cloud_controller.py +289 -171
  39. anyscale/controllers/cloud_file_storage_utils.py +204 -0
  40. anyscale/controllers/kubernetes_verifier.py +1567 -0
  41. anyscale/job/_private/job_sdk.py +17 -8
  42. anyscale/job/models.py +1 -1
  43. anyscale/scripts.py +0 -2
  44. anyscale/sdk/anyscale_client/models/baseimagesenum.py +1 -2
  45. anyscale/sdk/anyscale_client/models/cloud.py +31 -3
  46. anyscale/sdk/anyscale_client/models/supportedbaseimagesenum.py +1 -2
  47. anyscale/shared_anyscale_utils/utils/id_gen.py +1 -0
  48. anyscale/version.py +1 -1
  49. anyscale/workspace/models.py +14 -7
  50. {anyscale-0.26.47.dist-info → anyscale-0.26.48.dist-info}/METADATA +1 -1
  51. {anyscale-0.26.47.dist-info → anyscale-0.26.48.dist-info}/RECORD +56 -70
  52. anyscale/commands/llm/dataset_commands.py +0 -269
  53. anyscale/commands/llm/group.py +0 -15
  54. anyscale/commands/llm/models_commands.py +0 -123
  55. anyscale/controllers/llm/__init__.py +0 -0
  56. anyscale/controllers/llm/models_controller.py +0 -144
  57. anyscale/llm/__init__.py +0 -2
  58. anyscale/llm/dataset/__init__.py +0 -2
  59. anyscale/llm/dataset/_private/__init__.py +0 -0
  60. anyscale/llm/dataset/_private/docs.py +0 -63
  61. anyscale/llm/dataset/_private/models.py +0 -71
  62. anyscale/llm/dataset/_private/sdk.py +0 -147
  63. anyscale/llm/model/__init__.py +0 -2
  64. anyscale/llm/model/_private/models_sdk.py +0 -62
  65. anyscale/llm/model/commands.py +0 -93
  66. anyscale/llm/model/models.py +0 -171
  67. anyscale/llm/model/sdk.py +0 -62
  68. anyscale/llm/sdk.py +0 -27
  69. {anyscale-0.26.47.dist-info → anyscale-0.26.48.dist-info}/WHEEL +0 -0
  70. {anyscale-0.26.47.dist-info → anyscale-0.26.48.dist-info}/entry_points.txt +0 -0
  71. {anyscale-0.26.47.dist-info → anyscale-0.26.48.dist-info}/licenses/LICENSE +0 -0
  72. {anyscale-0.26.47.dist-info → anyscale-0.26.48.dist-info}/licenses/NOTICE +0 -0
  73. {anyscale-0.26.47.dist-info → anyscale-0.26.48.dist-info}/top_level.txt +0 -0
@@ -1,93 +0,0 @@
1
- from typing import List, Optional
2
-
3
- from anyscale._private.sdk import sdk_command
4
- from anyscale.llm.model._private.models_sdk import PrivateLLMModelsSDK
5
- from anyscale.llm.model.models import DeletedFineTunedModel, FineTunedModel
6
-
7
-
8
- _LLM_MODELS_SDK_SINGLETON_KEY = "llm_models_sdk"
9
-
10
-
11
- _RETRIEVE_EXAMPLE = """
12
- import anyscale
13
-
14
- anyscale.llm.model.get(model_id="my-model-id")
15
- anyscale.llm.model.get(job_ib="prodjob_123")
16
- """
17
-
18
- _RETRIEVE_ARG_DOCSTRINGS = {
19
- "model_id": " ID of the finetuned model that is being retrieved.",
20
- "job_id": " ID of the Anyscale job corresponding to the fine-tuning run.",
21
- }
22
-
23
-
24
- _DELETE_EXAMPLE = """
25
- import anyscale
26
-
27
- anyscale.llm.model.delete(model_id="my-model-id")
28
- """
29
-
30
- _DELETE_ARG_DOCSTRINGS = {"model_id": " ID of the finetuned model to delete."}
31
-
32
- _LIST_EXAMPLE = """
33
- import anyscale
34
-
35
- anyscale.llm.model.list()
36
- anyscale.llm.model.list(cloud_id="cld_123")
37
- anyscale.llm.model.list(project_id="prj_123")
38
- anyscale.llm.model.list(cloud_id="cld_123", project_id="prj_123")
39
- anyscale.llm.model.list(project_id="prj_123", max_items=10)
40
- """
41
-
42
- _LIST_ARG_DOCSTRINGS = {
43
- "cloud_id": "Cloud ID to filter by. If not specified, all models from all the clouds visible to the user (filtered optionally by `project_id`) are listed.",
44
- "project_id": "Project ID to filter by. If not specified, all the models from all visible projects to the user (filtered optionally by `cloud_id`) are listed.",
45
- "max_items": "Maximum number of items to show in the list. By default, the 20 most recently created models are fetched.",
46
- }
47
-
48
-
49
- @sdk_command(
50
- _LLM_MODELS_SDK_SINGLETON_KEY,
51
- PrivateLLMModelsSDK,
52
- doc_py_example=_RETRIEVE_EXAMPLE,
53
- arg_docstrings=_RETRIEVE_ARG_DOCSTRINGS,
54
- )
55
- def get(
56
- *,
57
- model_id: Optional[str] = None,
58
- job_id: Optional[str] = None,
59
- _sdk: PrivateLLMModelsSDK,
60
- ) -> FineTunedModel:
61
- """Retrieves model card for a finetuned model."""
62
- return _sdk.get(model_id=model_id, job_id=job_id)
63
-
64
-
65
- @sdk_command(
66
- _LLM_MODELS_SDK_SINGLETON_KEY,
67
- PrivateLLMModelsSDK,
68
- doc_py_example=_DELETE_EXAMPLE,
69
- arg_docstrings=_DELETE_ARG_DOCSTRINGS,
70
- )
71
- def delete(model_id: str, _sdk: PrivateLLMModelsSDK,) -> DeletedFineTunedModel:
72
- """Deletes a finetuned model. Requires owner permission for the corresponding Anyscale project."""
73
- return _sdk.delete(model_id)
74
-
75
-
76
- @sdk_command(
77
- _LLM_MODELS_SDK_SINGLETON_KEY,
78
- PrivateLLMModelsSDK,
79
- doc_py_example=_LIST_EXAMPLE,
80
- arg_docstrings=_LIST_ARG_DOCSTRINGS,
81
- )
82
- def list( # noqa: A001
83
- *,
84
- cloud_id: Optional[str] = None,
85
- project_id: Optional[str] = None,
86
- max_items: int = 20,
87
- _sdk: PrivateLLMModelsSDK,
88
- ) -> List[FineTunedModel]:
89
- """Lists fine-tuned models available to the user.
90
-
91
- By default, all models in all visible clouds under all visible projects to the user are listed. This is optionally filtered by `project_id` and/or `cloud_id`.
92
- """
93
- return _sdk.list(cloud_id=cloud_id, project_id=project_id, max_items=max_items)
@@ -1,171 +0,0 @@
1
- from dataclasses import dataclass, field
2
- from typing import Any, Dict, Optional
3
-
4
- from anyscale._private.models.model_base import ModelBase, ModelEnum
5
-
6
-
7
- class FineTuningType(ModelEnum):
8
- LORA = "LORA"
9
- FULL_PARAM = "FULL_PARAM"
10
-
11
- __docstrings__ = {
12
- LORA: "Low-Rank Adaptation (LoRA) fine-tuning method.",
13
- FULL_PARAM: "Full parameter fine-tuning method.",
14
- }
15
-
16
-
17
- @dataclass(frozen=True)
18
- class FineTunedModel(ModelBase):
19
- """Represents a fine-tuned model with its associated metadata."""
20
-
21
- __doc_py_example__ = """\
22
- import anyscale
23
- from anyscale.llm.model.models import FineTunedModel
24
- model: FineTunedModel = anyscale.llm.model.get(model_id="my-model-id")
25
- """
26
-
27
- __doc_cli_example__ = """\
28
- $ anyscale llm model get --model-id my-model-id
29
- id: my-model-id
30
- base_model_id: meta-llama/Llama-3-8B-Instruct
31
- cloud_id: cloud_abc123
32
- created_at: 1725473924
33
- job_id: prodjob_xyz789
34
- ft_type: LORA
35
- ...
36
- """
37
-
38
- id: str = field(metadata={"docstring": "Unique ID/tag for the fine-tuned model."})
39
-
40
- def _validate_id(self, id: str): # noqa: A002
41
- if not isinstance(id, str):
42
- raise TypeError("'id' must be a string.")
43
-
44
- base_model_id: str = field(
45
- metadata={"docstring": "Base model ID used for fine-tuning."}
46
- )
47
-
48
- def _validate_base_model_id(self, base_model_id: str):
49
- if not isinstance(base_model_id, str):
50
- raise TypeError("'base_model_id' must be a string.")
51
-
52
- cloud_id: str = field(
53
- metadata={
54
- "docstring": "ID for the Anyscale Cloud corresponding to the fine-tuning run."
55
- }
56
- )
57
-
58
- def _validate_cloud_id(self, cloud_id: str):
59
- if not isinstance(cloud_id, str):
60
- raise TypeError("'cloud_id' must be a string.")
61
-
62
- created_at: int = field(
63
- metadata={"docstring": "Time at which the fine-tuned model was created."}
64
- )
65
-
66
- def _validate_created_at(self, created_at: int):
67
- if not isinstance(created_at, int):
68
- raise TypeError("'created_at' must be an integer (Unix timestamp).")
69
-
70
- if created_at < 0:
71
- raise ValueError("'created_at' must be a positive integer")
72
-
73
- creator: Optional[str] = field(
74
- metadata={"docstring": "Email address for the user who created the model."}
75
- )
76
-
77
- def _validate_creator(self, creator: Optional[str]):
78
- if creator is not None and not isinstance(creator, str):
79
- raise TypeError("'creator' must be a string or None.")
80
-
81
- ft_type: FineTuningType = field(metadata={"docstring": "Fine-tuning type."})
82
-
83
- def _validate_ft_type(self, ft_type: FineTuningType) -> FineTuningType:
84
- return FineTuningType.validate(ft_type)
85
-
86
- generation_config: Optional[Dict[str, Any]] = field(
87
- metadata={
88
- "docstring": "Inference generation config with chat-templating parameters and stopping sequences."
89
- }
90
- )
91
-
92
- def _validate_generation_config(self, generation_config: Optional[Dict[str, Any]]):
93
- if generation_config is not None and not isinstance(generation_config, dict):
94
- raise TypeError("'generation_config' must be a dictionary or None.")
95
-
96
- job_id: Optional[str] = field(
97
- metadata={
98
- "docstring": "ID for the Anyscale job corresponding to the fine-tuning run, if applicable."
99
- }
100
- )
101
-
102
- def _validate_job_id(self, job_id: Optional[str]):
103
- if job_id is not None and not isinstance(job_id, str):
104
- raise TypeError("'job_id' must be a string or None.")
105
-
106
- project_id: Optional[str] = field(
107
- metadata={
108
- "docstring": "ID for the Anyscale Project corresponding to the fine-tuning run."
109
- }
110
- )
111
-
112
- def _validate_project_id(self, project_id: Optional[str]):
113
- if project_id is not None and not isinstance(project_id, str):
114
- raise TypeError("'project_id' must be a string.")
115
-
116
- storage_uri: str = field(
117
- metadata={
118
- "docstring": "URI at which the fine-tuned model checkpoint is stored."
119
- }
120
- )
121
-
122
- def _validate_storage_uri(self, storage_uri: str):
123
- if not isinstance(storage_uri, str):
124
- raise TypeError("'storage_uri' must be a string.")
125
-
126
- workspace_id: Optional[str] = field(
127
- default=None,
128
- metadata={
129
- "docstring": "ID for the Anyscale Workspace in which the model was fine-tuned, if any."
130
- },
131
- )
132
-
133
- def _validate_workspace_id(self, workspace_id: Optional[str]):
134
- if workspace_id is not None and not isinstance(workspace_id, str):
135
- raise TypeError("'workspace_id' must be a string or None.")
136
-
137
-
138
- @dataclass(frozen=True)
139
- class DeletedFineTunedModel(ModelBase):
140
- """Represents a deleted fine-tuned model with its deletion metadata."""
141
-
142
- __doc_py_example__ = """\
143
- import anyscale
144
- from anyscale.llm.model.models import DeletedFineTunedModel
145
- deleted_model: DeletedFineTunedModel = anyscale.llm.model.delete("my-model-id")
146
- """
147
-
148
- __doc_cli_example__ = """\
149
- $ anyscale models get-deleted my-model-id
150
- id: my-model-id
151
- deleted_at: 1725473924
152
- """
153
-
154
- id: str = field(metadata={"docstring": "Unique ID/tag for the fine-tuned model."})
155
-
156
- def _validate_id(self, id: str): # noqa: A002
157
- if not isinstance(id, str):
158
- raise TypeError("'id' must be a string.")
159
-
160
- deleted_at: int = field(
161
- metadata={
162
- "docstring": "Unix timestamp (in seconds) at which the fine-tuned model was deleted."
163
- }
164
- )
165
-
166
- def _validate_deleted_at(self, deleted_at: int):
167
- if not isinstance(deleted_at, int):
168
- raise TypeError("'deleted_at' must be an integer (Unix timestamp).")
169
-
170
- if deleted_at < 0:
171
- raise ValueError("'deleted_at' must be a positive integer (Unix timestamp)")
anyscale/llm/model/sdk.py DELETED
@@ -1,62 +0,0 @@
1
- from typing import Any, Optional
2
-
3
- from anyscale._private.anyscale_client import AnyscaleClientInterface
4
- from anyscale._private.sdk import sdk_docs
5
- from anyscale._private.sdk.base_sdk import BaseSDK, Timer
6
- from anyscale.cli_logger import BlockLogger
7
- from anyscale.llm.model._private.models_sdk import PrivateLLMModelsSDK
8
- from anyscale.llm.model.commands import (
9
- _DELETE_ARG_DOCSTRINGS,
10
- _DELETE_EXAMPLE,
11
- _LIST_ARG_DOCSTRINGS,
12
- _LIST_EXAMPLE,
13
- _RETRIEVE_ARG_DOCSTRINGS,
14
- _RETRIEVE_EXAMPLE,
15
- )
16
-
17
-
18
- class LLMModelsSDK(BaseSDK):
19
- def __init__(
20
- self,
21
- *,
22
- logger: Optional[BlockLogger] = None,
23
- client: Optional[AnyscaleClientInterface] = None,
24
- timer: Optional[Timer] = None,
25
- ):
26
- self._private_sdk = PrivateLLMModelsSDK(
27
- logger=logger, client=client, timer=timer
28
- )
29
-
30
- @sdk_docs(
31
- doc_py_example=_RETRIEVE_EXAMPLE, arg_docstrings=_RETRIEVE_ARG_DOCSTRINGS,
32
- )
33
- def get(
34
- self, *, model_id: Optional[str] = None, job_id: Optional[str] = None
35
- ) -> Any:
36
- """Retrives model card for a finetuned model."""
37
- return self._private_sdk.get(model_id=model_id, job_id=job_id)
38
-
39
- @sdk_docs(
40
- doc_py_example=_DELETE_EXAMPLE, arg_docstrings=_DELETE_ARG_DOCSTRINGS,
41
- )
42
- def delete(self, model_id: str) -> Any:
43
- """Deletes a finetuned model. Requires owner permission for the corresponding Anyscale project."""
44
- return self._private_sdk.delete(model_id)
45
-
46
- @sdk_docs(
47
- doc_py_example=_LIST_EXAMPLE, arg_docstrings=_LIST_ARG_DOCSTRINGS,
48
- )
49
- def list(
50
- self,
51
- *,
52
- cloud_id: Optional[str] = None,
53
- project_id: Optional[str] = None,
54
- max_items: int = 20,
55
- ) -> Any:
56
- """Lists fine-tuned models available to the user.
57
-
58
- By default, all models in all visible clouds under all visible projects to the user are listed. This is optionally filtered by `project_id` and/or `cloud_id`.
59
- """
60
- return self._private_sdk.list(
61
- cloud_id=cloud_id, project_id=project_id, max_items=max_items
62
- )
anyscale/llm/sdk.py DELETED
@@ -1,27 +0,0 @@
1
- from typing import Optional
2
-
3
- import anyscale
4
- from anyscale._private.anyscale_client import AnyscaleClientInterface
5
- from anyscale._private.sdk.base_sdk import BaseSDK
6
- from anyscale._private.sdk.timer import Timer
7
- from anyscale.cli_logger import BlockLogger
8
- from anyscale.llm.model import LLMModelsSDK
9
-
10
-
11
- class LLMSDK(BaseSDK):
12
- def __init__(
13
- self,
14
- *,
15
- logger: Optional[BlockLogger] = None,
16
- client: Optional[AnyscaleClientInterface] = None,
17
- timer: Optional[Timer] = None,
18
- ):
19
- self._model = LLMModelsSDK(logger=logger, client=client, timer=timer)
20
-
21
- @property
22
- def model(self):
23
- return self._model
24
-
25
- @property
26
- def dataset(self):
27
- return anyscale.llm.dataset