wandb 0.17.5__py3-none-win_amd64.whl → 0.17.7__py3-none-win_amd64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. wandb/__init__.py +5 -16
  2. wandb/agents/pyagent.py +1 -2
  3. wandb/apis/public/api.py +1 -1
  4. wandb/apis/public/jobs.py +5 -0
  5. wandb/bin/wandb-core +0 -0
  6. wandb/cli/cli.py +21 -0
  7. wandb/data_types.py +5 -4
  8. wandb/env.py +6 -0
  9. wandb/integration/kfp/wandb_logging.py +1 -1
  10. wandb/integration/lightning/fabric/logger.py +5 -5
  11. wandb/integration/openai/fine_tuning.py +13 -5
  12. wandb/integration/ultralytics/pose_utils.py +0 -1
  13. wandb/proto/v3/wandb_internal_pb2.py +226 -226
  14. wandb/proto/v3/wandb_settings_pb2.py +1 -1
  15. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  16. wandb/proto/v4/wandb_internal_pb2.py +226 -226
  17. wandb/proto/v4/wandb_settings_pb2.py +1 -1
  18. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  19. wandb/proto/v5/wandb_internal_pb2.py +226 -226
  20. wandb/proto/v5/wandb_settings_pb2.py +1 -1
  21. wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
  22. wandb/proto/wandb_deprecated.py +4 -0
  23. wandb/proto/wandb_internal_pb2.py +6 -0
  24. wandb/sdk/artifacts/artifact.py +6 -1
  25. wandb/sdk/artifacts/artifact_manifest_entry.py +31 -0
  26. wandb/sdk/artifacts/storage_handlers/azure_handler.py +35 -23
  27. wandb/sdk/data_types/_dtypes.py +5 -5
  28. wandb/sdk/data_types/base_types/media.py +3 -1
  29. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +3 -1
  30. wandb/sdk/data_types/helper_types/image_mask.py +3 -1
  31. wandb/sdk/data_types/image.py +3 -1
  32. wandb/sdk/data_types/object_3d.py +113 -2
  33. wandb/sdk/data_types/saved_model.py +3 -1
  34. wandb/sdk/interface/interface.py +40 -16
  35. wandb/sdk/interface/interface_shared.py +6 -9
  36. wandb/sdk/internal/datastore.py +1 -1
  37. wandb/sdk/internal/handler.py +0 -2
  38. wandb/sdk/internal/internal.py +1 -1
  39. wandb/sdk/internal/job_builder.py +5 -2
  40. wandb/sdk/internal/sender.py +31 -15
  41. wandb/sdk/internal/tb_watcher.py +2 -2
  42. wandb/sdk/internal/update.py +2 -2
  43. wandb/sdk/launch/_launch.py +4 -2
  44. wandb/sdk/launch/_project_spec.py +34 -8
  45. wandb/sdk/launch/agent/agent.py +6 -2
  46. wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -4
  47. wandb/sdk/launch/builder/build.py +4 -2
  48. wandb/sdk/launch/builder/kaniko_builder.py +13 -5
  49. wandb/sdk/launch/builder/templates/_wandb_bootstrap.py +2 -1
  50. wandb/sdk/launch/create_job.py +2 -0
  51. wandb/sdk/launch/inputs/internal.py +42 -28
  52. wandb/sdk/launch/inputs/schema.py +39 -0
  53. wandb/sdk/launch/runner/kubernetes_runner.py +72 -0
  54. wandb/sdk/launch/runner/local_container.py +13 -10
  55. wandb/sdk/launch/runner/sagemaker_runner.py +3 -5
  56. wandb/sdk/launch/utils.py +2 -0
  57. wandb/sdk/lib/apikey.py +1 -1
  58. wandb/sdk/lib/disabled.py +13 -174
  59. wandb/sdk/service/streams.py +2 -4
  60. wandb/sdk/wandb_config.py +1 -1
  61. wandb/sdk/wandb_init.py +77 -33
  62. wandb/sdk/wandb_login.py +6 -6
  63. wandb/sdk/wandb_run.py +150 -90
  64. wandb/sdk/wandb_settings.py +4 -3
  65. wandb/sdk/wandb_setup.py +66 -3
  66. wandb/sdk/wandb_sweep.py +5 -2
  67. wandb/wandb_agent.py +2 -0
  68. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/METADATA +3 -2
  69. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/RECORD +72 -71
  70. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/WHEEL +0 -0
  71. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/entry_points.txt +0 -0
  72. {wandb-0.17.5.dist-info → wandb-0.17.7.dist-info}/licenses/LICENSE +0 -0
