ob-metaflow-stubs 6.0.3.116__py2.py3-none-any.whl → 6.0.3.118__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. metaflow-stubs/__init__.pyi +353 -2770
  2. metaflow-stubs/cards.pyi +19 -473
  3. metaflow-stubs/cli.pyi +17 -81
  4. metaflow-stubs/client/__init__.pyi +19 -1113
  5. metaflow-stubs/client/core.pyi +18 -158
  6. metaflow-stubs/client/filecache.pyi +7 -11
  7. metaflow-stubs/clone_util.pyi +6 -26
  8. metaflow-stubs/events.pyi +6 -5
  9. metaflow-stubs/exception.pyi +8 -6
  10. metaflow-stubs/flowspec.pyi +22 -106
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +16 -564
  13. metaflow-stubs/info_file.pyi +6 -5
  14. metaflow-stubs/metadata_provider/__init__.pyi +16 -0
  15. metaflow-stubs/metadata_provider/heartbeat.pyi +34 -0
  16. metaflow-stubs/{metadata → metadata_provider}/metadata.pyi +10 -22
  17. metaflow-stubs/metadata_provider/util.pyi +19 -0
  18. metaflow-stubs/metaflow_config.pyi +8 -13
  19. metaflow-stubs/metaflow_current.pyi +126 -89
  20. metaflow-stubs/mf_extensions/__init__.pyi +6 -0
  21. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +6 -0
  22. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +6 -0
  23. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +6 -0
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +6 -0
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +129 -0
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +26 -0
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +156 -0
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +25 -0
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +111 -0
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +6 -0
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +188 -0
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +30 -0
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +28 -0
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +19 -0
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +115 -0
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +40 -0
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +6 -0
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +71 -0
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +56 -0
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +67 -0
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +49 -0
  42. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +6 -0
  43. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +6 -0
  44. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +130 -0
  45. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +42 -0
  46. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +6 -0
  47. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +17 -0
  48. metaflow-stubs/mflog/__init__.pyi +6 -0
  49. metaflow-stubs/mflog/mflog.pyi +52 -5
  50. metaflow-stubs/multicore_utils.pyi +6 -5
  51. metaflow-stubs/parameters.pyi +13 -23
  52. metaflow-stubs/plugins/__init__.pyi +52 -165
  53. metaflow-stubs/plugins/airflow/__init__.pyi +9 -5
  54. metaflow-stubs/plugins/airflow/airflow_utils.pyi +7 -6
  55. metaflow-stubs/plugins/airflow/exception.pyi +7 -11
  56. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +10 -97
  57. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +9 -30
  58. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +9 -40
  59. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +9 -40
  60. metaflow-stubs/plugins/argo/__init__.pyi +12 -5
  61. metaflow-stubs/plugins/argo/argo_client.pyi +8 -26
  62. metaflow-stubs/plugins/argo/argo_events.pyi +7 -11
  63. metaflow-stubs/plugins/argo/argo_workflows.pyi +18 -130
  64. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +22 -460
  65. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +12 -404
  66. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +63 -448
  67. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +165 -0
  68. metaflow-stubs/plugins/aws/__init__.pyi +11 -5
  69. metaflow-stubs/plugins/aws/aws_client.pyi +6 -5
  70. metaflow-stubs/plugins/aws/aws_utils.pyi +6 -11
  71. metaflow-stubs/plugins/aws/batch/__init__.pyi +9 -5
  72. metaflow-stubs/plugins/aws/batch/batch.pyi +10 -55
  73. metaflow-stubs/plugins/aws/batch/batch_client.pyi +7 -11
  74. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +15 -140
  75. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +7 -5
  76. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +10 -21
  77. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +9 -5
  78. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +6 -5
  79. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +6 -5
  80. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +7 -5
  81. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +11 -65
  82. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +6 -5
  83. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +52 -292
  84. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +127 -0
  85. metaflow-stubs/plugins/azure/__init__.pyi +12 -7
  86. metaflow-stubs/plugins/azure/azure_credential.pyi +6 -5
  87. metaflow-stubs/plugins/azure/azure_exceptions.pyi +7 -11
  88. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +11 -24
  89. metaflow-stubs/plugins/azure/azure_utils.pyi +11 -29
  90. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +8 -23
  91. metaflow-stubs/plugins/azure/includefile_support.pyi +7 -17
  92. metaflow-stubs/plugins/cards/__init__.pyi +15 -5
  93. metaflow-stubs/plugins/cards/card_cli.pyi +22 -491
  94. metaflow-stubs/plugins/cards/card_client.pyi +14 -76
  95. metaflow-stubs/plugins/cards/card_creator.pyi +7 -10
  96. metaflow-stubs/plugins/cards/card_datastore.pyi +10 -18
  97. metaflow-stubs/plugins/cards/card_decorator.pyi +10 -126
  98. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +13 -81
  99. metaflow-stubs/plugins/cards/card_modules/basic.pyi +13 -96
  100. metaflow-stubs/plugins/cards/card_modules/card.pyi +6 -5
  101. metaflow-stubs/plugins/cards/card_modules/components.pyi +24 -107
  102. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +6 -5
  103. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +6 -12
  104. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +11 -88
  105. metaflow-stubs/plugins/cards/card_resolver.pyi +6 -49
  106. metaflow-stubs/plugins/cards/component_serializer.pyi +13 -63
  107. metaflow-stubs/plugins/cards/exception.pyi +7 -11
  108. metaflow-stubs/plugins/catch_decorator.pyi +10 -30
  109. metaflow-stubs/plugins/datatools/__init__.pyi +13 -392
  110. metaflow-stubs/plugins/datatools/local.pyi +7 -11
  111. metaflow-stubs/plugins/datatools/s3/__init__.pyi +19 -653
  112. metaflow-stubs/plugins/datatools/s3/s3.pyi +15 -263
  113. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +7 -10
  114. metaflow-stubs/plugins/datatools/s3/s3util.pyi +6 -11
  115. metaflow-stubs/plugins/debug_logger.pyi +7 -5
  116. metaflow-stubs/plugins/debug_monitor.pyi +7 -5
  117. metaflow-stubs/plugins/environment_decorator.pyi +7 -5
  118. metaflow-stubs/plugins/events_decorator.pyi +8 -14
  119. metaflow-stubs/plugins/frameworks/__init__.pyi +7 -5
  120. metaflow-stubs/plugins/frameworks/pytorch.pyi +8 -45
  121. metaflow-stubs/plugins/gcp/__init__.pyi +11 -7
  122. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +11 -24
  123. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +7 -11
  124. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +6 -5
  125. metaflow-stubs/plugins/gcp/gs_utils.pyi +8 -20
  126. metaflow-stubs/plugins/gcp/includefile_support.pyi +7 -17
  127. metaflow-stubs/plugins/kubernetes/__init__.pyi +12 -5
  128. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +6 -10
  129. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +10 -38
  130. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +16 -155
  131. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +7 -11
  132. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +19 -142
  133. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +7 -11
  134. metaflow-stubs/plugins/logs_cli.pyi +10 -9
  135. metaflow-stubs/plugins/package_cli.pyi +7 -5
  136. metaflow-stubs/plugins/parallel_decorator.pyi +11 -59
  137. metaflow-stubs/plugins/perimeters.pyi +6 -11
  138. metaflow-stubs/plugins/project_decorator.pyi +8 -14
  139. metaflow-stubs/plugins/pypi/__init__.pyi +12 -11
  140. metaflow-stubs/plugins/pypi/conda_decorator.pyi +8 -27
  141. metaflow-stubs/plugins/pypi/conda_environment.pyi +13 -19
  142. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +7 -5
  143. metaflow-stubs/plugins/pypi/pypi_environment.pyi +7 -39
  144. metaflow-stubs/plugins/pypi/utils.pyi +7 -11
  145. metaflow-stubs/plugins/resources_decorator.pyi +7 -5
  146. metaflow-stubs/plugins/retry_decorator.pyi +7 -11
  147. metaflow-stubs/plugins/secrets/__init__.pyi +9 -5
  148. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +9 -14
  149. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +7 -11
  150. metaflow-stubs/plugins/storage_executor.pyi +6 -11
  151. metaflow-stubs/plugins/tag_cli.pyi +14 -396
  152. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +8 -33
  153. metaflow-stubs/plugins/timeout_decorator.pyi +7 -11
  154. metaflow-stubs/procpoll.pyi +7 -5
  155. metaflow-stubs/profilers/__init__.pyi +7 -11
  156. metaflow-stubs/pylint_wrapper.pyi +7 -11
  157. metaflow-stubs/runner/__init__.pyi +13 -5
  158. metaflow-stubs/runner/deployer.pyi +99 -223
  159. metaflow-stubs/runner/deployer_impl.pyi +87 -0
  160. metaflow-stubs/runner/metaflow_runner.pyi +24 -508
  161. metaflow-stubs/runner/nbdeploy.pyi +16 -60
  162. metaflow-stubs/runner/nbrun.pyi +11 -148
  163. metaflow-stubs/runner/subprocess_manager.pyi +9 -10
  164. metaflow-stubs/runner/utils.pyi +44 -9
  165. metaflow-stubs/system/__init__.pyi +9 -107
  166. metaflow-stubs/system/system_logger.pyi +7 -16
  167. metaflow-stubs/system/system_monitor.pyi +6 -16
  168. metaflow-stubs/tagging_util.pyi +6 -10
  169. metaflow-stubs/tuple_util.pyi +6 -5
  170. {ob_metaflow_stubs-6.0.3.116.dist-info → ob_metaflow_stubs-6.0.3.118.dist-info}/METADATA +1 -1
  171. ob_metaflow_stubs-6.0.3.118.dist-info/RECORD +174 -0
  172. {ob_metaflow_stubs-6.0.3.116.dist-info → ob_metaflow_stubs-6.0.3.118.dist-info}/WHEEL +1 -1
  173. metaflow-stubs/metadata/util.pyi +0 -18
  174. ob_metaflow_stubs-6.0.3.116.dist-info/RECORD +0 -140
  175. {ob_metaflow_stubs-6.0.3.116.dist-info → ob_metaflow_stubs-6.0.3.118.dist-info}/top_level.txt +0 -0
