wandb 0.16.4__py3-none-any.whl → 0.16.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. wandb/__init__.py +2 -2
  2. wandb/agents/pyagent.py +1 -1
  3. wandb/apis/public/api.py +6 -6
  4. wandb/apis/reports/v2/interface.py +4 -8
  5. wandb/apis/reports/v2/internal.py +12 -45
  6. wandb/cli/cli.py +24 -3
  7. wandb/integration/ultralytics/callback.py +0 -1
  8. wandb/proto/v3/wandb_internal_pb2.py +332 -312
  9. wandb/proto/v3/wandb_settings_pb2.py +13 -3
  10. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  11. wandb/proto/v4/wandb_internal_pb2.py +316 -312
  12. wandb/proto/v4/wandb_settings_pb2.py +5 -3
  13. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  14. wandb/sdk/artifacts/artifact.py +67 -17
  15. wandb/sdk/artifacts/artifact_manifest_entry.py +6 -1
  16. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +1 -0
  17. wandb/sdk/artifacts/artifact_saver.py +1 -18
  18. wandb/sdk/artifacts/storage_handler.py +2 -1
  19. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +13 -5
  20. wandb/sdk/interface/interface.py +42 -9
  21. wandb/sdk/interface/interface_shared.py +13 -7
  22. wandb/sdk/internal/file_stream.py +19 -0
  23. wandb/sdk/internal/handler.py +1 -4
  24. wandb/sdk/internal/internal_api.py +2 -0
  25. wandb/sdk/internal/job_builder.py +45 -17
  26. wandb/sdk/internal/sender.py +53 -28
  27. wandb/sdk/internal/settings_static.py +9 -0
  28. wandb/sdk/internal/system/system_info.py +4 -1
  29. wandb/sdk/launch/create_job.py +1 -0
  30. wandb/sdk/launch/runner/kubernetes_runner.py +20 -2
  31. wandb/sdk/launch/utils.py +5 -5
  32. wandb/sdk/lib/__init__.py +2 -5
  33. wandb/sdk/lib/_settings_toposort_generated.py +1 -0
  34. wandb/sdk/lib/filesystem.py +11 -1
  35. wandb/sdk/lib/run_moment.py +72 -0
  36. wandb/sdk/service/streams.py +1 -6
  37. wandb/sdk/wandb_init.py +12 -1
  38. wandb/sdk/wandb_login.py +43 -26
  39. wandb/sdk/wandb_run.py +158 -89
  40. wandb/sdk/wandb_settings.py +53 -16
  41. wandb/testing/relay.py +5 -6
  42. {wandb-0.16.4.dist-info → wandb-0.16.5.dist-info}/METADATA +1 -1
  43. {wandb-0.16.4.dist-info → wandb-0.16.5.dist-info}/RECORD +47 -46
  44. {wandb-0.16.4.dist-info → wandb-0.16.5.dist-info}/WHEEL +1 -1
  45. {wandb-0.16.4.dist-info → wandb-0.16.5.dist-info}/LICENSE +0 -0
  46. {wandb-0.16.4.dist-info → wandb-0.16.5.dist-info}/entry_points.txt +0 -0
  47. {wandb-0.16.4.dist-info → wandb-0.16.5.dist-info}/top_level.txt +0 -0
wandb/__init__.py CHANGED
@@ -11,8 +11,8 @@ For scripts and interactive notebooks, see https://github.com/wandb/examples.
11
11
 
12
12
  For reference documentation, see https://docs.wandb.com/ref/python.
13
13
  """
14
- __version__ = "0.16.4"
15
- _minimum_core_version = "0.17.0b9"
14
+ __version__ = "0.16.5"
15
+ _minimum_core_version = "0.17.0b10"
16
16
 
17
17
  # Used with pypi checks and other messages related to pip
18
18
  _wandb_module = "wandb"
wandb/agents/pyagent.py CHANGED
@@ -347,7 +347,7 @@ def pyagent(sweep_id, function, entity=None, project=None, count=None):
347
347
  count (int, optional): the number of trials to run.
348
348
  """
349
349
  if not callable(function):