wandb/__init__.py CHANGED
@@ -1,9 +1,6 @@
1
1
  """Use wandb to track machine learning work.
2
2
 
3
- The most commonly used functions/objects are:
4
- - wandb.init — initialize a new run at the top of your training script
5
- - wandb.config — track hyperparameters and metadata
6
- - wandb.log — log metrics and media over time within your training loop
3
+ Train and fine-tune models, manage models from experimentation to production.
7
4
 
8
5
  For guides and examples, see https://docs.wandb.ai.
9
6
 
@@ -11,11 +8,7 @@ For scripts and interactive notebooks, see https://github.com/wandb/examples.
11
8
 
12
9
  For reference documentation, see https://docs.wandb.com/ref/python.
13
10
  """
14
- __version__ = "0.17.5"
15
-
16
-
17
- # Used with pypi checks and other messages related to pip
18
- _wandb_module = "wandb"
11
+ __version__ = "0.17.7"
19
12
 
20
13
  from typing import Optional
21
14
 
@@ -74,6 +67,7 @@ from wandb.data_types import Video
74
67
  from wandb.data_types import Audio
75
68
  from wandb.data_types import Table
76
69
  from wandb.data_types import Html
70
+ from wandb.data_types import box3d
77
71
  from wandb.data_types import Object3D
78
72
  from wandb.data_types import Molecule
79
73
  from wandb.data_types import Histogram
@@ -117,13 +111,6 @@ def _assert_is_user_process():
117
111
  assert not _IS_INTERNAL_PROCESS
118
112
 
119
113
 
120
- # toplevel:
121
- # save()
122
- # restore()
123
- # login()
124
- # sweep()
125
- # agent()
126
-
127
114
  # globals
128
115
  Api = PublicApi
129
116
  api = InternalApi()
@@ -245,6 +232,7 @@ __all__ = (
245
232
  "Audio",
246
233
  "Table",
247
234
  "Html",
235
+ "box3d",
248
236
  "Object3D",
249
237
  "Molecule",
250
238
  "Histogram",
@@ -252,4 +240,5 @@ __all__ = (
252
240
  "log_model",
253
241
  "use_model",
254
242
  "link_model",
243
+ "define_metric",
255
244
  )
wandb/agents/pyagent.py CHANGED
@@ -14,7 +14,6 @@ import time
14
14
  import traceback
15
15
 
16
16
  import wandb
17
- from wandb import wandb_sdk
18
17
  from wandb.apis import InternalApi
19
18
  from wandb.sdk.launch.sweeps import utils as sweep_utils
20
19
 
@@ -298,7 +297,7 @@ class Agent:
298
297
  sweep_param_path, job.config
299
298
  )
300
299
  os.environ[wandb.env.SWEEP_ID] = self._sweep_id
301
- wandb_sdk.wandb_setup._setup(_reset=True)
300
+ wandb.sdk.wandb_setup._setup(_reset=True)
302
301
 
303
302
  wandb.termlog(f"Agent Starting Run: {run_id} with config:")
304
303
  for k, v in job.config.items():