@@ -1,31 +1,19 @@
1
- ##################################################################################
2
- # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.27.1+obcheckpoint(0.1.1);ob(v1) #
4
- # Generated on 2024-11-04T20:32:13.033616 #
5
- ##################################################################################
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.851501 #
5
+ ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
+ import metaflow
9
10
  import typing
10
11
  if typing.TYPE_CHECKING:
11
- import metaflow.exception
12
- import metaflow.metadata.metadata
12
+ import metaflow.metadata_provider.metadata
13
13
 
14
- class MetaflowInternalError(metaflow.exception.MetaflowException, metaclass=type):
15
- ...
16
-
17
- class MetaflowTaggingError(metaflow.exception.MetaflowException, metaclass=type):
18
- ...
19
-
20
- def validate_tag(tag):
21
- """
22
- - Tag must be either of bytes-type or unicode-type.
23
- - If tag is of bytes-type, it must be UTF-8 decodable
24
- - If tag is of unicode-type, it must be UTF-8 encodable
25
- - Tag may not be empty string.
26
- - Tag cannot be too long (500 chars)
27
- """
28
- ...
14
+ from ..exception import MetaflowInternalError as MetaflowInternalError
15
+ from ..exception import MetaflowTaggingError as MetaflowTaggingError
16
+ from ..tagging_util import validate_tag as validate_tag
29
17
 