350
- raise Exception("function paramter must be callable!")
350
+ raise Exception("function parameter must be callable!")
351
351
  agent = Agent(
352
352
  sweep_id,
353
353
  function=function,
wandb/apis/public/api.py CHANGED
@@ -313,15 +313,15 @@ class Api:
313
313
  entity: (str) Optional name of the entity to create the queue. If None, will use the configured or default entity.
314
314
  prioritization_mode: (str) Optional version of prioritization to use. Either "V0" or None
315
315
  config: (dict) Optional default resource configuration to be used for the queue. Use handlebars (eg. "{{var}}") to specify template variables.
316
- template_variables (dict): A dictionary of template variable schemas to be used with the config. Expected format of:
316
+ template_variables: (dict) A dictionary of template variable schemas to be used with the config. Expected format of:
317
317
  {
318
318
  "var-name": {
319
319
  "schema": {
320
- "type": "<string | number | integer>",
321
- "default": <optional value>,
322
- "minimum": <optional minimum>,
323
- "maximum": <optional maximum>,
324
- "enum": [..."<options>"]
320
+ "type": ("string", "number", or "integer"),
321
+ "default": (optional value),
322
+ "minimum": (optional minimum),
323
+ "maximum": (optional maximum),
324
+ "enum": [..."(options)"]
325
325
  }
326
326
  }
327
327
  }
@@ -4,6 +4,8 @@ from datetime import datetime
4
4
  from typing import Dict, Iterable, Optional, Tuple, Union
5
5
  from typing import List as LList
6
6
 
7
+ from annotated_types import Annotated, Ge, Le
8
+
7
9
  try:
8
10
  from typing import Literal
9
11
  except ImportError:
@@ -758,14 +760,8 @@ block_mapping = {
758
760
 
759
761
  @dataclass(config=dataclass_config)
760
762
  class GradientPoint(Base):
761
- color: str
762
- offset: float = Field(0, ge=0, le=100)
763
-
764
- @validator("color")
765
- def validate_color(cls, v): # noqa: N805
766
- if not internal.is_valid_color(v):
767
- raise ValueError("invalid color, value should be hex, rgb, or rgba")
768
- return v
763
+ color: Annotated[str, internal.ColorStrConstraints]
764
+ offset: Annotated[float, Ge(0), Le(100)] = 0
769
765
 
770
766
  def to_model(self):
771
767
  return internal.GradientPoint(color=self.color, offset=self.offset)
@@ -1,18 +1,19 @@
1
1
  """JSONSchema for internal types. Hopefully this is auto-generated one day!"""
2
2
  import json
3
3
  import random
4
- import re
5
4
  from copy import deepcopy
6
5
  from datetime import datetime
7
6
  from typing import Any, Dict, Optional, Tuple, Union
8
7
  from typing import List as LList
9
8
 
9
+ from annotated_types import Annotated, Ge, Le
10
+
10
11
  try:
11
12
  from typing import Literal
12
13
  except ImportError:
13
14
  from typing_extensions import Literal
14
15
 
15
- from pydantic import BaseModel, ConfigDict, Field, validator
16
+ from pydantic import BaseModel, ConfigDict, Field, StringConstraints, validator
16
17
  from pydantic.alias_generators import to_camel
17
18
 
18
19
 
@@ -48,6 +49,13 @@ def _generate_name(length: int = 12) -> str:
48
49
  return rand36.lower()[:length]
49
50
 
50
51
 
52
+ hex_pattern = r"^#(?:[0-9a-fA-F]{3}){1,2}$"
53
+ rgb_pattern = r"^rgb\(\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*\)$"
54
+ rgba_pattern = r"^rgba\(\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\s*,\s*(1|0|0?\.\d+)\s*\)$"
55
+ ColorStrConstraints = StringConstraints(
56
+ pattern=f"{hex_pattern}|{rgb_pattern}|{rgba_pattern}"
57
+ )
58
+
51
59
  LinePlotStyle = Literal["line", "stacked-area", "pct-area"]
52
60
  BarPlotStyle = Literal["bar", "boxplot", "violin"]
53
61
  FontSize = Literal["small", "medium", "large", "auto"]
@@ -609,14 +617,8 @@ class LinePlot(Panel):
609
617
 
610
618
 
611
619
  class GradientPoint(ReportAPIBaseModel):
612
- color: str
613
- offset: float = Field(0, ge=0, le=100)
614
-
615
- @validator("color")
616
- def validate_color(cls, v): # noqa: N805
617
- if not is_valid_color(v):
618
- raise ValueError("invalid color, value should be hex, rgb, or rgba")
619
- return v
620
+ color: Annotated[str, ColorStrConstraints]
621
+ offset: Annotated[float, Ge(0), Le(100)] = 0
620
622
 
621
623
 
622
624
  class ScatterPlotConfig(ReportAPIBaseModel):
@@ -866,38 +868,3 @@ block_type_mapping = {
866
868
  "table-of-contents": TableOfContents,
867
869
  "block-quote": BlockQuote,
868
870
  }
869
-
870
-
871
- def is_valid_color(color_str: str) -> bool:
872
- # Regular expression for hex color validation
873
- hex_color_pattern = r"^#(?:[0-9a-fA-F]{3}){1,2}$"
874
-
875
- # Check if it's a valid hex color
876
- if re.match(hex_color_pattern, color_str):
877
- return True
878
-
879
- # Try parsing it as an RGB or RGBA tuple
880
- try:
881
- # Strip 'rgb(' or 'rgba(' and the closing ')'
882
- if color_str.startswith("rgb(") and color_str.endswith(")"):
883
- parts = color_str[4:-1].split(",")
884
- elif color_str.startswith("rgba(") and color_str.endswith(")"):
885
- parts = color_str[5:-1].split(",")
886
- else:
887
- return False
888
-
889
- # Convert parts to integers and validate ranges
890
- parts = [int(p.strip()) for p in parts]
891
- if len(parts) == 3 and all(0 <= p <= 255 for p in parts):
892
- return True # Valid RGB
893
- if (
894
- len(parts) == 4
895
- and all(0 <= p <= 255 for p in parts[:-1])
896
- and 0 <= parts[-1] <= 1
897
- ):
898
- return True # Valid RGBA
899
-
900
- except ValueError:
901
- pass
902
-
903
- return False
wandb/cli/cli.py CHANGED
@@ -2345,8 +2345,29 @@ def artifact():
2345
2345
  default=None,
2346
2346
  help="Resume the last run from your current directory.",
2347
2347
  )
2348
+ @click.option(
2349
+ "--skip_cache",
2350
+ is_flag=True,
2351
+ default=False,
2352
+ help="Skip caching while uploading artifact files.",
2353
+ )
2354
+ @click.option(
2355
+ "--policy",
2356
+ default="mutable",
2357
+ help="Set the storage policy while uploading artifact files.",
2358
+ )
2348
2359
  @display_error
2349
- def put(path, name, description, type, alias, run_id, resume):
2360
+ def put(
2361
+ path,
2362
+ name,
2363
+ description,
2364
+ type,
2365
+ alias,
2366
+ run_id,
2367
+ resume,
2368
+ skip_cache,
2369
+ policy,
2370
+ ):
2350
2371
  if name is None:
2351
2372
  name = os.path.basename(path)
2352
2373
  public_api = PublicApi()
@@ -2361,10 +2382,10 @@ def put(path, name, description, type, alias, run_id, resume):
2361
2382
  artifact_path = f"{entity}/{project}/{artifact_name}:{alias[0]}"
2362
2383
  if os.path.isdir(path):
2363
2384
  wandb.termlog(f'Uploading directory {path} to: "{artifact_path}" ({type})')
2364
- artifact.add_dir(path)
2385
+ artifact.add_dir(path, skip_cache=skip_cache, policy=policy)
2365
2386
  elif os.path.isfile(path):
2366
2387
  wandb.termlog(f'Uploading file {path} to: "{artifact_path}" ({type})')
2367
- artifact.add_file(path)
2388
+ artifact.add_file(path, skip_cache=skip_cache, policy=policy)
2368
2389
  elif "://" in path:
2369
2390
  wandb.termlog(
2370
2391
  f'Logging reference artifact from {path} to: "{artifact_path}" ({type})'
@@ -321,7 +321,6 @@ class WandBUltralyticsCallback:
321
321
  )
322
322
  if self.enable_model_checkpointing:
323
323
  self._save_model(trainer)
324
- self.model.to("cpu")
325
324
  trainer.model.to(self.device)
326
325
 
327
326
  def on_train_end(self, trainer: TRAINER_TYPE):