wandb 0.18.5__py3-none-any.whl → 0.18.7__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +2 -2
- wandb/__init__.pyi +22 -20
- wandb/agents/pyagent.py +1 -1
- wandb/apis/importers/wandb.py +1 -1
- wandb/apis/normalize.py +2 -18
- wandb/apis/public/api.py +126 -62
- wandb/apis/public/artifacts.py +8 -3
- wandb/apis/public/files.py +17 -2
- wandb/apis/public/jobs.py +2 -2
- wandb/apis/public/query_generator.py +1 -1
- wandb/apis/public/runs.py +8 -8
- wandb/apis/public/teams.py +3 -3
- wandb/apis/public/users.py +1 -1
- wandb/apis/public/utils.py +68 -0
- wandb/bin/gpu_stats +0 -0
- wandb/cli/cli.py +12 -3
- wandb/data_types.py +1 -1
- wandb/docker/__init__.py +2 -1
- wandb/docker/auth.py +2 -3
- wandb/errors/links.py +73 -0
- wandb/errors/term.py +7 -6
- wandb/filesync/step_prepare.py +1 -1
- wandb/filesync/upload_job.py +1 -1
- wandb/integration/catboost/catboost.py +2 -2
- wandb/integration/diffusers/pipeline_resolver.py +1 -1
- wandb/integration/diffusers/resolvers/multimodal.py +6 -6
- wandb/integration/diffusers/resolvers/utils.py +1 -1
- wandb/integration/fastai/__init__.py +3 -2
- wandb/integration/keras/callbacks/metrics_logger.py +1 -1
- wandb/integration/keras/callbacks/model_checkpoint.py +1 -1
- wandb/integration/keras/keras.py +1 -1
- wandb/integration/kfp/kfp_patch.py +1 -1
- wandb/integration/lightgbm/__init__.py +2 -2
- wandb/integration/magic.py +2 -2
- wandb/integration/metaflow/metaflow.py +1 -1
- wandb/integration/sacred/__init__.py +1 -1
- wandb/integration/sagemaker/auth.py +1 -1
- wandb/integration/sklearn/plot/classifier.py +7 -7
- wandb/integration/sklearn/plot/clusterer.py +3 -3
- wandb/integration/sklearn/plot/regressor.py +3 -3
- wandb/integration/sklearn/plot/shared.py +2 -2
- wandb/integration/tensorboard/log.py +2 -2
- wandb/integration/ultralytics/callback.py +2 -2
- wandb/integration/xgboost/xgboost.py +1 -1
- wandb/jupyter.py +0 -1
- wandb/plot/__init__.py +17 -8
- wandb/plot/bar.py +53 -27
- wandb/plot/confusion_matrix.py +151 -70
- wandb/plot/custom_chart.py +124 -0
- wandb/plot/histogram.py +46 -20
- wandb/plot/line.py +57 -26
- wandb/plot/line_series.py +148 -60
- wandb/plot/pr_curve.py +89 -44
- wandb/plot/roc_curve.py +82 -37
- wandb/plot/scatter.py +53 -20
- wandb/plot/viz.py +20 -102
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
- wandb/proto/wandb_deprecated.py +2 -0
- wandb/sdk/artifacts/artifact.py +281 -329
- wandb/sdk/artifacts/artifact_manifest.py +10 -9
- wandb/sdk/artifacts/artifact_manifest_entry.py +1 -1
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +9 -4
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +1 -3
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +1 -1
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +2 -2
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -1
- wandb/sdk/backend/backend.py +0 -1
- wandb/sdk/data_types/audio.py +1 -1
- wandb/sdk/data_types/base_types/media.py +66 -5
- wandb/sdk/data_types/base_types/wb_value.py +20 -10
- wandb/sdk/data_types/bokeh.py +1 -1
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -1
- wandb/sdk/data_types/helper_types/image_mask.py +2 -2
- wandb/sdk/data_types/histogram.py +1 -1
- wandb/sdk/data_types/html.py +1 -1
- wandb/sdk/data_types/image.py +1 -1
- wandb/sdk/data_types/molecule.py +3 -3
- wandb/sdk/data_types/object_3d.py +4 -4
- wandb/sdk/data_types/plotly.py +1 -1
- wandb/sdk/data_types/saved_model.py +0 -1
- wandb/sdk/data_types/table.py +7 -7
- wandb/sdk/data_types/trace_tree.py +1 -1
- wandb/sdk/data_types/video.py +4 -3
- wandb/sdk/interface/interface_queue.py +0 -6
- wandb/sdk/interface/router.py +1 -4
- wandb/sdk/interface/router_queue.py +0 -3
- wandb/sdk/interface/router_relay.py +0 -2
- wandb/sdk/internal/datastore.py +1 -1
- wandb/sdk/internal/file_pusher.py +1 -1
- wandb/sdk/internal/file_stream.py +4 -4
- wandb/sdk/internal/handler.py +3 -4
- wandb/sdk/internal/internal.py +1 -15
- wandb/sdk/internal/internal_api.py +178 -63
- wandb/sdk/internal/internal_util.py +0 -3
- wandb/sdk/internal/job_builder.py +4 -3
- wandb/sdk/internal/sender.py +0 -2
- wandb/sdk/internal/system/assets/__init__.py +0 -2
- wandb/sdk/internal/tb_watcher.py +11 -10
- wandb/sdk/internal/writer.py +1 -3
- wandb/sdk/launch/__init__.py +2 -1
- wandb/sdk/launch/_launch.py +4 -3
- wandb/sdk/launch/_launch_add.py +2 -2
- wandb/sdk/launch/builder/kaniko_builder.py +0 -1
- wandb/sdk/launch/create_job.py +1 -0
- wandb/sdk/launch/environment/local_environment.py +0 -1
- wandb/sdk/launch/errors.py +0 -6
- wandb/sdk/launch/registry/local_registry.py +0 -2
- wandb/sdk/launch/runner/abstract.py +0 -5
- wandb/sdk/launch/sweeps/__init__.py +0 -2
- wandb/sdk/launch/sweeps/scheduler.py +0 -2
- wandb/sdk/launch/sweeps/scheduler_sweep.py +0 -1
- wandb/sdk/lib/_settings_toposort_generated.py +1 -0
- wandb/sdk/lib/apikey.py +3 -3
- wandb/sdk/lib/file_stream_utils.py +1 -1
- wandb/sdk/lib/filesystem.py +1 -1
- wandb/sdk/lib/ipython.py +16 -9
- wandb/sdk/lib/mailbox.py +0 -4
- wandb/sdk/lib/printer.py +44 -8
- wandb/sdk/lib/retry.py +1 -1
- wandb/sdk/lib/sock_client.py +0 -5
- wandb/sdk/service/server.py +2 -11
- wandb/sdk/service/server_sock.py +0 -2
- wandb/sdk/service/service.py +3 -3
- wandb/sdk/service/streams.py +2 -4
- wandb/sdk/wandb_init.py +20 -20
- wandb/sdk/wandb_login.py +1 -1
- wandb/sdk/wandb_require.py +1 -4
- wandb/sdk/wandb_run.py +97 -115
- wandb/sdk/wandb_settings.py +23 -6
- wandb/sdk/wandb_setup.py +1 -5
- wandb/sdk/wandb_sync.py +2 -1
- wandb/util.py +49 -21
- wandb/wandb_agent.py +3 -3
- wandb/wandb_controller.py +2 -2
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/METADATA +1 -2
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/RECORD +144 -146
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/WHEEL +1 -1
- wandb/sdk/internal/system/assets/gpu_apple.py +0 -177
- wandb/sdk/lib/_wburls_generate.py +0 -25
- wandb/sdk/lib/_wburls_generated.py +0 -22
- wandb/sdk/lib/tracelog.py +0 -255
- wandb/sdk/lib/wburls.py +0 -46
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/licenses/LICENSE +0 -0
@@ -4,7 +4,6 @@ __all__ = (
|
|
4
4
|
"Disk",
|
5
5
|
"GPU",
|
6
6
|
"GPUAMD",
|
7
|
-
"GPUApple",
|
8
7
|
"IPU",
|
9
8
|
"Memory",
|
10
9
|
"Network",
|
@@ -18,7 +17,6 @@ from .cpu import CPU
|
|
18
17
|
from .disk import Disk
|
19
18
|
from .gpu import GPU
|
20
19
|
from .gpu_amd import GPUAMD
|
21
|
-
from .gpu_apple import GPUApple
|
22
20
|
from .ipu import IPU
|
23
21
|
from .memory import Memory
|
24
22
|
from .network import Network
|
wandb/sdk/internal/tb_watcher.py
CHANGED
@@ -12,7 +12,7 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional
|
|
12
12
|
|
13
13
|
import wandb
|
14
14
|
from wandb import util
|
15
|
-
from wandb.plot
|
15
|
+
from wandb.plot import CustomChart
|
16
16
|
from wandb.sdk.interface.interface import GlobStr
|
17
17
|
from wandb.sdk.lib import filesystem
|
18
18
|
|
@@ -73,7 +73,7 @@ def is_tfevents_file_created_by(
|
|
73
73
|
if not path:
|
74
74
|
raise ValueError("Path must be a nonempty string")
|
75
75
|
basename = os.path.basename(path)
|
76
|
-
if basename.endswith(".profile-empty"
|
76
|
+
if basename.endswith((".profile-empty", ".sagemaker-uploaded")):
|
77
77
|
return False
|
78
78
|
fname_components = basename.split(".")
|
79
79
|
try:
|
@@ -439,18 +439,19 @@ class TBEventConsumer:
|
|
439
439
|
|
440
440
|
def _save_row(self, row: "HistoryDict") -> None:
|
441
441
|
chart_keys = set()
|
442
|
-
for k in row:
|
443
|
-
if isinstance(
|
442
|
+
for k, v in row.items():
|
443
|
+
if isinstance(v, CustomChart):
|
444
444
|
chart_keys.add(k)
|
445
|
-
|
446
|
-
|
447
|
-
|
445
|
+
v.set_key(k)
|
446
|
+
self._tbwatcher._interface.publish_config(
|
447
|
+
key=v.spec.config_key,
|
448
|
+
val=v.spec.config_value,
|
448
449
|
)
|
449
|
-
row[k] = row[k]._data
|
450
|
-
self._tbwatcher._interface.publish_config(val=value, key=key)
|
451
450
|
|
452
451
|
for k in chart_keys:
|
453
|
-
|
452
|
+
chart = row.pop(k)
|
453
|
+
if isinstance(chart, CustomChart):
|
454
|
+
row[chart.spec.table_key] = chart.table
|
454
455
|
|
455
456
|
self._tbwatcher._interface.publish_history(
|
456
457
|
row, run=self._internal_run, publish_step=False
|
wandb/sdk/internal/writer.py
CHANGED
@@ -7,7 +7,7 @@ from wandb.proto import wandb_internal_pb2 as pb
|
|
7
7
|
from wandb.proto import wandb_telemetry_pb2 as tpb
|
8
8
|
|
9
9
|
from ..interface.interface_queue import InterfaceQueue
|
10
|
-
from ..lib import proto_util, telemetry
|
10
|
+
from ..lib import proto_util, telemetry
|
11
11
|
from . import context, datastore, flow_control
|
12
12
|
from .settings_static import SettingsStatic
|
13
13
|
|
@@ -79,7 +79,6 @@ class WriteManager:
|
|
79
79
|
|
80
80
|
def _forward_record(self, record: "pb.Record") -> None:
|
81
81
|
self._context_keeper.add_from_record(record)
|
82
|
-
tracelog.log_message_queue(record, self._sender_q)
|
83
82
|
self._sender_q.put(record)
|
84
83
|
|
85
84
|
def _send_mark(self) -> None:
|
@@ -191,7 +190,6 @@ class WriteManager:
|
|
191
190
|
# self._sender_cancel_set.add(cancel_id)
|
192
191
|
|
193
192
|
def _respond_result(self, result: "pb.Result") -> None:
|
194
|
-
tracelog.log_message_queue(result, self._result_q)
|
195
193
|
self._result_q.put(result)
|
196
194
|
|
197
195
|
def finish(self) -> None:
|
wandb/sdk/launch/__init__.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
from ._launch import launch
|
1
|
+
from ._launch import create_and_run_agent, launch
|
2
2
|
from ._launch_add import launch_add
|
3
3
|
from .agent.agent import LaunchAgent
|
4
4
|
from .inputs.manage import manage_config_file, manage_wandb_config
|
5
5
|
from .utils import load_wandb_config
|
6
6
|
|
7
7
|
__all__ = [
|
8
|
+
"create_and_run_agent",
|
8
9
|
"LaunchAgent",
|
9
10
|
"launch",
|
10
11
|
"launch_add",
|
wandb/sdk/launch/_launch.py
CHANGED
@@ -120,10 +120,11 @@ def resolve_agent_config( # noqa: C901
|
|
120
120
|
if isinstance(resolved_config.get("queue"), str):
|
121
121
|
resolved_config["queues"].append(resolved_config["queue"])
|
122
122
|
else:
|
123
|
-
|
124
|
-
|
125
|
-
|
123
|
+
msg = (
|
124
|
+
"Invalid launch agent config for key 'queue' with type: {type(resolved_config.get('queue'))} "
|
125
|
+
"(expected str). Specify multiple queues with the 'queues' key"
|
126
126
|
)
|
127
|
+
raise LaunchError(msg)
|
127
128
|
|
128
129
|
keys = ["entity"]
|
129
130
|
settings = {
|
wandb/sdk/launch/_launch_add.py
CHANGED
@@ -61,7 +61,7 @@ def launch_add(
|
|
61
61
|
config: A dictionary containing the configuration for the run. May also contain
|
62
62
|
resource specific arguments under the key "resource_args"
|
63
63
|
template_variables: A dictionary containing values of template variables for a run queue.
|
64
|
-
Expected format of {"VAR_NAME": VAR_VALUE}
|
64
|
+
Expected format of `{"VAR_NAME": VAR_VALUE}`
|
65
65
|
project: Target project to send launched run to
|
66
66
|
entity: Target entity to send launched run to
|
67
67
|
queue: the name of the queue to enqueue the run to
|
@@ -240,7 +240,7 @@ def _launch_add(
|
|
240
240
|
public_api = public.Api()
|
241
241
|
if job is not None:
|
242
242
|
try:
|
243
|
-
public_api.
|
243
|
+
public_api._artifact(job, type="job")
|
244
244
|
except (ValueError, CommError) as e:
|
245
245
|
raise LaunchError(f"Unable to fetch job with name {job}: {e}")
|
246
246
|
|
wandb/sdk/launch/create_job.py
CHANGED
@@ -168,6 +168,7 @@ def _create_job(
|
|
168
168
|
return None, "", []
|
169
169
|
|
170
170
|
job_builder = _configure_job_builder_for_partial(tempdir.name, job_source=job_type)
|
171
|
+
job_builder._settings.update(job_name=name)
|
171
172
|
if job_type == "code":
|
172
173
|
assert entrypoint is not None
|
173
174
|
job_name = _make_code_artifact(
|
wandb/sdk/launch/errors.py
CHANGED
@@ -4,16 +4,10 @@ from wandb.errors import Error
|
|
4
4
|
class LaunchError(Error):
|
5
5
|
"""Raised when a known error occurs in wandb launch."""
|
6
6
|
|
7
|
-
pass
|
8
|
-
|
9
7
|
|
10
8
|
class LaunchDockerError(Error):
|
11
9
|
"""Raised when Docker daemon is not running."""
|
12
10
|
|
13
|
-
pass
|
14
|
-
|
15
11
|
|
16
12
|
class ExecutionError(Error):
|
17
13
|
"""Generic execution exception."""
|
18
|
-
|
19
|
-
pass
|
@@ -20,7 +20,6 @@ class LocalRegistry(AbstractRegistry):
|
|
20
20
|
|
21
21
|
def __init__(self) -> None:
|
22
22
|
"""Initialize a local registry."""
|
23
|
-
pass
|
24
23
|
|
25
24
|
@classmethod
|
26
25
|
def from_config(
|
@@ -40,7 +39,6 @@ class LocalRegistry(AbstractRegistry):
|
|
40
39
|
|
41
40
|
async def verify(self) -> None:
|
42
41
|
"""Verify the local registry by doing nothing."""
|
43
|
-
pass
|
44
42
|
|
45
43
|
async def get_username_password(self) -> Tuple[str, str]:
|
46
44
|
"""Get the username and password of the local registry."""
|
@@ -82,7 +82,6 @@ class AbstractRun(ABC):
|
|
82
82
|
@abstractmethod
|
83
83
|
async def get_logs(self) -> Optional[str]:
|
84
84
|
"""Return the logs associated with the run."""
|
85
|
-
pass
|
86
85
|
|
87
86
|
def _run_cmd(
|
88
87
|
self, cmd: List[str], output_only: Optional[bool] = False
|
@@ -111,12 +110,10 @@ class AbstractRun(ABC):
|
|
111
110
|
|
112
111
|
Note that in some cases, we may wait until the remote job completes rather than until the W&B run completes.
|
113
112
|
"""
|
114
|
-
pass
|
115
113
|
|
116
114
|
@abstractmethod
|
117
115
|
async def get_status(self) -> Status:
|
118
116
|
"""Get status of the run."""
|
119
|
-
pass
|
120
117
|
|
121
118
|
@abstractmethod
|
122
119
|
async def cancel(self) -> None:
|
@@ -125,7 +122,6 @@ class AbstractRun(ABC):
|
|
125
122
|
Cancels the run and waits for it to terminate. The W&B run status may not be
|
126
123
|
set correctly upon run cancellation.
|
127
124
|
"""
|
128
|
-
pass
|
129
125
|
|
130
126
|
@property
|
131
127
|
@abstractmethod
|
@@ -192,4 +188,3 @@ class AbstractRunner(ABC):
|
|
192
188
|
the project asynchronously, i.e. it should trigger project execution and then
|
193
189
|
immediately return a `SubmittedRun` to track execution status.
|
194
190
|
"""
|
195
|
-
pass
|
@@ -183,12 +183,10 @@ class Scheduler(ABC):
|
|
183
183
|
@abstractmethod
|
184
184
|
def _get_next_sweep_run(self, worker_id: int) -> Optional[SweepRun]:
|
185
185
|
"""Called when worker available."""
|
186
|
-
pass
|
187
186
|
|
188
187
|
@abstractmethod
|
189
188
|
def _poll(self) -> None:
|
190
189
|
"""Called every polling loop."""
|
191
|
-
pass
|
192
190
|
|
193
191
|
@abstractmethod
|
194
192
|
def _exit(self) -> None:
|
wandb/sdk/lib/apikey.py
CHANGED
@@ -21,10 +21,9 @@ from requests.utils import NETRC_FILES, get_netrc_auth
|
|
21
21
|
import wandb
|
22
22
|
from wandb.apis import InternalApi
|
23
23
|
from wandb.errors import term
|
24
|
+
from wandb.errors.links import url_registry
|
24
25
|
from wandb.util import _is_databricks, isatty, prompt_choices
|
25
26
|
|
26
|
-
from .wburls import wburls
|
27
|
-
|
28
27
|
LOGIN_CHOICE_ANON = "Private W&B dashboard, no account required"
|
29
28
|
LOGIN_CHOICE_NEW = "Create a W&B account"
|
30
29
|
LOGIN_CHOICE_EXISTS = "Use an existing W&B account"
|
@@ -156,7 +155,8 @@ def prompt_api_key( # noqa: C901
|
|
156
155
|
if app_url.startswith(prefix):
|
157
156
|
host = app_url[len(prefix) :]
|
158
157
|
wandb.termlog(
|
159
|
-
f"Logging into {host}. (Learn how to deploy a W&B server
|
158
|
+
f"Logging into {host}. (Learn how to deploy a W&B server "
|
159
|
+
f"locally: {url_registry.url('wandb-server')})"
|
160
160
|
)
|
161
161
|
wandb.termlog(
|
162
162
|
f"You can find your API key in your browser here: {app_url}/authorize"
|
@@ -12,7 +12,7 @@ def split_files(
|
|
12
12
|
This method is used in `FileStreamAPI._send()` to limit the size of post requests
|
13
13
|
sent to wandb server.
|
14
14
|
|
15
|
-
|
15
|
+
Args:
|
16
16
|
files (dict): `dict` of form {file_name: {'content': ".....", 'offset': 0}}
|
17
17
|
The key `file_name` can also be mapped to a List [{"offset": int, "content": str}]
|
18
18
|
`max_bytes`: max size for chunk in bytes
|
wandb/sdk/lib/filesystem.py
CHANGED
@@ -16,7 +16,7 @@ from wandb.sdk.lib.paths import StrPath
|
|
16
16
|
logger = logging.getLogger(__name__)
|
17
17
|
|
18
18
|
# https://en.wikipedia.org/wiki/Filename#Comparison_of_filename_limitations
|
19
|
-
PROBLEMATIC_PATH_CHARS = "".join(chr(i) for i in range(
|
19
|
+
PROBLEMATIC_PATH_CHARS = "".join(chr(i) for i in range(32)) + ':"*<>?|'
|
20
20
|
|
21
21
|
|
22
22
|
def mkdir_exists_ok(dir_name: StrPath) -> None:
|
wandb/sdk/lib/ipython.py
CHANGED
@@ -15,16 +15,16 @@ PythonType = Literal["python", "ipython", "jupyter"]
|
|
15
15
|
logger = logging.getLogger(__name__)
|
16
16
|
|
17
17
|
|
18
|
-
TABLE_STYLES = """<style>
|
19
|
-
table.wandb td:nth-child(1) { padding: 0 10px; text-align: left ; width: auto;} td:nth-child(2) {text-align: left ; width: 100%}
|
20
|
-
.wandb-row { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; width: 100% }
|
21
|
-
.wandb-col { display: flex; flex-direction: column; flex-basis: 100%; flex: 1; padding: 10px; }
|
22
|
-
</style>
|
23
|
-
"""
|
24
|
-
|
25
|
-
|
26
18
|
def toggle_button(what="run"):
|
27
|
-
|
19
|
+
"""Returns the HTML for a button used to reveal the element following it.
|
20
|
+
|
21
|
+
The element immediately after the button must have `display: none`.
|
22
|
+
"""
|
23
|
+
return (
|
24
|
+
"<button onClick=\"this.nextSibling.style.display='block';this.style.display='none';\">"
|
25
|
+
f"Display W&B {what}"
|
26
|
+
"</button>"
|
27
|
+
)
|
28
28
|
|
29
29
|
|
30
30
|
def _get_python_type() -> PythonType:
|
@@ -62,10 +62,17 @@ def _get_python_type() -> PythonType:
|
|
62
62
|
|
63
63
|
|
64
64
|
def in_jupyter() -> bool:
|
65
|
+
"""Returns True if we're in a Jupyter notebook."""
|
65
66
|
return _get_python_type() == "jupyter"
|
66
67
|
|
67
68
|
|
69
|
+
def in_ipython() -> bool:
|
70
|
+
"""Returns True if we're running in IPython in the terminal."""
|
71
|
+
return _get_python_type() == "ipython"
|
72
|
+
|
73
|
+
|
68
74
|
def in_notebook() -> bool:
|
75
|
+
"""Returns True if we're running in Jupyter or IPython."""
|
69
76
|
return _get_python_type() != "python"
|
70
77
|
|
71
78
|
|
wandb/sdk/lib/mailbox.py
CHANGED
@@ -23,14 +23,10 @@ def _generate_address(length: int = 12) -> str:
|
|
23
23
|
class MailboxError(Error):
|
24
24
|
"""Generic Mailbox Exception."""
|
25
25
|
|
26
|
-
pass
|
27
|
-
|
28
26
|
|
29
27
|
class ContextCancelledError(MailboxError):
|
30
28
|
"""Context cancelled Exception."""
|
31
29
|
|
32
|
-
pass
|
33
|
-
|
34
30
|
|
35
31
|
class _MailboxWaitAll:
|
36
32
|
_event: threading.Event
|
wandb/sdk/lib/printer.py
CHANGED
@@ -63,6 +63,48 @@ to form a subtle clockwise spinning animation.
|
|
63
63
|
_PROGRESS_SYMBOL_COLOR = 0xB2
|
64
64
|
"""Color from the 256-color palette for the progress symbol."""
|
65
65
|
|
66
|
+
_JUPYTER_TABLE_STYLES = """
|
67
|
+
<style>
|
68
|
+
table.wandb td:nth-child(1) {
|
69
|
+
padding: 0 10px;
|
70
|
+
text-align: left;
|
71
|
+
width: auto;
|
72
|
+
}
|
73
|
+
|
74
|
+
table.wandb td:nth-child(2) {
|
75
|
+
text-align: left;
|
76
|
+
width: 100%;
|
77
|
+
}
|
78
|
+
</style>
|
79
|
+
"""
|
80
|
+
|
81
|
+
_JUPYTER_PANEL_STYLES = """
|
82
|
+
<style>
|
83
|
+
.wandb-row {
|
84
|
+
display: flex;
|
85
|
+
flex-direction: row;
|
86
|
+
flex-wrap: wrap;
|
87
|
+
justify-content: flex-start;
|
88
|
+
width: 100%;
|
89
|
+
}
|
90
|
+
.wandb-col {
|
91
|
+
display: flex;
|
92
|
+
flex-direction: column;
|
93
|
+
flex-basis: 100%;
|
94
|
+
flex: 1;
|
95
|
+
padding: 10px;
|
96
|
+
}
|
97
|
+
</style>
|
98
|
+
"""
|
99
|
+
|
100
|
+
|
101
|
+
def new_printer() -> Printer:
|
102
|
+
"""Returns a new printer based on the environment we're in."""
|
103
|
+
if ipython.in_jupyter():
|
104
|
+
return _PrinterJupyter()
|
105
|
+
else:
|
106
|
+
return _PrinterTerm()
|
107
|
+
|
66
108
|
|
67
109
|
class Printer(abc.ABC):
|
68
110
|
"""An object that shows styled text to the user."""
|
@@ -485,15 +527,9 @@ class _PrinterJupyter(Printer):
|
|
485
527
|
grid = f'<table class="wandb">{grid}</table>'
|
486
528
|
if title:
|
487
529
|
return f"<h3>{title}</h3><br/>{grid}<br/>"
|
488
|
-
return f"{grid}<br/>"
|
530
|
+
return f"{_JUPYTER_TABLE_STYLES}{grid}<br/>"
|
489
531
|
|
490
532
|
@override
|
491
533
|
def panel(self, columns: list[str]) -> str:
|
492
534
|
row = "".join([f'<div class="wandb-col">{col}</div>' for col in columns])
|
493
|
-
return f'{
|
494
|
-
|
495
|
-
|
496
|
-
def get_printer(jupyter: bool) -> Printer:
|
497
|
-
if jupyter:
|
498
|
-
return _PrinterJupyter()
|
499
|
-
return _PrinterTerm()
|
535
|
+
return f'{_JUPYTER_PANEL_STYLES}<div class="wandb-row">{row}</div>'
|
wandb/sdk/lib/retry.py
CHANGED
@@ -94,7 +94,7 @@ class Retry(Generic[_R]):
|
|
94
94
|
def __call__(self, *args: Any, **kwargs: Any) -> _R: # noqa: C901
|
95
95
|
"""Call the wrapped function, with retries.
|
96
96
|
|
97
|
-
|
97
|
+
Args:
|
98
98
|
retry_timedelta (kwarg): amount of time to retry before giving up.
|
99
99
|
sleep_base (kwarg): amount of time to sleep upon first failure, all other sleeps
|
100
100
|
are derived from this one.
|
wandb/sdk/lib/sock_client.py
CHANGED
@@ -7,8 +7,6 @@ from typing import TYPE_CHECKING, Any, List, Optional
|
|
7
7
|
|
8
8
|
from wandb.proto import wandb_server_pb2 as spb
|
9
9
|
|
10
|
-
from . import tracelog
|
11
|
-
|
12
10
|
if TYPE_CHECKING:
|
13
11
|
from wandb.proto import wandb_internal_pb2 as pb
|
14
12
|
|
@@ -145,7 +143,6 @@ class SockClient:
|
|
145
143
|
time.sleep(self._retry_delay - delta_time)
|
146
144
|
|
147
145
|
def _send_message(self, msg: Any) -> None:
|
148
|
-
tracelog.log_message_send(msg, self._sockid)
|
149
146
|
raw_size = msg.ByteSize()
|
150
147
|
data = msg.SerializeToString()
|
151
148
|
assert len(data) == raw_size, "invalid serialization"
|
@@ -280,7 +277,6 @@ class SockClient:
|
|
280
277
|
return None
|
281
278
|
rec = spb.ServerRequest()
|
282
279
|
rec.ParseFromString(data)
|
283
|
-
tracelog.log_message_recv(rec, self._sockid)
|
284
280
|
return rec
|
285
281
|
|
286
282
|
def read_server_response(
|
@@ -291,5 +287,4 @@ class SockClient:
|
|
291
287
|
return None
|
292
288
|
rec = spb.ServerResponse()
|
293
289
|
rec.ParseFromString(data)
|
294
|
-
tracelog.log_message_recv(rec, self._sockid)
|
295
290
|
return rec
|
wandb/sdk/service/server.py
CHANGED
@@ -10,7 +10,6 @@ from typing import Optional
|
|
10
10
|
|
11
11
|
import wandb
|
12
12
|
|
13
|
-
from ..lib import tracelog
|
14
13
|
from . import _startup_debug, port_file
|
15
14
|
from .server_sock import SocketServer
|
16
15
|
from .streams import StreamMux
|
@@ -69,21 +68,14 @@ class WandbServer:
|
|
69
68
|
if self._sock_server:
|
70
69
|
self._sock_server.stop()
|
71
70
|
|
72
|
-
def _setup_tracelog(self) -> None:
|
73
|
-
# TODO: remove this temporary hack, need to find a better way to pass settings
|
74
|
-
# to the server. for now lets just look at the environment variable we need
|
75
|
-
tracelog_mode = os.environ.get("WANDB_TRACELOG")
|
76
|
-
if tracelog_mode:
|
77
|
-
tracelog.enable(tracelog_mode)
|
78
|
-
|
79
71
|
def _startup_debug_print(self, message: str) -> None:
|
80
72
|
if not self._startup_debug_enabled:
|
81
73
|
return
|
82
74
|
_startup_debug.print_message(message)
|
83
75
|
|
84
76
|
def _setup_proctitle(self, sock_port: Optional[int]) -> None:
|
85
|
-
# TODO:
|
86
|
-
#
|
77
|
+
# TODO: the internal_process should have a better way to have access to
|
78
|
+
# settings.
|
87
79
|
disable_setproctitle = os.environ.get("WANDB__DISABLE_SETPROCTITLE")
|
88
80
|
if disable_setproctitle:
|
89
81
|
return
|
@@ -103,7 +95,6 @@ class WandbServer:
|
|
103
95
|
self._startup_debug_print("after_setproctitle")
|
104
96
|
|
105
97
|
def serve(self) -> None:
|
106
|
-
self._setup_tracelog()
|
107
98
|
mux = StreamMux()
|
108
99
|
self._startup_debug_print("before_network")
|
109
100
|
sock_port = self._start_sock(mux=mux)
|
wandb/sdk/service/server_sock.py
CHANGED
@@ -7,7 +7,6 @@ from typing import TYPE_CHECKING, Any, Callable, Dict, Optional
|
|
7
7
|
from wandb.proto import wandb_server_pb2 as spb
|
8
8
|
from wandb.sdk.internal.settings_static import SettingsStatic
|
9
9
|
|
10
|
-
from ..lib import tracelog
|
11
10
|
from ..lib.sock_client import SockClient, SockClientClosedError
|
12
11
|
from .streams import StreamMux
|
13
12
|
|
@@ -65,7 +64,6 @@ class SockServerInterfaceReaderThread(threading.Thread):
|
|
65
64
|
except ValueError:
|
66
65
|
# queue is closed
|
67
66
|
break
|
68
|
-
tracelog.log_message_dequeue(result, self._iface.relay_q)
|
69
67
|
sockid = result.control.relay_id
|
70
68
|
assert sockid
|
71
69
|
sock_client = self._clients.get_client(sockid)
|
wandb/sdk/service/service.py
CHANGED
@@ -17,7 +17,7 @@ from typing import TYPE_CHECKING, Any, Dict, Optional
|
|
17
17
|
from wandb import _sentry, termlog
|
18
18
|
from wandb.env import core_debug, error_reporting_enabled, is_require_legacy_service
|
19
19
|
from wandb.errors import Error, WandbCoreNotAvailableError
|
20
|
-
from wandb.
|
20
|
+
from wandb.errors.links import url_registry
|
21
21
|
from wandb.util import get_core_path, get_module
|
22
22
|
|
23
23
|
from . import _startup_debug, port_file
|
@@ -164,8 +164,8 @@ class _Service:
|
|
164
164
|
|
165
165
|
exec_cmd_list = []
|
166
166
|
termlog(
|
167
|
-
"Using wandb-core as the SDK backend."
|
168
|
-
f"
|
167
|
+
"Using wandb-core as the SDK backend. Please refer to "
|
168
|
+
f"{url_registry.url('wandb-core')} for more information.",
|
169
169
|
repeat=False,
|
170
170
|
)
|
171
171
|
else:
|
wandb/sdk/service/streams.py
CHANGED
@@ -20,6 +20,7 @@ import wandb
|
|
20
20
|
import wandb.util
|
21
21
|
from wandb.proto import wandb_internal_pb2 as pb
|
22
22
|
from wandb.sdk.internal.settings_static import SettingsStatic
|
23
|
+
from wandb.sdk.lib import printer as printerlib
|
23
24
|
from wandb.sdk.lib import progress
|
24
25
|
from wandb.sdk.lib.mailbox import (
|
25
26
|
Mailbox,
|
@@ -27,7 +28,6 @@ from wandb.sdk.lib.mailbox import (
|
|
27
28
|
MailboxProgress,
|
28
29
|
MailboxProgressAll,
|
29
30
|
)
|
30
|
-
from wandb.sdk.lib.printer import get_printer
|
31
31
|
from wandb.sdk.wandb_run import Run
|
32
32
|
|
33
33
|
from ..interface.interface_relay import InterfaceRelay
|
@@ -285,9 +285,7 @@ class StreamMux:
|
|
285
285
|
if not streams:
|
286
286
|
return
|
287
287
|
|
288
|
-
printer =
|
289
|
-
all(stream._settings._jupyter for stream in streams.values())
|
290
|
-
)
|
288
|
+
printer = printerlib.new_printer()
|
291
289
|
|
292
290
|
# fixme: for now we have a single printer for all streams,
|
293
291
|
# and jupyter is disabled if at least single stream's setting set `_jupyter` to false
|