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
wandb/sdk/lib/retry.py CHANGED
@@ -12,9 +12,10 @@ from typing import Any, Awaitable, Callable, Generic, Optional, Tuple, Type, Typ
12
12
  from requests import HTTPError
13
13
 
14
14
  import wandb
15
- from wandb.errors import ContextCancelledError
16
15
  from wandb.util import CheckRetryFnType
17
16
 
17
+ from .mailbox import ContextCancelledError
18
+
18
19
  logger = logging.getLogger(__name__)
19
20
 
20
21
 
@@ -26,7 +27,7 @@ SLEEP_ASYNC_FN = asyncio.sleep
26
27
 
27
28
 
28
29
  class TransientError(Exception):
29
- """Exception type designated for errors that may only be temporary
30
+ """Exception type designated for errors that may only be temporary.
30
31
 
31
32
  Can have its own message and/or wrap another exception.
32
33
  """
@@ -43,7 +44,7 @@ _R = TypeVar("_R")
43
44
 
44
45
 
45
46
  class Retry(Generic[_R]):
46
- """Creates a retryable version of a function.
47
+ """Create a retryable version of a function.
47
48
 
48
49
  Calling this will call the passed function, retrying if any exceptions in
49
50
  retryable_exceptions are caught, with exponential backoff.
@@ -98,7 +99,6 @@ class Retry(Generic[_R]):
98
99
  sleep_base (kwarg): amount of time to sleep upon first failure, all other sleeps
99
100
  are derived from this one.
100
101
  """
101
-
102
102
  retry_timedelta = kwargs.pop("retry_timedelta", self._retry_timedelta)
103
103
  if retry_timedelta is None:
104
104
  retry_timedelta = datetime.timedelta(days=365)