30
18
  class DataArtifact(tuple, metaclass=type):
31
19
  """
@@ -0,0 +1,19 @@
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.851730 #
5
+ ######################################################################################################
6
+
7
+ from __future__ import annotations
8
+
9
+
10
+
11
+ def copy_tree(src, dst, update = False):
12
+ ...
13
+
14
+ def sync_local_metadata_to_datastore(metadata_local_dir, task_ds):
15
+ ...
16
+
17
+ def sync_local_metadata_from_datastore(metadata_local_dir, task_ds):
18
+ ...
19
+
@@ -1,18 +1,13 @@
1
- ##################################################################################
2
- # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.27.1+obcheckpoint(0.1.1);ob(v1) #
4
- # Generated on 2024-11-04T20:32:12.975983 #
5
- ##################################################################################
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.832289 #
5
+ ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
 
10
- class MetaflowException(Exception, metaclass=type):
11
- def __init__(self, msg = "", lineno = None):
12
- ...
13
- def __str__(self):
14
- ...
15
- ...
10
+ from .exception import MetaflowException as MetaflowException
16
11
 
17
12
  DATASTORE_LOCAL_DIR: str
18
13
 
@@ -40,6 +35,8 @@ DEFAULT_SECRETS_BACKEND_TYPE: None
40
35
 
41
36
  DEFAULT_SECRETS_ROLE: None
42
37
 
38
+ DEFAULT_FROM_DEPLOYMENT_IMPL: str
39
+
43
40
  USER: None
44
41
 
45
42
  DATASTORE_SYSROOT_LOCAL: None
@@ -240,8 +237,6 @@ AIRFLOW_KUBERNETES_KUBECONFIG_FILE: None
240
237
 
241
238
  AIRFLOW_KUBERNETES_KUBECONFIG_CONTEXT: None
242
239
 
243
- FROM_DEPLOYMENT_IMPL: str
244
-
245
240
  CONDA_PACKAGE_S3ROOT: None
246
241
 
247
242
  CONDA_PACKAGE_AZUREROOT: None
@@ -1,21 +1,22 @@
1
- ##################################################################################
2
- # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.27.1+obcheckpoint(0.1.1);ob(v1) #
4
- # Generated on 2024-11-04T20:32:13.082093 #
5
- ##################################################################################
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.934305 #
5
+ ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.hf_hub.decorator
11
+ import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.hf_hub.decorator
12
+ import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.modeling_utils.core
13
+ import metaflow.plugins.cards.component_serializer
14
+ import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.checkpoints.decorator
15
+ import metaflow.events
12
16
  import metaflow
13
17
  import typing
14
18
  import metaflow.metaflow_current
15
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.modeling_utils.core
16
- import metaflow.events
17
- import metaflow.plugins.cards.component_serializer
18
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.checkpoints.decorator
19
+
19
20
 
20
21
  TYPE_CHECKING: bool
21
22
 
@@ -224,28 +225,108 @@ class Current(object, metaclass=type):
224
225
  """
