wandb 0.13.10__py3-none-any.whl → 0.14.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. wandb/__init__.py +2 -3
  2. wandb/apis/__init__.py +1 -3
  3. wandb/apis/importers/__init__.py +4 -0
  4. wandb/apis/importers/base.py +312 -0
  5. wandb/apis/importers/mlflow.py +113 -0
  6. wandb/apis/internal.py +29 -2
  7. wandb/apis/normalize.py +6 -5
  8. wandb/apis/public.py +163 -180
  9. wandb/apis/reports/_templates.py +6 -12
  10. wandb/apis/reports/report.py +1 -1
  11. wandb/apis/reports/runset.py +1 -3
  12. wandb/apis/reports/util.py +12 -10
  13. wandb/beta/workflows.py +57 -34
  14. wandb/catboost/__init__.py +1 -2
  15. wandb/cli/cli.py +215 -133
  16. wandb/data_types.py +63 -56
  17. wandb/docker/__init__.py +78 -16
  18. wandb/docker/auth.py +21 -22
  19. wandb/env.py +0 -1
  20. wandb/errors/__init__.py +8 -116
  21. wandb/errors/term.py +1 -1
  22. wandb/fastai/__init__.py +1 -2
  23. wandb/filesync/dir_watcher.py +8 -5
  24. wandb/filesync/step_prepare.py +76 -75
  25. wandb/filesync/step_upload.py +1 -2
  26. wandb/integration/catboost/__init__.py +1 -3
  27. wandb/integration/catboost/catboost.py +8 -14
  28. wandb/integration/fastai/__init__.py +7 -13
  29. wandb/integration/gym/__init__.py +35 -4
  30. wandb/integration/keras/__init__.py +3 -3
  31. wandb/integration/keras/callbacks/metrics_logger.py +9 -8
  32. wandb/integration/keras/callbacks/model_checkpoint.py +9 -9
  33. wandb/integration/keras/callbacks/tables_builder.py +31 -19
  34. wandb/integration/kfp/kfp_patch.py +20 -17
  35. wandb/integration/kfp/wandb_logging.py +1 -2
  36. wandb/integration/lightgbm/__init__.py +21 -19
  37. wandb/integration/prodigy/prodigy.py +6 -7
  38. wandb/integration/sacred/__init__.py +9 -12
  39. wandb/integration/sagemaker/__init__.py +1 -3
  40. wandb/integration/sagemaker/auth.py +0 -1
  41. wandb/integration/sagemaker/config.py +1 -1
  42. wandb/integration/sagemaker/resources.py +1 -1
  43. wandb/integration/sb3/sb3.py +8 -4
  44. wandb/integration/tensorboard/__init__.py +1 -3
  45. wandb/integration/tensorboard/log.py +8 -8
  46. wandb/integration/tensorboard/monkeypatch.py +11 -9
  47. wandb/integration/tensorflow/__init__.py +1 -3
  48. wandb/integration/xgboost/__init__.py +4 -6
  49. wandb/integration/yolov8/__init__.py +7 -0
  50. wandb/integration/yolov8/yolov8.py +250 -0
  51. wandb/jupyter.py +31 -35
  52. wandb/lightgbm/__init__.py +1 -2
  53. wandb/old/settings.py +2 -2
  54. wandb/plot/bar.py +1 -2
  55. wandb/plot/confusion_matrix.py +1 -3
  56. wandb/plot/histogram.py +1 -2
  57. wandb/plot/line.py +1 -2
  58. wandb/plot/line_series.py +4 -4
  59. wandb/plot/pr_curve.py +17 -20
  60. wandb/plot/roc_curve.py +1 -3
  61. wandb/plot/scatter.py +1 -2
  62. wandb/proto/v3/wandb_server_pb2.py +85 -39
  63. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  64. wandb/proto/v4/wandb_server_pb2.py +51 -39
  65. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  66. wandb/sdk/__init__.py +1 -3
  67. wandb/sdk/backend/backend.py +1 -1
  68. wandb/sdk/data_types/_dtypes.py +38 -30
  69. wandb/sdk/data_types/base_types/json_metadata.py +1 -3
  70. wandb/sdk/data_types/base_types/media.py +17 -17
  71. wandb/sdk/data_types/base_types/wb_value.py +33 -26
  72. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +91 -125
  73. wandb/sdk/data_types/helper_types/classes.py +1 -1
  74. wandb/sdk/data_types/helper_types/image_mask.py +12 -12
  75. wandb/sdk/data_types/histogram.py +5 -4
  76. wandb/sdk/data_types/html.py +1 -2
  77. wandb/sdk/data_types/image.py +11 -11
  78. wandb/sdk/data_types/molecule.py +3 -6
  79. wandb/sdk/data_types/object_3d.py +1 -2
  80. wandb/sdk/data_types/plotly.py +1 -2
  81. wandb/sdk/data_types/saved_model.py +10 -8
  82. wandb/sdk/data_types/video.py +1 -1
  83. wandb/sdk/integration_utils/data_logging.py +5 -5
  84. wandb/sdk/interface/artifacts.py +288 -266
  85. wandb/sdk/interface/interface.py +2 -3
  86. wandb/sdk/interface/interface_grpc.py +1 -1
  87. wandb/sdk/interface/interface_queue.py +1 -1
  88. wandb/sdk/interface/interface_relay.py +1 -1
  89. wandb/sdk/interface/interface_shared.py +1 -2
  90. wandb/sdk/interface/interface_sock.py +1 -1
  91. wandb/sdk/interface/message_future.py +1 -1
  92. wandb/sdk/interface/message_future_poll.py +1 -1
  93. wandb/sdk/interface/router.py +1 -1
  94. wandb/sdk/interface/router_queue.py +1 -1
  95. wandb/sdk/interface/router_relay.py +1 -1
  96. wandb/sdk/interface/router_sock.py +1 -1
  97. wandb/sdk/interface/summary_record.py +1 -1
  98. wandb/sdk/internal/artifacts.py +1 -1
  99. wandb/sdk/internal/datastore.py +2 -3
  100. wandb/sdk/internal/file_pusher.py +5 -3
  101. wandb/sdk/internal/file_stream.py +22 -19
  102. wandb/sdk/internal/handler.py +5 -4
  103. wandb/sdk/internal/internal.py +1 -1
  104. wandb/sdk/internal/internal_api.py +115 -55
  105. wandb/sdk/internal/job_builder.py +1 -3
  106. wandb/sdk/internal/profiler.py +1 -1
  107. wandb/sdk/internal/progress.py +4 -6
  108. wandb/sdk/internal/sample.py +1 -3
  109. wandb/sdk/internal/sender.py +28 -16
  110. wandb/sdk/internal/settings_static.py +5 -5
  111. wandb/sdk/internal/system/assets/__init__.py +1 -0
  112. wandb/sdk/internal/system/assets/cpu.py +3 -9
  113. wandb/sdk/internal/system/assets/disk.py +2 -4
  114. wandb/sdk/internal/system/assets/gpu.py +6 -18
  115. wandb/sdk/internal/system/assets/gpu_apple.py +2 -4
  116. wandb/sdk/internal/system/assets/interfaces.py +50 -22
  117. wandb/sdk/internal/system/assets/ipu.py +1 -3
  118. wandb/sdk/internal/system/assets/memory.py +7 -13
  119. wandb/sdk/internal/system/assets/network.py +4 -8
  120. wandb/sdk/internal/system/assets/open_metrics.py +283 -0
  121. wandb/sdk/internal/system/assets/tpu.py +1 -4
  122. wandb/sdk/internal/system/assets/trainium.py +26 -14
  123. wandb/sdk/internal/system/system_info.py +2 -3
  124. wandb/sdk/internal/system/system_monitor.py +52 -20
  125. wandb/sdk/internal/tb_watcher.py +12 -13
  126. wandb/sdk/launch/_project_spec.py +54 -65
  127. wandb/sdk/launch/agent/agent.py +374 -90
  128. wandb/sdk/launch/builder/abstract.py +61 -7
  129. wandb/sdk/launch/builder/build.py +81 -110
  130. wandb/sdk/launch/builder/docker_builder.py +181 -0
  131. wandb/sdk/launch/builder/kaniko_builder.py +419 -0
  132. wandb/sdk/launch/builder/noop.py +31 -12
  133. wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +70 -20
  134. wandb/sdk/launch/environment/abstract.py +28 -0
  135. wandb/sdk/launch/environment/aws_environment.py +276 -0
  136. wandb/sdk/launch/environment/gcp_environment.py +271 -0
  137. wandb/sdk/launch/environment/local_environment.py +65 -0
  138. wandb/sdk/launch/github_reference.py +3 -8
  139. wandb/sdk/launch/launch.py +38 -29
  140. wandb/sdk/launch/launch_add.py +6 -8
  141. wandb/sdk/launch/loader.py +230 -0
  142. wandb/sdk/launch/registry/abstract.py +54 -0
  143. wandb/sdk/launch/registry/elastic_container_registry.py +163 -0
  144. wandb/sdk/launch/registry/google_artifact_registry.py +203 -0
  145. wandb/sdk/launch/registry/local_registry.py +62 -0
  146. wandb/sdk/launch/runner/abstract.py +1 -16
  147. wandb/sdk/launch/runner/{kubernetes.py → kubernetes_runner.py} +83 -95
  148. wandb/sdk/launch/runner/local_container.py +46 -22
  149. wandb/sdk/launch/runner/local_process.py +1 -4
  150. wandb/sdk/launch/runner/{aws.py → sagemaker_runner.py} +53 -212
  151. wandb/sdk/launch/runner/{gcp_vertex.py → vertex_runner.py} +38 -55
  152. wandb/sdk/launch/sweeps/__init__.py +3 -2
  153. wandb/sdk/launch/sweeps/scheduler.py +132 -39
  154. wandb/sdk/launch/sweeps/scheduler_sweep.py +80 -89
  155. wandb/sdk/launch/utils.py +101 -30
  156. wandb/sdk/launch/wandb_reference.py +2 -7
  157. wandb/sdk/lib/_settings_toposort_generate.py +166 -0
  158. wandb/sdk/lib/_settings_toposort_generated.py +201 -0
  159. wandb/sdk/lib/apikey.py +2 -4
  160. wandb/sdk/lib/config_util.py +4 -1
  161. wandb/sdk/lib/console.py +1 -3
  162. wandb/sdk/lib/deprecate.py +3 -3
  163. wandb/sdk/lib/file_stream_utils.py +7 -5
  164. wandb/sdk/lib/filenames.py +1 -1
  165. wandb/sdk/lib/filesystem.py +61 -5
  166. wandb/sdk/lib/git.py +1 -3
  167. wandb/sdk/lib/import_hooks.py +4 -7
  168. wandb/sdk/lib/ipython.py +8 -5
  169. wandb/sdk/lib/lazyloader.py +1 -3
  170. wandb/sdk/lib/mailbox.py +14 -4
  171. wandb/sdk/lib/proto_util.py +10 -5
  172. wandb/sdk/lib/redirect.py +15 -22
  173. wandb/sdk/lib/reporting.py +1 -3
  174. wandb/sdk/lib/retry.py +4 -5
  175. wandb/sdk/lib/runid.py +1 -3
  176. wandb/sdk/lib/server.py +15 -9
  177. wandb/sdk/lib/sock_client.py +1 -1
  178. wandb/sdk/lib/sparkline.py +1 -1
  179. wandb/sdk/lib/wburls.py +1 -1
  180. wandb/sdk/service/port_file.py +1 -2
  181. wandb/sdk/service/service.py +36 -13
  182. wandb/sdk/service/service_base.py +12 -1
  183. wandb/sdk/verify/verify.py +5 -7
  184. wandb/sdk/wandb_artifacts.py +142 -177
  185. wandb/sdk/wandb_config.py +5 -8
  186. wandb/sdk/wandb_helper.py +1 -1
  187. wandb/sdk/wandb_init.py +24 -13
  188. wandb/sdk/wandb_login.py +9 -9
  189. wandb/sdk/wandb_manager.py +39 -4
  190. wandb/sdk/wandb_metric.py +2 -6
  191. wandb/sdk/wandb_require.py +4 -15
  192. wandb/sdk/wandb_require_helpers.py +1 -9
  193. wandb/sdk/wandb_run.py +95 -141
  194. wandb/sdk/wandb_save.py +1 -3
  195. wandb/sdk/wandb_settings.py +149 -54
  196. wandb/sdk/wandb_setup.py +66 -46
  197. wandb/sdk/wandb_summary.py +13 -10
  198. wandb/sdk/wandb_sweep.py +6 -7
  199. wandb/sdk/wandb_watch.py +1 -1
  200. wandb/sklearn/calculate/confusion_matrix.py +1 -1
  201. wandb/sklearn/calculate/learning_curve.py +1 -1
  202. wandb/sklearn/calculate/summary_metrics.py +1 -3
  203. wandb/sklearn/plot/__init__.py +1 -1
  204. wandb/sklearn/plot/classifier.py +27 -18
  205. wandb/sklearn/plot/clusterer.py +4 -5
  206. wandb/sklearn/plot/regressor.py +4 -4
  207. wandb/sklearn/plot/shared.py +2 -2
  208. wandb/sync/__init__.py +1 -3
  209. wandb/sync/sync.py +4 -5
  210. wandb/testing/relay.py +11 -10
  211. wandb/trigger.py +1 -1
  212. wandb/util.py +106 -81
  213. wandb/viz.py +4 -4
  214. wandb/wandb_agent.py +50 -50
  215. wandb/wandb_controller.py +2 -3
  216. wandb/wandb_run.py +1 -2
  217. wandb/wandb_torch.py +1 -1
  218. wandb/xgboost/__init__.py +1 -2
  219. {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/METADATA +6 -2
  220. {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/RECORD +224 -209
  221. {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/WHEEL +1 -1
  222. wandb/sdk/launch/builder/docker.py +0 -80
  223. wandb/sdk/launch/builder/kaniko.py +0 -393
  224. wandb/sdk/launch/builder/loader.py +0 -32
  225. wandb/sdk/launch/runner/loader.py +0 -50
  226. {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/LICENSE +0 -0
  227. {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/entry_points.txt +0 -0
  228. {wandb-0.13.10.dist-info → wandb-0.14.0.dist-info}/top_level.txt +0 -0
@@ -4,9 +4,7 @@ from .util import coalesce
4
4
 
5
5
 
6
6
  def create_example_header():
7
- """
8
- Creates an example header with image at top.
9
- """
7
+ """Create an example header with image at top."""
10
8
  import wandb.apis.reports as wr
11
9
 
12
10
  return [
@@ -23,9 +21,7 @@ def create_example_header():
23
21
 
24
22
 
25
23
  def create_example_footer():
26
- """
27
- Creates an example footer with image and text at bottom.
28
- """
24
+ """Create an example footer with image and text at bottom."""
29
25
  import wandb.apis.reports as wr
30
26
 
31
27
  return [
@@ -49,9 +45,9 @@ def create_enterprise_report(
49
45
  body=None,
50
46
  footer=None,
51
47
  ):
52
- """
53
- Creates an example enterprise report with a header and footer which
54
- can be used to add custom branding to reports.
48
+ """Create an example enterprise report with a header and footer.
49
+
50
+ Can be used to add custom branding to reports.
55
51
  """
56
52
  import wandb.apis.reports as wr
57
53
 
@@ -74,9 +70,7 @@ def create_customer_landing_page(
74
70
  main_contact="My Contact (name@email.com)",
75
71
  slack_link="https://company.slack.com",
76
72
  ):
77
- """
78
- Creates an example customer landing page using data from Andrew's demo.
79
- """
73
+ """Create an example customer landing page using data from Andrew's demo."""
80
74
  import wandb.apis.reports as wr
81
75
 
82
76
  project = coalesce(project, "default-project")
@@ -220,7 +220,7 @@ class Report(Base):
220
220
  return self
221
221
 
222
222
  def to_html(self, height: int = 1024, hidden: bool = False) -> str:
223
- """Generate HTML containing an iframe displaying this report"""
223
+ """Generate HTML containing an iframe displaying this report."""
224
224
  try:
225
225
  url = self.url + "?jupyter=true"
226
226
  style = f"border:none;width:100%;height:{height}px;"
@@ -43,9 +43,7 @@ class Runset(Base):
43
43
 
44
44
  @classmethod
45
45
  def from_json(cls, spec: Dict[str, Any]) -> T:
46
- """
47
- This has a custom implementation because sometimes runsets are missing the project field.
48
- """
46
+ """This has a custom implementation because sometimes runsets are missing the project field."""
49
47
  obj = cls()
50
48
  obj._spec = spec
51
49
 
@@ -22,10 +22,10 @@ Func = Callable[[T], V]
22
22
 
23
23
 
24
24
  def generate_name(length: int = 12) -> str:
25
- """
26
- Generate random name.
25
+ """Generate a random name.
26
+
27
27
  This implementation roughly based the following snippet in core:
28
- https://github.com/wandb/core/blob/master/lib/js/cg/src/utils/string.ts#L39-L44
28
+ https://github.com/wandb/core/blob/master/lib/js/cg/src/utils/string.ts#L39-L44.
29
29
  """
30
30
 
31
31
  # Borrowed from numpy: https://github.com/numpy/numpy/blob/v1.23.0/numpy/core/numeric.py#L2069-L2123
@@ -54,14 +54,17 @@ def generate_name(length: int = 12) -> str:
54
54
 
55
55
 
56
56
  def coalesce(*arg: Any) -> Any:
57
- """Return the first non-none value in the list of arguments. Similar to ?? in C#"""
57
+ """Return the first non-none value in the list of arguments.
58
+
59
+ Similar to ?? in C#.
60
+ """
58
61
  return next((a for a in arg if a is not None), None)
59
62
 
60
63
 
61
64
  def nested_get(json: dict, keys: str) -> Any:
62
- """
63
- Given a nested JSON dict and path, get the element at the terminal node.
64
- The first item of the path can be an object
65
+ """Get the element at the terminal node of a nested JSON dict based on `path`.
66
+
67
+ The first item of the path can be an object.
65
68
  """
66
69
  keys = keys.split(".")
67
70
  if len(keys) == 1:
@@ -81,8 +84,8 @@ def nested_get(json: dict, keys: str) -> Any:
81
84
 
82
85
 
83
86
  def nested_set(json: dict, keys: str, value: Any) -> None:
84
- """
85
- Given a nested JSON dict and path, set the element at the terminal node.
87
+ """Set the element at the terminal node of a nested JSON dict based on `path`.
88
+
86
89
  The first item of the path can be an object.
87
90
 
88
91
  If nodes do not exist, they are created along the way.
@@ -323,7 +326,6 @@ def fix_collisions(panels: List[Panel]) -> List[Panel]:
323
326
  for i, p1 in enumerate(panels):
324
327
  for p2 in panels[i:]:
325
328
  if collides(p1, p2):
326
-
327
329
  # try to move right
328
330
  x, y = shift(p1, p2)
329
331
  if p2.layout["x"] + p2.layout["w"] + x <= x_max:
wandb/beta/workflows.py CHANGED
@@ -16,15 +16,17 @@ def _add_any(
16
16
  ], # todo: add dataframe
17
17
  name: Optional[str],
18
18
  ) -> Any:
19
- """High-level wrapper to add object(s) to an artifact - calls any of the .add* methods
20
- under Artifact depending on the type of object that's passed in. This will probably be moved
21
- to the Artifact class in the future.
19
+ """Add an object to an artifact.
22
20
 
23
- Args:
24
- artifact: `ArtifactInterface` - most likely a LocalArtifact created with `wandb.Artifact(...)`
21
+ High-level wrapper to add object(s) to an artifact - calls any of the .add* methods
22
+ under Artifact depending on the type of object that's passed in. This will probably
23
+ be moved to the Artifact class in the future.
25
24
 
26
- path_or_obj: `Union[str, ArtifactManifestEntry, data_types.WBValue]` - either a str or valid object which
27
- indicates what to add to an artifact.
25
+ Args:
26
+ artifact: `ArtifactInterface` - most likely a LocalArtifact created with
27
+ `wandb.Artifact(...)`
28
+ path_or_obj: `Union[str, ArtifactManifestEntry, data_types.WBValue]` - either a
29
+ str or valid object which indicates what to add to an artifact.
28
30
 
29
31
  name: `str` - the name of the object which is added to an artifact.
30
32
 
@@ -61,15 +63,20 @@ def _log_artifact_version(
61
63
  scope_project: Optional[bool] = None,
62
64
  job_type: str = "auto",
63
65
  ) -> ArtifactInterface:
64
- """Creates an artifact, populates it, and logs it with a run.
66
+ """Create an artifact, populate it, and log it with a run.
67
+
65
68
  If a run is not present, we create one.
66
69
 
67
70
  Args:
68
- name: `str` - name of the artifact. If not scoped to a project, name will be suffixed by "-{run_id}".
69
- type: `str` - type of the artifact, used in the UI to group artifacts of the same type.
70
- entries: `Dict` - dictionary containing the named objects we want added to this artifact.
71
+ name: `str` - name of the artifact. If not scoped to a project, name will be
72
+ suffixed by "-{run_id}".
73
+ type: `str` - type of the artifact, used in the UI to group artifacts of the
74
+ same type.
75
+ entries: `Dict` - dictionary containing the named objects we want added to this
76
+ artifact.
71
77
  description: `str` - text description of artifact.
72
- metadata: `Dict` - users can pass in artifact-specific metadata here, will be visible in the UI.
78
+ metadata: `Dict` - users can pass in artifact-specific metadata here, will be
79
+ visible in the UI.
73
80
  project: `str` - project under which to place this artifact.
74
81
  scope_project: `bool` - if True, we will not suffix `name` with "-{run_id}".
75
82
  job_type: `str` - Only applied if run is not present and we create one.
@@ -114,28 +121,35 @@ def log_model(
114
121
  scope_project: Optional[bool] = None,
115
122
  **kwargs: Dict[str, Any],
116
123
  ) -> "_SavedModel":
117
- """Logs a model object to enable model-centric workflows in the UI.
118
- Supported frameworks include PyTorch, Keras, Tensorflow, Scikit-learn, etc.
119
- Under the hood, we create a model artifact, bind it to the run that produced this model,
124
+ """Log a model object to enable model-centric workflows in the UI.
125
+
126
+ Supported frameworks include PyTorch, Keras, Tensorflow, Scikit-learn, etc. Under
127
+ the hood, we create a model artifact, bind it to the run that produced this model,
120
128
  associate it with the latest metrics logged with `wandb.log(...)` and more.
121
129
 
122
130
  Args:
123
- model_obj: any model object created with the following ML frameworks: PyTorch, Keras, Tensorflow, Scikit-learn.
124
- name: `str` - name of the model artifact that will be created to house this model_obj.
125
- aliases: `str, List[str]` - optional alias(es) that will be applied on this model and allow for unique
126
- identification. The alias "latest" will always be applied to the latest version of a model.
127
- description: `str` - text description/notes about the model - will be visible in the Model Card UI.
131
+ model_obj: any model object created with the following ML frameworks: PyTorch,
132
+ Keras, Tensorflow, Scikit-learn. name: `str` - name of the model artifact
133
+ that will be created to house this model_obj.
134
+ aliases: `str, List[str]` - optional alias(es) that will be applied on this
135
+ model and allow for unique identification. The alias "latest" will always be
136
+ applied to the latest version of a model.
137
+ description: `str` - text description/notes about the model - will be visible in
138
+ the Model Card UI.
128
139
  metadata: `Dict` - model-specific metadata goes here - will be visible the UI.
129
140
  project: `str` - project under which to place this artifact.
130
- scope_project: `bool` - If true, name of this model artifact will not be suffixed by `-{run_id}`.
141
+ scope_project: `bool` - If true, name of this model artifact will not be
142
+ suffixed by `-{run_id}`.
131
143
 
132
144
  Returns:
133
145
  _SavedModel instance
134
146
 
135
147
  Example:
148
+ ```python
136
149
  import torch.nn as nn
137
150
  import torch.nn.functional as F
138
151
 
152
+
139
153
  class Net(nn.Module):
140
154
  def __init__(self):
141
155
  super(Net, self).__init__()
@@ -146,8 +160,10 @@ def log_model(
146
160
  x = F.relu(x)
147
161
  return x
148
162
 
163
+
149
164
  model = Net()
150
165
  sm = log_model(model, "my-simple-model", aliases=["best"])
166
+ ```
151
167
 
152
168
  """
153
169
  model = data_types._SavedModel.init(model_obj, **kwargs)
@@ -169,21 +185,25 @@ def log_model(
169
185
 
170
186
 
171
187
  def use_model(aliased_path: str) -> "_SavedModel":
172
- """Allows the user to fetch their saved model with an alias.
173
- Under the hood, we use the alias to fetch the model artifact containing the serialized model files
174
- and rebuild the model object from these files. We also declare the fetched model artifact as an
175
- input to the run (with `run.use_artifact`).
188
+ """Fetch a saved model from an alias.
189
+
190
+ Under the hood, we use the alias to fetch the model artifact containing the
191
+ serialized model files and rebuild the model object from these files. We also
192
+ declare the fetched model artifact as an input to the run (with `run.use_artifact`).
176
193
 
177
194
  Args:
178
- aliased_path: `str` - the following forms are valid: "name:version", "name:alias". May be prefixed with "entity/project".
195
+ aliased_path: `str` - the following forms are valid: "name:version",
196
+ "name:alias". May be prefixed with "entity/project".
179
197
 
180
198
  Returns:
181
199
  _SavedModel instance
182
200
 
183
201
  Example:
184
- # assuming you have previously logged a model with the name "my-simple-model"
202
+ ```python
203
+ # Assuming you have previously logged a model with the name "my-simple-model":
185
204
  sm = use_model("my-simple-model:latest")
186
205
  model = sm.model_obj()
206
+ ```
187
207
  """
188
208
  if ":" not in aliased_path:
189
209
  raise ValueError(
@@ -213,15 +233,19 @@ def link_model(
213
233
  target_path: str,
214
234
  aliases: Optional[Union[str, List[str]]] = None,
215
235
  ) -> None:
216
- """Links the given model to a portfolio (a promoted collection which contains, in this case, model artifacts).
236
+ """Link the given model to a portfolio.
237
+
238
+ A portfolio is a promoted collection which contains (in this case) model artifacts.
217
239
  Linking to a portfolio allows for useful model-centric workflows in the UI.
218
240
 
219
241
  Args:
220
- model: `_SavedModel` - an instance of _SavedModel, most likely from the output of `log_model` or `use_model`.
221
- target_path: `str` - the target portfolio. The following forms are valid for the string: {portfolio}, {project/portfolio},
222
- {entity}/{project}/{portfolio}.
223
- aliases: `str, List[str]` - optional alias(es) that will only be applied on this linked model inside the portfolio.
224
- The alias "latest" will always be applied to the latest version of a model.
242
+ model: `_SavedModel` - an instance of _SavedModel, most likely from the output
243
+ of `log_model` or `use_model`.
244
+ target_path: `str` - the target portfolio. The following forms are valid for the
245
+ string: {portfolio}, {project/portfolio},{entity}/{project}/{portfolio}.
246
+ aliases: `str, List[str]` - optional alias(es) that will only be applied on this
247
+ linked model inside the portfolio. The alias "latest" will always be applied
248
+ to the latest version of a model.
225
249
 
226
250
  Returns:
227
251
  None
@@ -231,7 +255,6 @@ def link_model(
231
255
  link_model(sm, "my-portfolio")
232
256
 
233
257
  """
234
-
235
258
  aliases = wandb.util._resolve_aliases(aliases)
236
259
 
237
260
  if wandb.run:
@@ -1,5 +1,4 @@
1
- """
2
- Compatibility catboost module.
1
+ """Compatibility catboost module.
3
2
 
4
3
  In the future use:
5
4
  from wandb.integration.catboost import WandbCallback