@@ -279,7 +279,6 @@ async def retry_async(
279
279
 
280
280
  Each time `fn` fails, `on_exc` is called with the exception.
281
281
  """
282
-
283
282
  while True:
284
283
  try:
285
284
  return await fn(*args, **kwargs)
wandb/sdk/lib/runid.py CHANGED
@@ -1,6 +1,4 @@
1
- """
2
- runid util.
3
- """
1
+ """runid util."""
4
2
 
5
3
  import secrets
6
4
  import string
wandb/sdk/lib/server.py CHANGED
@@ -1,26 +1,32 @@
1
- """
2
- module server
3
- """
1
+ """module server."""
4
2
 
5
3
  import json
4
+ from typing import TYPE_CHECKING, Any, Dict, Optional, Union
6
5
 
7
6
  from wandb import util
8
7
  from wandb.apis import InternalApi
9
8
 
9
+ if TYPE_CHECKING:
10
+ from wandb.sdk.wandb_settings import Settings
11
+
10
12
 
11
13
  class ServerError(Exception):
12
14
  pass
13
15
 
14
16
 
15
17
  class Server:
16
- def __init__(self, api=None, settings=None):
18
+ def __init__(
19
+ self,
20
+ api: Optional[InternalApi] = None,
21
+ settings: Optional["Settings"] = None,
22
+ ) -> None:
17
23
  self._api = api or InternalApi(default_settings=settings)
18
- self._error_network = None
19
- self._viewer = {}
20
- self._flags = {}
24
+ self._error_network: Optional[bool] = None
25
+ self._viewer: Dict[str, Any] = {}
26
+ self._flags: Dict[str, Any] = {}
21
27
  self._settings = settings
22
28
 
23
- def query_with_timeout(self, timeout=None):
29
+ def query_with_timeout(self, timeout: Union[int, float, None] = None) -> None:
24
30
  if self._settings and self._settings._disable_viewer:
25
31
  return
26
32
  timeout = timeout or 5
@@ -40,7 +46,7 @@ class Server:
40
46
  self._viewer, self._serverinfo = viewer_tuple
41
47
  self._flags = json.loads(self._viewer.get("flags", "{}"))
42
48
 
43
- def is_valid(self):
49
+ def is_valid(self) -> bool:
44
50
  if self._error_network is None:
45
51
  raise Exception("invalid usage: must query server")
46
52
  return self._error_network
@@ -14,7 +14,7 @@ if TYPE_CHECKING:
14
14
 
15
15
 
16
16
  class SockClientClosedError(Exception):
17
- """Socket has been closed"""
17
+ """Socket has been closed."""
18
18
 
19
19
  pass
20
20
 
@@ -13,7 +13,7 @@ def isfinite(f):
13
13
 
14
14
 
15
15
  def sparkify(series: List[Union[float, int]]) -> str:
16
- """Converts <series> to a sparkline string.
16
+ """Convert <series> to a sparkline string.
17
17
 
18
18
  Example:
19
19
  >>> sparkify([ 0.5, 1.2, 3.5, 7.3, 8.0, 12.5, 13.2, 15.0, 14.2, 11.8, 6.1,
wandb/sdk/lib/wburls.py CHANGED
@@ -27,7 +27,7 @@ class WBURLs:
27
27
  cli_launch="https://wandb.me/launch",
28
28
  doc_run="https://wandb.me/run",
29
29
  doc_require="https://wandb.me/library-require",
30
- doc_start_err="https://docs.wandb.ai/library/init#init-start-error",
30
+ doc_start_err="https://docs.wandb.ai/guides/track/tracking-faq#initstarterror-error-communicating-with-wandb-process-",
31
31
  doc_artifacts_guide="https://docs.wandb.ai/guides/artifacts",
32
32
  upgrade_server="https://wandb.me/server-upgrade",
33
33
  multiprocess="http://wandb.me/init-multiprocess",
@@ -1,5 +1,4 @@
1
- """port_file: write/read file containing port info.
2
- """
1
+ """port_file: write/read file containing port info."""
3
2
 
4
3
  import os
5
4
  import tempfile
@@ -12,12 +12,9 @@ import tempfile
12
12
  import time
13
13
  from typing import TYPE_CHECKING, Any, Dict, Optional
14
14
 
15
- from ...errors import (
16
- ServiceStartPortError,
17
- ServiceStartProcessError,
18
- ServiceStartTimeoutError,
19
- )
20
- from ...util import sentry_reraise, sentry_set_scope
15
+ from wandb.errors import Error
16
+ from wandb.util import sentry_reraise, sentry_set_scope
17
+
21
18
  from . import _startup_debug, port_file
22
19
  from .service_base import ServiceInterface
23
20
  from .service_sock import ServiceSockInterface
@@ -26,6 +23,24 @@ if TYPE_CHECKING:
26
23
  from wandb.sdk.wandb_settings import Settings
27
24
 
28
25
 
26
+ class ServiceStartProcessError(Error):
27
+ """Raised when a known error occurs when launching wandb service."""
28
+
29
+ pass
30
+
31
+
32
+ class ServiceStartTimeoutError(Error):
33
+ """Raised when service start times out."""
34
+
35
+ pass
36
+
37
+
38
+ class ServiceStartPortError(Error):
39
+ """Raised when service start fails to find a port."""
40
+
41
+ pass
42
+
43
+
29
44
  class _Service:
30
45
  _settings: "Settings"
31
46
  _grpc_port: Optional[int]
@@ -69,8 +84,7 @@ class _Service:
69
84
  def _wait_for_ports(
70
85
  self, fname: str, proc: Optional[subprocess.Popen] = None
71
86
  ) -> None:
72
- """
73
- Wait for the service to write the port file and then read it.
87
+ """Wait for the service to write the port file and then read it.
74
88
 
75
89
  Args:
76
90
  fname: The path to the port file.
@@ -87,14 +101,24 @@ class _Service:
87
101
  if proc and proc.poll():
88
102
  # process finished
89
103
  # define these variables for sentry context grab:
90
- command = proc.args # noqa: F841
91
- sys_executable = sys.executable # noqa: F841
92
- which_python = shutil.which("python3") # noqa: F841
104
+ # command = proc.args
105
+ # sys_executable = sys.executable
106
+ # which_python = shutil.which("python3")
107
+ # proc_out = proc.stdout.read()
108
+ # proc_err = proc.stderr.read()
109
+ context = dict(
110
+ command=proc.args,
111
+ sys_executable=sys.executable,
112
+ which_python=shutil.which("python3"),
113
+ proc_out=proc.stdout.read() if proc.stdout else "",
114
+ proc_err=proc.stderr.read() if proc.stderr else "",
115
+ )
93
116
  raise ServiceStartProcessError(
94
117
  f"The wandb service process exited with {proc.returncode}. "
95
118
  "Ensure that `sys.executable` is a valid python interpreter. "
96
119
  "You can override it with the `_executable` setting "
97
- "or with the `WANDB__EXECUTABLE` environment variable."
120
+ "or with the `WANDB__EXECUTABLE` environment variable.",
121
+ context=context,
98
122
  )
99
123
  if not os.path.isfile(fname):
100
124
  time.sleep(0.2)
@@ -122,7 +146,6 @@ class _Service:
122
146
 
123
147
  def _launch_server(self) -> None:
124
148
  """Launch server and set ports."""
125
-
126
149
  # References for starting processes
127
150
  # - https://github.com/wandb/wandb/blob/archive/old-cli/wandb/__init__.py
128
151
  # - https://stackoverflow.com/questions/1196074/how-to-start-a-background-process-in-python
@@ -38,7 +38,18 @@ def _pbmap_apply_dict(
38
38
  elif isinstance(v, str):
39
39
  sv.string_value = v
40
40
  elif isinstance(v, Iterable) and not isinstance(v, (str, bytes, Mapping)):
41
- sv.tuple_value.string_values.extend(v)
41
+ if all(isinstance(x, str) for x in v): # Iterable[str]
42
+ sv.tuple_value.string_values.extend(v)
43
+ elif isinstance(v, Mapping):
44
+ for kk, vv in v.items():
45
+ if isinstance(vv, str):
46
+ # flat map
47
+ sv.map_value.map_values[kk] = vv
48
+ elif isinstance(vv, Mapping):
49
+ # nested map
50
+ for kkk, vvv in vv.items():
51
+ sv.nested_map_value.nested_map_values[kk].map_values[kkk] = vvv
52
+
42
53
  elif isinstance(v, datetime.datetime):
43
54
  sv.timestamp_value = datetime.datetime.strftime(v, "%Y%m%d_%H%M%S")
44
55
  else:
@@ -1,10 +1,9 @@
1
- """
2
- Utilities for wandb verify
3
- """
1
+ """Utilities for wandb verify."""
4
2
  import getpass
5
3
  import os
6
4
  import time
7
5
  from functools import partial
6
+ from pathlib import Path
8
7
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
9
8
 
10
9
  import click
@@ -253,11 +252,11 @@ def artifact_with_path_or_paths(
253
252
  with open(f"{verify_dir}/verify_1.txt", "w") as f:
254
253
  f.write("1")
255
254
  art.add_dir(verify_dir)
256
- with open("verify_3.txt", "w") as f:
257
- f.write("3")
255
+ file3 = Path(verify_dir) / "verify_3.txt"
256
+ file3.write_text("3")
258
257
 
259
258
  # reference to local file
260
- art.add_reference("file://verify_3.txt")
259
+ art.add_reference(file3.resolve().as_uri())
261
260
 
262
261
  return art
263
262
 
@@ -276,7 +275,6 @@ def log_use_download_artifact(
276
275
  project=PROJECT_NAME,
277
276
  config={"test": "artifact log"},
278
277
  ) as log_art_run:
279
-
280
278
  if add_extra_file:
281
279
  with open("verify_2.txt", "w") as f:
282
280
  f.write("2")