wandb 0.18.0rc1__py3-none-any.whl → 0.18.2__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. wandb/__init__.py +4 -4
  2. wandb/__init__.pyi +67 -12
  3. wandb/apis/internal.py +3 -0
  4. wandb/apis/public/api.py +128 -2
  5. wandb/apis/public/artifacts.py +11 -7
  6. wandb/apis/public/jobs.py +8 -0
  7. wandb/apis/public/runs.py +18 -5
  8. wandb/bin/nvidia_gpu_stats +0 -0
  9. wandb/cli/cli.py +0 -5
  10. wandb/data_types.py +9 -2019
  11. wandb/env.py +0 -5
  12. wandb/errors/__init__.py +11 -40
  13. wandb/errors/errors.py +37 -0
  14. wandb/errors/warnings.py +2 -0
  15. wandb/{sklearn → integration/sklearn}/calculate/calibration_curves.py +7 -7
  16. wandb/{sklearn → integration/sklearn}/calculate/class_proportions.py +1 -1
  17. wandb/{sklearn → integration/sklearn}/calculate/confusion_matrix.py +3 -2
  18. wandb/{sklearn → integration/sklearn}/calculate/elbow_curve.py +6 -6
  19. wandb/{sklearn → integration/sklearn}/calculate/learning_curve.py +2 -2
  20. wandb/{sklearn → integration/sklearn}/calculate/outlier_candidates.py +2 -2
  21. wandb/{sklearn → integration/sklearn}/calculate/residuals.py +8 -8
  22. wandb/{sklearn → integration/sklearn}/calculate/silhouette.py +2 -2
  23. wandb/{sklearn → integration/sklearn}/calculate/summary_metrics.py +2 -2
  24. wandb/{sklearn → integration/sklearn}/plot/classifier.py +5 -5
  25. wandb/{sklearn → integration/sklearn}/plot/clusterer.py +10 -6
  26. wandb/{sklearn → integration/sklearn}/plot/regressor.py +5 -5
  27. wandb/{sklearn → integration/sklearn}/plot/shared.py +3 -3
  28. wandb/{sklearn → integration/sklearn}/utils.py +8 -8
  29. wandb/integration/tensorboard/log.py +1 -1
  30. wandb/{wandb_torch.py → integration/torch/wandb_torch.py} +36 -32
  31. wandb/old/core.py +2 -80
  32. wandb/plot/bar.py +7 -4
  33. wandb/plot/confusion_matrix.py +5 -4
  34. wandb/plot/histogram.py +7 -4
  35. wandb/plot/line.py +7 -4
  36. wandb/proto/v3/wandb_base_pb2.py +2 -1
  37. wandb/proto/v3/wandb_internal_pb2.py +2 -1
  38. wandb/proto/v3/wandb_server_pb2.py +2 -1
  39. wandb/proto/v3/wandb_settings_pb2.py +3 -2
  40. wandb/proto/v3/wandb_telemetry_pb2.py +2 -1
  41. wandb/proto/v4/wandb_base_pb2.py +2 -1
  42. wandb/proto/v4/wandb_internal_pb2.py +2 -1
  43. wandb/proto/v4/wandb_server_pb2.py +2 -1
  44. wandb/proto/v4/wandb_settings_pb2.py +3 -2
  45. wandb/proto/v4/wandb_telemetry_pb2.py +2 -1
  46. wandb/proto/v5/wandb_base_pb2.py +3 -2
  47. wandb/proto/v5/wandb_internal_pb2.py +3 -2
  48. wandb/proto/v5/wandb_server_pb2.py +3 -2
  49. wandb/proto/v5/wandb_settings_pb2.py +4 -3
  50. wandb/proto/v5/wandb_telemetry_pb2.py +3 -2
  51. wandb/sdk/artifacts/_validators.py +48 -3
  52. wandb/sdk/artifacts/artifact.py +157 -183
  53. wandb/sdk/artifacts/artifact_file_cache.py +13 -11
  54. wandb/sdk/artifacts/artifact_instance_cache.py +4 -2
  55. wandb/sdk/artifacts/artifact_manifest.py +13 -11
  56. wandb/sdk/artifacts/artifact_manifest_entry.py +24 -22
  57. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +9 -7
  58. wandb/sdk/artifacts/artifact_saver.py +27 -25
  59. wandb/sdk/artifacts/exceptions.py +26 -25
  60. wandb/sdk/artifacts/storage_handler.py +11 -9
  61. wandb/sdk/artifacts/storage_handlers/azure_handler.py +16 -14
  62. wandb/sdk/artifacts/storage_handlers/gcs_handler.py +15 -13
  63. wandb/sdk/artifacts/storage_handlers/http_handler.py +15 -14
  64. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +10 -8
  65. wandb/sdk/artifacts/storage_handlers/multi_handler.py +14 -12
  66. wandb/sdk/artifacts/storage_handlers/s3_handler.py +19 -19
  67. wandb/sdk/artifacts/storage_handlers/tracking_handler.py +10 -8
  68. wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +12 -10
  69. wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +9 -7
  70. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +31 -29
  71. wandb/sdk/artifacts/storage_policy.py +20 -20
  72. wandb/sdk/backend/backend.py +8 -26
  73. wandb/sdk/data_types/audio.py +165 -0
  74. wandb/sdk/data_types/base_types/wb_value.py +1 -3
  75. wandb/sdk/data_types/bokeh.py +70 -0
  76. wandb/sdk/data_types/graph.py +405 -0
  77. wandb/sdk/data_types/image.py +156 -0
  78. wandb/sdk/data_types/table.py +1204 -0
  79. wandb/sdk/data_types/trace_tree.py +2 -2
  80. wandb/sdk/data_types/utils.py +49 -0
  81. wandb/sdk/data_types/video.py +2 -2
  82. wandb/sdk/interface/interface.py +0 -24
  83. wandb/sdk/interface/interface_shared.py +0 -12
  84. wandb/sdk/internal/handler.py +0 -10
  85. wandb/sdk/internal/internal_api.py +71 -0
  86. wandb/sdk/internal/sender.py +0 -43
  87. wandb/sdk/internal/tb_watcher.py +1 -1
  88. wandb/sdk/lib/_settings_toposort_generated.py +1 -0
  89. wandb/sdk/lib/hashutil.py +34 -12
  90. wandb/sdk/lib/service_connection.py +216 -0
  91. wandb/sdk/lib/service_token.py +94 -0
  92. wandb/sdk/lib/sock_client.py +7 -3
  93. wandb/sdk/service/server.py +2 -5
  94. wandb/sdk/service/service.py +2 -31
  95. wandb/sdk/service/streams.py +0 -7
  96. wandb/sdk/wandb_init.py +42 -25
  97. wandb/sdk/wandb_run.py +18 -159
  98. wandb/sdk/wandb_settings.py +2 -0
  99. wandb/sdk/wandb_setup.py +25 -16
  100. wandb/sdk/wandb_sync.py +9 -3
  101. wandb/sdk/wandb_watch.py +31 -15
  102. wandb/sklearn.py +35 -0
  103. wandb/util.py +14 -3
  104. {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/METADATA +6 -5
  105. {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/RECORD +114 -110
  106. wandb/sdk/internal/update.py +0 -113
  107. wandb/sdk/lib/console.py +0 -39
  108. wandb/sdk/service/service_base.py +0 -50
  109. wandb/sdk/service/service_sock.py +0 -70
  110. wandb/sdk/wandb_manager.py +0 -232
  111. /wandb/{sklearn → integration/sklearn}/__init__.py +0 -0
  112. /wandb/{sklearn → integration/sklearn}/calculate/__init__.py +0 -0
  113. /wandb/{sklearn → integration/sklearn}/calculate/decision_boundaries.py +0 -0
  114. /wandb/{sklearn → integration/sklearn}/calculate/feature_importances.py +0 -0
  115. /wandb/{sklearn → integration/sklearn}/plot/__init__.py +0 -0
  116. /wandb/{sdk/lib → plot}/viz.py +0 -0
  117. {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/WHEEL +0 -0
  118. {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/entry_points.txt +0 -0
  119. {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,70 +0,0 @@
1
- """socket service.
2
-
3
- Implement ServiceInterface for socket transport.
4
- """
5
-
6
- from typing import TYPE_CHECKING, Optional
7
-
8
- from wandb.proto import wandb_server_pb2 as spb
9
-
10
- from ..lib.sock_client import SockClient
11
- from .service_base import ServiceInterface
12
-
13
- if TYPE_CHECKING:
14
- from wandb.proto import wandb_settings_pb2
15
-
16
-
17
- class ServiceSockInterface(ServiceInterface):
18
- _sock_client: SockClient
19
-
20
- def __init__(self) -> None:
21
- self._sock_client = SockClient()
22
-
23
- def get_transport(self) -> str:
24
- return "tcp"
25
-
26
- def _get_sock_client(self) -> SockClient:
27
- return self._sock_client
28
-
29
- def _svc_connect(self, port: int) -> None:
30
- self._sock_client.connect(port=port)
31
-
32
- def _svc_inform_init(
33
- self, settings: "wandb_settings_pb2.Settings", run_id: str
34
- ) -> None:
35
- inform_init = spb.ServerInformInitRequest()
36
- inform_init.settings.CopyFrom(settings)
37
- inform_init._info.stream_id = run_id
38
- assert self._sock_client
39
- self._sock_client.send(inform_init=inform_init)
40
-
41
- def _svc_inform_start(
42
- self, settings: "wandb_settings_pb2.Settings", run_id: str
43
- ) -> None:
44
- inform_start = spb.ServerInformStartRequest()
45
- inform_start.settings.CopyFrom(settings)
46
- inform_start._info.stream_id = run_id
47
- assert self._sock_client
48
- self._sock_client.send(inform_start=inform_start)
49
-
50
- def _svc_inform_finish(self, run_id: Optional[str] = None) -> None:
51
- assert run_id
52
- inform_finish = spb.ServerInformFinishRequest()
53
- inform_finish._info.stream_id = run_id
54
-
55
- assert self._sock_client
56
- self._sock_client.send(inform_finish=inform_finish)
57
-
58
- def _svc_inform_attach(self, attach_id: str) -> spb.ServerInformAttachResponse:
59
- inform_attach = spb.ServerInformAttachRequest()
60
- inform_attach._info.stream_id = attach_id
61
-
62
- assert self._sock_client
63
- response = self._sock_client.send_and_recv(inform_attach=inform_attach)
64
- return response.inform_attach_response
65
-
66
- def _svc_inform_teardown(self, exit_code: int) -> None:
67
- inform_teardown = spb.ServerInformTeardownRequest(exit_code=exit_code)
68
-
69
- assert self._sock_client
70
- self._sock_client.send(inform_teardown=inform_teardown)
@@ -1,232 +0,0 @@
1
- """Manage wandb processes.
2
-
3
- Create a manager channel.
4
- """
5
-
6
- import atexit
7
- import os
8
- from typing import TYPE_CHECKING, Callable, Optional
9
-
10
- import psutil
11
-
12
- import wandb
13
- from wandb import env, trigger
14
- from wandb.errors import Error
15
- from wandb.sdk.lib.exit_hooks import ExitHooks
16
-
17
- if TYPE_CHECKING:
18
- from wandb.proto import wandb_settings_pb2
19
- from wandb.sdk.service import service
20
- from wandb.sdk.service.service_base import ServiceInterface
21
- from wandb.sdk.wandb_settings import Settings
22
-
23
-
24
- class ManagerConnectionError(Error):
25
- """Raised when service process is not running."""
26
-
27
- pass
28
-
29
-
30
- class ManagerConnectionRefusedError(ManagerConnectionError):
31
- """Raised when service process is not running."""
32
-
33
- pass
34
-
35
-
36
- class _ManagerToken:
37
- _version = "2"
38
- _supported_transports = {"tcp"}
39
- _token_str: str
40
- _pid: int
41
- _transport: str
42
- _host: str
43
- _port: int
44
-
45
- def __init__(self, token: str) -> None:
46
- self._token_str = token
47
- self._parse()
48
-
49
- @classmethod
50
- def from_environment(cls) -> Optional["_ManagerToken"]:
51
- token = os.environ.get(env.SERVICE)
52
- if not token:
53
- return None
54
- return cls(token=token)
55
-
56
- @classmethod
57
- def from_params(cls, transport: str, host: str, port: int) -> "_ManagerToken":
58
- version = cls._version
59
- pid = os.getpid()
60
- token = "-".join([version, str(pid), transport, host, str(port)])
61
- return cls(token=token)
62
-
63
- def set_environment(self) -> None:
64
- os.environ[env.SERVICE] = self._token_str
65
-
66
- def _parse(self) -> None:
67
- assert self._token_str
68
- parts = self._token_str.split("-")
69
- assert len(parts) == 5, f"token must have 5 parts: {parts}"
70
- # TODO: make more robust?
71
- version, pid_str, transport, host, port_str = parts
72
- assert version == self._version
73
- assert transport in self._supported_transports
74
- self._pid = int(pid_str)
75
- self._transport = transport
76
- self._host = host
77
- self._port = int(port_str)
78
-
79
- def reset_environment(self) -> None:
80
- os.environ.pop(env.SERVICE, None)
81
-
82
- @property
83
- def token(self) -> str:
84
- return self._token_str
85
-
86
- @property
87
- def pid(self) -> int:
88
- return self._pid
89
-
90
- @property
91
- def transport(self) -> str:
92
- return self._transport
93
-
94
- @property
95
- def host(self) -> str:
96
- return self._host
97
-
98
- @property
99
- def port(self) -> int:
100
- return self._port
101
-
102
-
103
- class _Manager:
104
- _token: _ManagerToken
105
- _atexit_lambda: Optional[Callable[[], None]]
106
- _hooks: Optional[ExitHooks]
107
- _settings: "Settings"
108
- _service: "service._Service"
109
-
110
- def _service_connect(self) -> None:
111
- port = self._token.port
112
- svc_iface = self._get_service_interface()
113
-
114
- try:
115
- svc_iface._svc_connect(port=port)
116
-
117
- except ConnectionRefusedError as e:
118
- if not psutil.pid_exists(self._token.pid):
119
- message = (
120
- "Connection to wandb service failed"
121
- " because the process is not available."
122
- )
123
- else:
124
- message = "Connection to wandb service failed."
125
- raise ManagerConnectionRefusedError(message) from e
126
-
127
- except Exception as e:
128
- raise ManagerConnectionError(
129
- "Connection to wandb service failed.",
130
- ) from e
131
-
132
- def __init__(self, settings: "Settings") -> None:
133
- """Connects to the internal service, starting it if necessary."""
134
- from wandb.sdk.service import service
135
-
136
- self._settings = settings
137
- self._atexit_lambda = None
138
- self._hooks = None
139
-
140
- self._service = service._Service(settings=self._settings)
141
-
142
- token = _ManagerToken.from_environment()
143
- if not token:
144
- self._service.start()
145
- host = "localhost"
146
- transport = "tcp"
147
- port = self._service.sock_port
148
- assert port
149
- token = _ManagerToken.from_params(transport=transport, host=host, port=port)
150
- token.set_environment()
151
- self._atexit_setup()
152
- self._token = token
153
-
154
- try:
155
- self._service_connect()
156
- except ManagerConnectionError as e:
157
- wandb._sentry.reraise(e)
158
-
159
- def _teardown(self, exit_code: int) -> int:
160
- """Shuts down the internal process and returns its exit code.
161
-
162
- This sends a teardown record to the process. An exception is raised if
163
- the process has already been shut down.
164
- """
165
- if self._atexit_lambda:
166
- atexit.unregister(self._atexit_lambda)
167
- self._atexit_lambda = None
168
-
169
- try:
170
- self._inform_teardown(exit_code)
171
- return self._service.join()
172
- finally:
173
- self._token.reset_environment()
174
-
175
- def _atexit_setup(self) -> None:
176
- self._atexit_lambda = lambda: self._atexit_teardown()
177
-
178
- self._hooks = ExitHooks()
179
- self._hooks.hook()
180
- atexit.register(self._atexit_lambda)
181
-
182
- def _atexit_teardown(self) -> None:
183
- trigger.call("on_finished")
184
-
185
- # Clear the atexit hook---we're executing it now, after which the
186
- # process will exit.
187
- self._atexit_lambda = None
188
-
189
- try:
190
- self._teardown(self._hooks.exit_code if self._hooks else 0)
191
- except Exception as e:
192
- wandb.termlog(
193
- f"Encountered an error while tearing down the service manager: {e}",
194
- repeat=False,
195
- )
196
-
197
- def _get_service(self) -> "service._Service":
198
- return self._service
199
-
200
- def _get_service_interface(self) -> "ServiceInterface":
201
- assert self._service
202
- svc_iface = self._service.service_interface
203
- assert svc_iface
204
- return svc_iface
205
-
206
- def _inform_init(
207
- self, settings: "wandb_settings_pb2.Settings", run_id: str
208
- ) -> None:
209
- svc_iface = self._get_service_interface()
210
- svc_iface._svc_inform_init(settings=settings, run_id=run_id)
211
-
212
- def _inform_start(
213
- self, settings: "wandb_settings_pb2.Settings", run_id: str
214
- ) -> None:
215
- svc_iface = self._get_service_interface()
216
- svc_iface._svc_inform_start(settings=settings, run_id=run_id)
217
-
218
- def _inform_attach(self, attach_id: str) -> Optional["wandb_settings_pb2.Settings"]:
219
- svc_iface = self._get_service_interface()
220
- try:
221
- response = svc_iface._svc_inform_attach(attach_id=attach_id)
222
- except Exception:
223
- return None
224
- return response.settings
225
-
226
- def _inform_finish(self, run_id: Optional[str] = None) -> None:
227
- svc_iface = self._get_service_interface()
228
- svc_iface._svc_inform_finish(run_id=run_id)
229
-
230
- def _inform_teardown(self, exit_code: int) -> None:
231
- svc_iface = self._get_service_interface()
232
- svc_iface._svc_inform_teardown(exit_code)
File without changes
File without changes
File without changes