225
226
  ...
226
227
  @property
227
- def graph(_):
228
+ def graph(self):
228
229
  ...
229
230
  @property
230
- def card(self) -> "metaflow.plugins.cards.component_serializer.CardComponentCollector":
231
+ def huggingface_hub(self) -> "metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.hf_hub.decorator.HuggingfaceRegistry":
231
232
  """
232
- (only in the presence of the @card decorator)
233
+ (only in the presence of the @huggingface_hub decorator)
233
234
 
234
- The `@card` decorator makes the cards available through the `current.card`
235
- object. If multiple `@card` decorators are present, you can add an `ID` to
236
- distinguish between them using `@card(id=ID)` as the decorator. You will then
237
- be able to access that specific card using `current.card[ID].
235
+ The `@huggingface_hub` injects a `huggingface_hub` object into the `current` object. This object provides syntactic sugar
236
+ over [huggingface_hub](https://github.com/huggingface/huggingface_hub)'s
237
+ [snapshot_download](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/file_download#huggingface_hub.snapshot_download) function.
238
+ The `current.huggingface_hub.snapshot_download` function downloads objects from huggingface hub and saves them to the Metaflow's datastore under the
239
+ `<repo_type>/<repo_id>` name. The `repo_type` is by default `model` and can be overriden by passing the `repo_type` parameter to the `snapshot_download` function.
238
240
 
239
- Methods available are `append` and `extend`
241
+
242
+ Usage:
243
+ ------
244
+
245
+ **Usage: creating references of models from huggingface that may be loaded in downstream steps**
246
+ ```python
247
+ @huggingface_hub
248
+ @step
249
+ def pull_model_from_huggingface(self):
250
+ # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
251
+ # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
252
+ # with the same `repo_id` in the backend storage, it will not download the model again. The return
253
+ # value of the function is a reference to the model in the backend storage.
254
+ # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
255
+
256
+ self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
257
+ self.llama_model = current.huggingface_hub.snapshot_download(
258
+ repo_id=self.model_id,
259
+ allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
260
+ )
261
+ self.next(self.train)
262
+ ```
263
+
264
+ **Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
265
+ ```python
266
+ @huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
267
+ @step
268
+ def pull_model_from_huggingface(self):
269
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
270
+ ```
271
+
272
+ ```python
273
+ @huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
274
+ @step
275
+ def finetune_model(self):
276
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
277
+ # path_to_model will be /my-directory
278
+ ```
279
+
280
+ ```python
281
+ # Takes all the arguments passed to `snapshot_download`
282
+ # except for `local_dir`
283
+ @huggingface_hub(load=[
284
+ {
285
+ "repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
286
+ },
287
+ {
288
+ "repo_id": "myorg/mistral-lora",
289
+ "repo_type": "model",
290
+ },
291
+ ])
292
+ @step
293
+ def finetune_model(self):
294
+ path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
295
+ # path_to_model will be /my-directory
296
+ ```
297
+ """
298
+ ...
299
+ @property
300
+ def parallel(self) -> "metaflow.metaflow_current.Parallel":
301
+ """
302
+ (only in the presence of the @parallel decorator)
303
+
304
+ Returns a namedtuple with relevant information about the parallel task.
240
305
 
241
306
  Returns
242
307
  -------
243
- CardComponentCollector
244
- The or one of the cards attached to this step.
308
+ Parallel
309
+ `namedtuple` with the following fields:
310
+ - main_ip (`str`)
311
+ The IP address of the control task.
312
+ - num_nodes (`int`)
313
+ The total number of tasks created by @parallel
314
+ - node_index (`int`)
315
+ The index of the current task in all the @parallel tasks.
316
+ - control_task_id (`Optional[str]`)
317
+ The task ID of the control task. Available to all tasks.
245
318
  """