wandb/apis/public/api.py CHANGED
@@ -821,7 +821,7 @@ class Api:
821
821
  order: (str) Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`.
822
822
  If you prepend order with a + order is ascending.
823
823
  If you prepend order with a - order is descending (default).
824
- The default order is run.created_at from newest to oldest.
824
+ The default order is run.created_at from oldest to newest.
825
825
  per_page: (int) Sets the page size for query pagination.
826
826
  include_sweeps: (bool) Whether to include the sweep runs in the results.
827
827
 
wandb/apis/public/jobs.py CHANGED
@@ -65,6 +65,7 @@ class Job:
65
65
  self._entrypoint = source_info.get("entrypoint")
66
66
  self._dockerfile = source_info.get("dockerfile")
67
67
  self._build_context = source_info.get("build_context")
68
+ self._base_image = source_info.get("base_image")
68
69
  self._args = source_info.get("args")
69
70
  self._partial = self._job_info.get("_partial", False)
70
71
  self._requirements_file = os.path.join(self._fpath, "requirements.frozen.txt")
@@ -131,6 +132,8 @@ class Job:
131
132
  launch_project.set_job_dockerfile(self._dockerfile)
132
133
  if self._build_context:
133
134
  launch_project.set_job_build_context(self._build_context)
135
+ if self._base_image:
136
+ launch_project.set_job_base_image(self._base_image)
134
137
 
135
138
  def _configure_launch_project_artifact(self, launch_project):
136
139
  artifact_string = self._job_info.get("source", {}).get("artifact")
@@ -152,6 +155,8 @@ class Job:
152
155
  launch_project.set_job_dockerfile(self._dockerfile)
153
156
  if self._build_context:
154
157
  launch_project.set_job_build_context(self._build_context)
158
+ if self._base_image:
159
+ launch_project.set_job_base_image(self._base_image)
155
160
 
156
161
  def _configure_launch_project_container(self, launch_project):
157
162
  launch_project.docker_image = self._job_info.get("source", {}).get("image")
wandb/bin/wandb-core CHANGED
Binary file
wandb/cli/cli.py CHANGED
@@ -1417,6 +1417,13 @@ def launch_sweep(
1417
1417
  help="""Specific docker image you'd like to use. In the form name:tag.
1418
1418
  If passed in, will override the docker image value passed in using a config file.""",
1419
1419
  )
1420
+ @click.option(
1421
+ "--base-image",
1422
+ "-B",
1423
+ default=None,
1424
+ metavar="BASE IMAGE",
1425
+ help="""Docker image to run job code in. Incompatible with --docker-image.""",
1426
+ )
1420
1427
  @click.option(
1421
1428
  "--config",
1422
1429
  "-c",
@@ -1508,6 +1515,7 @@ def launch(
1508
1515
  entity,
1509
1516
  project,
1510
1517
  docker_image,
1518
+ base_image,
1511
1519
  config,
1512
1520
  cli_template_vars,
1513
1521
  queue,
@@ -1604,6 +1612,7 @@ def launch(
1604
1612
  git_hash=git_version,
1605
1613
  name=job_name,
1606
1614
  project=project,
1615
+ base_image=base_image,
1607
1616
  build_context=build_context,
1608
1617
  dockerfile=dockerfile,
1609
1618
  entity=entity,
@@ -2001,6 +2010,12 @@ def describe(job):
2001
2010
  help="Path to the build context from the root of the job source code. If "
2002
2011
  "provided, this is used as the base path for the Dockerfile and entrypoint.",
2003
2012
  )
2013
+ @click.option(
2014
+ "--base-image",
2015
+ "-B",
2016
+ type=str,
2017
+ help="Base image to use for the job. Incompatible with image jobs.",
2018
+ )
2004
2019
  @click.option(
2005
2020
  "--dockerfile",
2006
2021
  "-D",
@@ -2025,6 +2040,7 @@ def create(
2025
2040
  git_hash,
2026
2041
  runtime,
2027
2042
  build_context,
2043
+ base_image,
2028
2044
  dockerfile,
2029
2045
  ):
2030
2046
  """Create a job from a source, without a wandb run.
@@ -2056,6 +2072,10 @@ def create(
2056
2072
  )
2057
2073
  entrypoint = "main.py"
2058
2074
 
2075
+ if job_type == "image" and base_image:
2076
+ wandb.termerror("Cannot provide --base-image/-B for an `image` job")
2077
+ return
2078
+
2059
2079
  artifact, action, aliases = _create_job(
2060
2080
  api=api,
2061
2081
  path=path,
@@ -2069,6 +2089,7 @@ def create(
2069
2089
  git_hash=git_hash,
2070
2090
  runtime=runtime,
2071
2091
  build_context=build_context,
2092
+ base_image=base_image,
2072
2093
  dockerfile=dockerfile,
2073
2094
  )
2074
2095
  if not artifact:
wandb/data_types.py CHANGED
@@ -44,7 +44,7 @@ from .sdk.data_types.histogram import Histogram
44
44
  from .sdk.data_types.html import Html
45
45
  from .sdk.data_types.image import Image
46
46
  from .sdk.data_types.molecule import Molecule
47
- from .sdk.data_types.object_3d import Object3D
47
+ from .sdk.data_types.object_3d import Object3D, box3d
48
48
  from .sdk.data_types.plotly import Plotly
49
49
  from .sdk.data_types.saved_model import _SavedModel
50
50
  from .sdk.data_types.trace_tree import WBTraceTree
@@ -65,6 +65,7 @@ __all__ = [
65
65
  "Html",
66
66
  "Image",
67
67
  "Molecule",
68
+ "box3d",
68
69
  "Object3D",
69
70
  "Plotly",
70
71
  "Video",
@@ -103,7 +104,7 @@ class _TableIndex(int, _TableLinkMixin):
103
104
  def _json_helper(val, artifact):
104
105
  if isinstance(val, WBValue):
105
106
  return val.to_json(artifact)
106
- elif val.__class__ == dict:
107
+ elif val.__class__ is dict:
107
108
  res = {}
108
109
  for key in val:
109
110
  res[key] = _json_helper(val[key], artifact)
@@ -269,10 +270,10 @@ class Table(Media):
269
270
  if dtype is None:
270
271
  dtype = _dtypes.UnknownType()
271
272
 
272
- if optional.__class__ != list:
273
+ if optional.__class__ is not list:
273
274
  optional = [optional for _ in range(len(self.columns))]
274
275
 
275
- if dtype.__class__ != list:
276
+ if dtype.__class__ is not list:
276
277
  dtype = [dtype for _ in range(len(self.columns))]
277
278
 
278
279
  self._column_types = _dtypes.TypedDictType({})
wandb/env.py CHANGED
@@ -161,6 +161,12 @@ def is_debug(default: Optional[str] = None, env: Optional[Env] = None) -> bool:
161
161
  return _env_as_bool(DEBUG, default=default, env=env)
162
162
 
163
163
 
164
+ def is_offline(env: Optional[Env] = None) -> bool:
165
+ if env is None:
166
+ env = os.environ
167
+ return env.get(MODE) == "offline"
168
+
169
+
164
170
  def error_reporting_enabled() -> bool:
165
171
  return _env_as_bool(ERROR_REPORTING, default="True")
166
172
 
@@ -30,7 +30,7 @@ def wandb_log( # noqa: C901
30
30
  def isinstance_namedtuple(x):
31
31
  t = type(x)
32
32
  b = t.__bases__
33
- if len(b) != 1 or b[0] != tuple:
33
+ if len(b) != 1 or b[0] is not tuple:
34
34
  return False
35
35
  f = getattr(t, "_fields", None)
36
36
  if not isinstance(f, tuple):
@@ -8,7 +8,7 @@ from typing_extensions import override
8
8
 
9
9
  import wandb
10
10
  from wandb import Artifact
11
- from wandb.sdk.lib import RunDisabled, telemetry
11
+ from wandb.sdk.lib import telemetry
12
12
  from wandb.sdk.wandb_run import Run
13
13
 
14
14
  try:
@@ -293,7 +293,7 @@ class WandbLogger(Logger):
293
293
  anonymous: Optional[bool] = None,
294
294
  project: Optional[str] = None,
295
295
  log_model: Union[Literal["all"], bool] = False,
296
- experiment: Union["Run", "RunDisabled", None] = None,
296
+ experiment: Optional["Run"] = None,
297
297
  prefix: str = "",
298
298
  checkpoint_name: Optional[str] = None,
299
299
  log_checkpoint_on: Union[Literal["success"], Literal["all"]] = "success",
@@ -312,7 +312,7 @@ class WandbLogger(Logger):
312
312
  self._prefix = prefix
313
313
  self._experiment = experiment
314
314
  self._logged_model_time: Dict[str, float] = {}
315
- self._checkpoint_callback: Optional["ModelCheckpoint"] = None
315
+ self._checkpoint_callback: Optional[ModelCheckpoint] = None
316
316
 
317
317
  # paths are processed as strings
318
318
  if save_dir is not None:
@@ -360,7 +360,7 @@ class WandbLogger(Logger):
360
360
 
361
361
  @property
362
362
  @rank_zero_experiment
363
- def experiment(self) -> Union["Run", "RunDisabled"]:
363
+ def experiment(self) -> "Run":
364
364
  r"""Actual wandb object.
365
365
 
366
366
  To use wandb features in your :class:`~lightning.pytorch.core.LightningModule`, do the
@@ -393,7 +393,7 @@ class WandbLogger(Logger):
393
393
  self._experiment = wandb.init(**self._wandb_init)
394
394
 
395
395
  # define default x-axis
396
- if isinstance(self._experiment, (Run, RunDisabled)) and getattr(
396
+ if isinstance(self._experiment, Run) and getattr(
397
397
  self._experiment, "define_metric", None
398
398
  ):
399
399
  self._experiment.define_metric("trainer/global_step")
@@ -1,3 +1,4 @@
1
+ import base64
1
2
  import datetime
2
3
  import io
3
4
  import json
@@ -16,13 +17,13 @@ from wandb.util import parse_version
16
17
 
17
18
  openai = util.get_module(
18
19
  name="openai",
19
- required="`openai` not installed. This integration requires `openai`. To fix, please `pip install openai`",
20
- lazy="False",
20
+ required="This integration requires `openai`. To install, please run `pip install openai`",
21
+ lazy=False,
21
22
  )
22
23
 
23
- if parse_version(openai.__version__) < parse_version("1.0.1"):
24
+ if parse_version(openai.__version__) < parse_version("1.12.0"):
24
25
  raise wandb.Error(
25
- f"This integration requires openai version 1.0.1 and above. Your current version is {openai.__version__} "
26
+ f"This integration requires openai version 1.12.0 and above. Your current version is {openai.__version__} "
26
27
  "To fix, please `pip install -U openai`"
27
28
  )
28
29
 
@@ -228,7 +229,14 @@ class WandbLogger:
228
229
  # check results are present
229
230
  try:
230
231
  results_id = fine_tune.result_files[0]
231
- results = cls.openai_client.files.content(file_id=results_id).text
232
+ try:
233
+ encoded_results = cls.openai_client.files.content(
234
+ file_id=results_id
235
+ ).read()
236
+ results = base64.b64decode(encoded_results).decode("utf-8")
237
+ except Exception:
238
+ # attempt to read as text, works for older jobs
239
+ results = cls.openai_client.files.content(file_id=results_id).text
232
240
  except openai.NotFoundError:
233
241
  if show_individual_warnings:
234
242
  wandb.termwarn(
@@ -23,7 +23,6 @@ def annotate_keypoint_results(result: Results, visualize_skeleton: bool):
23
23
 
24
24
 
25
25
  def annotate_keypoint_batch(image_path: str, keypoints: Any, visualize_skeleton: bool):
26
- original_image = None
27
26
  with Image.open(image_path) as original_image:
28
27
  original_image = np.ascontiguousarray(original_image)
29
28
  annotator = Annotator(original_image)