246
319
  ...
247
320
  @property
248
- def model(self) -> "metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.modeling_utils.core.ModelSerializer":
321
+ def is_parallel(self) -> bool:
322
+ """
323
+ (only in the presence of the @parallel decorator)
324
+
325
+ True if the current step is a @parallel step.
326
+ """
327
+ ...
328
+ @property
329
+ def model(self) -> "metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.modeling_utils.core.ModelSerializer":
249
330
  """
250
331
  (only in the presence of the @model decorator)
251
332
 
@@ -306,69 +387,7 @@ class Current(object, metaclass=type):
306
387
  """
307
388
  ...
308
389
  @property
309
- def parallel(self) -> "metaflow.metaflow_current.Parallel":
310
- """
311
- (only in the presence of the @parallel decorator)
312
-
313
- Returns a namedtuple with relevant information about the parallel task.
314
-
315
- Returns
316
- -------
317
- Parallel
318
- `namedtuple` with the following fields:
319
- - main_ip (`str`)
320
- The IP address of the control task.
321
- - num_nodes (`int`)
322
- The total number of tasks created by @parallel
323
- - node_index (`int`)
324
- The index of the current task in all the @parallel tasks.
325
- - control_task_id (`Optional[str]`)
326
- The task ID of the control task. Available to all tasks.
327
- """
328
- ...
329
- @property
330
- def is_parallel(self) -> bool:
331
- """
332
- (only in the presence of the @parallel decorator)
333
-
334
- True if the current step is a @parallel step.
335
- """
336
- ...
337
- @property
338
- def huggingface_hub(self) -> "metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.hf_hub.decorator.HuggingfaceRegistry":
339
- """
340
- (only in the presence of the @huggingface_hub decorator)
341
-
342
- The `@huggingface_hub` injects a `huggingface_hub` object into the `current` object. This object provides syntactic sugar
343
- over [huggingface_hub](https://github.com/huggingface/huggingface_hub)'s
344
- [snapshot_download](https://huggingface.co/docs/huggingface_hub/main/en/package_reference/file_download#huggingface_hub.snapshot_download) function.
345
- The `current.huggingface_hub.snapshot_download` function downloads objects from huggingface hub and saves them to the Metaflow's datastore under the
346
- `<repo_type>/<repo_id>` name. The `repo_type` is by default `model` and can be overriden by passing the `repo_type` parameter to the `snapshot_download` function.
347
-
348
-
349
- Usage:
350
- ------
351
- ```python
352
- @huggingface_hub
353
- @step
354
- def pull_model_from_huggingface(self):
355
- # `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
356
- # and saves it in the backend storage based on the model's `repo_id`. If there exists a model
357
- # with the same `repo_id` in the backend storage, it will not download the model again. The return
358
- # value of the function is a reference to the model in the backend storage.
359
- # This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
360
-
361
- self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
362
- self.llama_model = current.huggingface_hub.snapshot_download(
363
- repo_id=self.model_id,
364
- allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
365
- )
366
- self.next(self.train)
367
- ```
368
- """
369
- ...
370
- @property
371
- def checkpoint(self) -> "metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.checkpoints.decorator.CurrentCheckpointer":
390
+ def checkpoint(self) -> "metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.checkpoints.decorator.CurrentCheckpointer":
372
391
  """
373
392
  (only in the presence of the @checkpoint decorator)
374
393
 
@@ -429,16 +448,21 @@ class Current(object, metaclass=type):
429
448
  """
430
449
  ...
431
450
  @property
432
- def trigger(self) -> "metaflow.events.Trigger":
451
+ def card(self) -> "metaflow.plugins.cards.component_serializer.CardComponentCollector":
433
452
  """
434
- (only in the presence of the @trigger, or @trigger_on_finish decorators)
453
+ (only in the presence of the @card decorator)
435
454
 
436
- Returns `Trigger` if the current run is triggered by an event
455
+ The `@card` decorator makes the cards available through the `current.card`
456
+ object. If multiple `@card` decorators are present, you can add an `ID` to
457
+ distinguish between them using `@card(id=ID)` as the decorator. You will then
458
+ be able to access that specific card using `current.card[ID].
459
+
460
+ Methods available are `append` and `extend`
437
461
 
438
462
  Returns
439
463
  -------
440
- Trigger
441
- `Trigger` if triggered by an event
464
+ CardComponentCollector
465
+ The or one of the cards attached to this step.
442
466
  """
443
467
  ...
444
468
  @property
@@ -508,6 +532,19 @@ class Current(object, metaclass=type):
508
532
  True if the flow is deployed with `--production`.
509
533
  """
510
534
  ...
535
+ @property
536
+ def trigger(self) -> "metaflow.events.Trigger":
537
+ """
538
+ (only in the presence of the @trigger_on_finish, or @trigger decorators)
539
+
540
+ Returns `Trigger` if the current run is triggered by an event
541
+
542
+ Returns
543
+ -------
544
+ Trigger
545
+ `Trigger` if triggered by an event
546
+ """
547
+ ...
511
548
  ...
512
549
 
513
550
  current: Current
@@ -0,0 +1,6 @@
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.837688 #
5
+ ######################################################################################################
6
+
@@ -0,0 +1,6 @@
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.846039 #
5
+ ######################################################################################################
6
+
@@ -0,0 +1,6 @@
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.846103 #
5
+ ######################################################################################################
6
+
@@ -0,0 +1,6 @@
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.846162 #
5
+ ######################################################################################################
6
+
@@ -0,0 +1,6 @@
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.846219 #
5
+ ######################################################################################################
6
+
@@ -0,0 +1,129 @@
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.911726 #
5
+ ######################################################################################################
6
+
7
+ from __future__ import annotations
8
+
9
+ import metaflow
10
+ import typing
11
+ if typing.TYPE_CHECKING:
12
+ import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
13
+ import metaflow.datastore.datastore_storage
14
+ import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastore.core
15
+ import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.checkpoints.checkpoint_storage
16
+
17
+ from ..exceptions import KeyNotCompatibleWithObjectException as KeyNotCompatibleWithObjectException
18
+ from ..utils.identity_utils import pathspec_hash as pathspec_hash
19
+ from ..utils.general import replace_start_and_end_slash as replace_start_and_end_slash
20
+ from ..datastore.core import allow_safe as allow_safe
21
+ from ..datastore.core import DatastoreInterface as DatastoreInterface
22
+ from ..datastore.core import ObjectStorage as ObjectStorage
23
+ from ..datastore.core import STORAGE_FORMATS as STORAGE_FORMATS
24
+ from ..datastore.exceptions import DatastoreReadInitException as DatastoreReadInitException
25
+ from ..datastore.exceptions import DatastoreWriteInitException as DatastoreWriteInitException
26
+ from ..datastore.exceptions import DatastoreNotReadyException as DatastoreNotReadyException
27
+ from ..datastructures import CheckpointArtifact as CheckpointArtifact
28
+ from ..datastore.utils import safe_serialize as safe_serialize
29
+
30
+ DEFAULT_NAME: str
31
+
32
+ CHECKPOINTS_STORAGE_PREFIX: str
33
+
34
+ DEFAULT_STORAGE_FORMAT: str
35
+
36
+ ARTIFACT_STORE_NAME: str
37
+
38
+ METADATA_STORE_NAME: str
39
+
40
+ ARTIFACT_METADATA_STORE_NAME: str
41
+
42
+ class CheckpointsPathComponents(tuple, metaclass=type):
43
+ """
44
+ CheckpointsPathComponents(flow_name, step_name, scope, task_identifier, pathspec_hash, attempt, name, version_id, is_metadata, key_name, root_prefix)
45
+ """
46
+ @staticmethod
47
+ def __new__(_cls, flow_name, step_name, scope, task_identifier, pathspec_hash, attempt, name, version_id, is_metadata, key_name, root_prefix):
48
+ """
49
+ Create new instance of CheckpointsPathComponents(flow_name, step_name, scope, task_identifier, pathspec_hash, attempt, name, version_id, is_metadata, key_name, root_prefix)
50
+ """
51
+ ...
52
+ def __repr__(self):
53
+ """
54
+ Return a nicely formatted representation string
55
+ """
56
+ ...
57
+ def __getnewargs__(self):
58
+ """
59
+ Return self as a plain tuple. Used by copy and pickle.
60
+ """
61
+ ...
62
+ ...
63
+
64
+ def decompose_key_artifact_metadata_store(key) -> CheckpointsPathComponents:
65
+ ...
66
+
67
+ def decompose_key_artifact_store(key) -> CheckpointsPathComponents:
68
+ """
69
+ Convert Key into Path Components.
70
+ PATH COMPONENTS: mf.checkpoints/artifacts/<flow_name>/<step_name>/<scope>/<task_identifier>/<pathspec_hash>.<attempt>.<name>.<version_id>
71
+ """
72
+ ...
73
+
74
+ def decompose_key_metadata_store(key) -> CheckpointsPathComponents:
75
+ """
76
+ Convert Key into Path Components.
77
+ PATH COMPONENTS: mf.checkpoints/artifacts/<flow_name>/<step_name>/<scope>/<task_identifier>/<pathspec_hash>.<attempt>.<name>.<version_id>
78
+ """
79
+ ...
80
+
81
+ class CheckpointDatastore(metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastore.core.DatastoreInterface, metaclass=type):
82
+ """
83
+ Consisits of 3 main components:
84
+ - `artifact_store`: This is where the checkpoint artifacts are stored.
85
+ - This key to the checkpoint in this store becomes the "key for the checkpoint"
86
+ - `metadata_store`: This is where the metadata of the checkpoint is stored it based on the currently executing task (path structure resembles that of a metaflow pathspec).
87
+ - This store helps retrieve information about all the checkpoints stored for a task during the execution.
88
+ - `artifact_metadatastore`: This is similar to the metadata store but holds a pathstructure similar to the artifact store.
89
+ - this store helps reverse lookup the Checkpoint metadata object from the checkpoint key.
90
+ """
91
+ @property
92
+ def metadata_ready(self):
93
+ ...
94
+ @property
95
+ def artifact_ready(self):
96
+ ...
97
+ def set_root_prefix(self, root_prefix):
98
+ ...
99
+ @classmethod
100
+ def init_read_store(cls, storage_backend: metaflow.datastore.datastore_storage.DataStoreStorage, pathspec = None, checkpoint_key = None):
101
+ """
102
+ This will initialize the datastore for reading.
103
+
104
+ - If there is only the pathspec that's provided then it can mean the user is doing a list operations
105
+ - if only the checkpoint_key is provided then it can mean the user is trying to load a specific checkpoint
106
+ """
107
+ ...
108
+ def create_key_name(self, *args):
109
+ ...
110
+ @classmethod
111
+ def init_write_store(cls, storage_backend: metaflow.datastore.datastore_storage.DataStoreStorage, pathspec, scope, task_identifier):
112
+ ...
113
+ def save(self, local_path: str, attempt, version_id, name = 'mfchckpt', metadata = {}, set_latest = True, storage_format = 'files') -> metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.CheckpointArtifact:
114
+ ...
115
+ def latest(*args, **kwargs):
116
+ ...
117
+ def load(self, local_path, version_id, attempt, name, storage_format = 'files'):
118
+ ...
119
+ def load_metadata(self, attempt, version_id, name = 'mfchckpt') -> dict:
120
+ ...
121
+ def list(self, name = None, attempt = None, within_task = True):
122
+ ...
123
+ @classmethod
124
+ def decompose_key(cls, key) -> CheckpointsPathComponents:
125
+ ...
126
+ def __init__(self, artifact_store: metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastore.core.ObjectStorage, metadata_store: metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastore.core.ObjectStorage, artifact_metadatastore: metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastore.core.ObjectStorage):
127
+ ...
128
+ ...
129
+
@@ -0,0 +1,26 @@
1
+ ######################################################################################################
2
+ # Auto-generated Metaflow stub file #
3
+ # MF version: 2.12.30.1+obcheckpoint(0.1.4);ob(v1) #
4
+ # Generated on 2024-11-13T23:34:52.869613 #
5
+ ######################################################################################################
6
+
7
+ from __future__ import annotations
8
+
9
+ import typing
10
+ if typing.TYPE_CHECKING:
11
+ import metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
12
+
13
+ from .core import Checkpointer as Checkpointer
14
+ from .core import WriteResolver as WriteResolver
15
+ from .core import ReadResolver as ReadResolver
16
+ from ..datastructures import CheckpointArtifact as CheckpointArtifact
17
+
18
+ TYPE_CHECKING: bool
19
+
20
+ CHECKPOINT_UID_ENV_VAR_NAME: str
21
+
22
+ DEFAULT_NAME: str
23
+
24
+ def load_checkpoint(checkpoint: typing.Union[metaflow.mf_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures.CheckpointArtifact, dict, str], local_path: str):
25
+ ...
26
+