wandb 0.15.9__py3-none-any.whl → 0.15.11__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +5 -1
- wandb/apis/public.py +137 -17
- wandb/apis/reports/_panels.py +1 -1
- wandb/apis/reports/blocks.py +1 -0
- wandb/apis/reports/report.py +27 -5
- wandb/cli/cli.py +52 -41
- wandb/docker/__init__.py +17 -0
- wandb/docker/auth.py +1 -1
- wandb/env.py +24 -4
- wandb/filesync/step_checksum.py +3 -3
- wandb/integration/openai/openai.py +3 -0
- wandb/integration/ultralytics/__init__.py +9 -0
- wandb/integration/ultralytics/bbox_utils.py +196 -0
- wandb/integration/ultralytics/callback.py +458 -0
- wandb/integration/ultralytics/classification_utils.py +66 -0
- wandb/integration/ultralytics/mask_utils.py +141 -0
- wandb/integration/ultralytics/pose_utils.py +92 -0
- wandb/integration/xgboost/xgboost.py +3 -3
- wandb/integration/yolov8/__init__.py +0 -7
- wandb/integration/yolov8/yolov8.py +22 -3
- wandb/old/settings.py +7 -0
- wandb/plot/line_series.py +0 -1
- wandb/proto/v3/wandb_internal_pb2.py +353 -300
- wandb/proto/v3/wandb_server_pb2.py +37 -41
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +16 -16
- wandb/proto/v4/wandb_internal_pb2.py +272 -260
- wandb/proto/v4/wandb_server_pb2.py +37 -40
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +16 -16
- wandb/proto/wandb_internal_codegen.py +7 -31
- wandb/sdk/artifacts/artifact.py +321 -189
- wandb/sdk/artifacts/artifact_cache.py +14 -0
- wandb/sdk/artifacts/artifact_manifest.py +5 -4
- wandb/sdk/artifacts/artifact_manifest_entry.py +37 -9
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +1 -9
- wandb/sdk/artifacts/artifact_saver.py +13 -50
- wandb/sdk/artifacts/artifact_ttl.py +6 -0
- wandb/sdk/artifacts/artifacts_cache.py +119 -93
- wandb/sdk/artifacts/staging.py +25 -0
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +12 -7
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +2 -3
- wandb/sdk/artifacts/storage_policies/__init__.py +4 -0
- wandb/sdk/artifacts/storage_policies/register.py +1 -0
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +4 -3
- wandb/sdk/artifacts/storage_policy.py +4 -2
- wandb/sdk/backend/backend.py +0 -16
- wandb/sdk/data_types/image.py +3 -1
- wandb/sdk/integration_utils/auto_logging.py +38 -13
- wandb/sdk/interface/interface.py +16 -135
- wandb/sdk/interface/interface_shared.py +9 -147
- wandb/sdk/interface/interface_sock.py +0 -26
- wandb/sdk/internal/file_pusher.py +20 -3
- wandb/sdk/internal/file_stream.py +3 -1
- wandb/sdk/internal/handler.py +53 -70
- wandb/sdk/internal/internal_api.py +220 -130
- wandb/sdk/internal/job_builder.py +41 -37
- wandb/sdk/internal/sender.py +7 -25
- wandb/sdk/internal/system/assets/disk.py +144 -11
- wandb/sdk/internal/system/system_info.py +6 -2
- wandb/sdk/launch/__init__.py +5 -0
- wandb/sdk/launch/{launch.py → _launch.py} +53 -54
- wandb/sdk/launch/{launch_add.py → _launch_add.py} +34 -31
- wandb/sdk/launch/_project_spec.py +13 -2
- wandb/sdk/launch/agent/agent.py +103 -59
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +6 -4
- wandb/sdk/launch/builder/build.py +19 -1
- wandb/sdk/launch/builder/docker_builder.py +5 -1
- wandb/sdk/launch/builder/kaniko_builder.py +5 -1
- wandb/sdk/launch/create_job.py +20 -5
- wandb/sdk/launch/loader.py +14 -5
- wandb/sdk/launch/runner/abstract.py +0 -2
- wandb/sdk/launch/runner/kubernetes_monitor.py +329 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +66 -209
- wandb/sdk/launch/runner/local_container.py +5 -2
- wandb/sdk/launch/runner/local_process.py +4 -1
- wandb/sdk/launch/sweeps/scheduler.py +43 -25
- wandb/sdk/launch/sweeps/utils.py +5 -3
- wandb/sdk/launch/utils.py +3 -1
- wandb/sdk/lib/_settings_toposort_generate.py +3 -9
- wandb/sdk/lib/_settings_toposort_generated.py +27 -3
- wandb/sdk/lib/_wburls_generated.py +1 -0
- wandb/sdk/lib/filenames.py +27 -6
- wandb/sdk/lib/filesystem.py +181 -7
- wandb/sdk/lib/fsm.py +5 -3
- wandb/sdk/lib/gql_request.py +3 -0
- wandb/sdk/lib/ipython.py +7 -0
- wandb/sdk/lib/wburls.py +1 -0
- wandb/sdk/service/port_file.py +2 -15
- wandb/sdk/service/server.py +7 -55
- wandb/sdk/service/service.py +56 -26
- wandb/sdk/service/service_base.py +1 -1
- wandb/sdk/service/streams.py +11 -5
- wandb/sdk/verify/verify.py +2 -2
- wandb/sdk/wandb_init.py +8 -2
- wandb/sdk/wandb_manager.py +4 -14
- wandb/sdk/wandb_run.py +143 -53
- wandb/sdk/wandb_settings.py +148 -35
- wandb/testing/relay.py +85 -38
- wandb/util.py +87 -4
- wandb/wandb_torch.py +24 -38
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/METADATA +48 -23
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/RECORD +107 -103
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/WHEEL +1 -1
- wandb/proto/v3/wandb_server_pb2_grpc.py +0 -1422
- wandb/proto/v4/wandb_server_pb2_grpc.py +0 -1422
- wandb/proto/wandb_server_pb2_grpc.py +0 -8
- wandb/sdk/artifacts/storage_policies/s3_bucket_policy.py +0 -61
- wandb/sdk/interface/interface_grpc.py +0 -460
- wandb/sdk/service/server_grpc.py +0 -444
- wandb/sdk/service/service_grpc.py +0 -73
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/LICENSE +0 -0
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/entry_points.txt +0 -0
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
from typing import Any, Optional
|
2
|
+
|
3
|
+
import numpy as np
|
4
|
+
from PIL import Image
|
5
|
+
from ultralytics.engine.results import Results
|
6
|
+
from ultralytics.models.yolo.pose import PosePredictor
|
7
|
+
from ultralytics.utils.plotting import Annotator
|
8
|
+
|
9
|
+
import wandb
|
10
|
+
|
11
|
+
from .bbox_utils import get_boxes, get_ground_truth_bbox_annotations
|
12
|
+
|
13
|
+
|
14
|
+
def annotate_keypoint_results(result: Results, visualize_skeleton: bool):
|
15
|
+
annotator = Annotator(np.ascontiguousarray(result.orig_img[:, :, ::-1]))
|
16
|
+
key_points = result.keypoints.data.numpy()
|
17
|
+
for idx in range(key_points.shape[0]):
|
18
|
+
annotator.kpts(key_points[idx], kpt_line=visualize_skeleton)
|
19
|
+
return annotator.im
|
20
|
+
|
21
|
+
|
22
|
+
def annotate_keypoint_batch(image_path: str, keypoints: Any, visualize_skeleton: bool):
|
23
|
+
original_image = None
|
24
|
+
with Image.open(image_path) as original_image:
|
25
|
+
original_image = np.ascontiguousarray(original_image)
|
26
|
+
annotator = Annotator(original_image)
|
27
|
+
annotator.kpts(keypoints.numpy(), kpt_line=visualize_skeleton)
|
28
|
+
return annotator.im
|
29
|
+
|
30
|
+
|
31
|
+
def plot_pose_predictions(
|
32
|
+
result: Results,
|
33
|
+
model_name: str,
|
34
|
+
visualize_skeleton: bool,
|
35
|
+
table: Optional[wandb.Table] = None,
|
36
|
+
):
|
37
|
+
result = result.to("cpu")
|
38
|
+
boxes, mean_confidence_map = get_boxes(result)
|
39
|
+
prediction_image = wandb.Image(
|
40
|
+
annotate_keypoint_results(result, visualize_skeleton), boxes=boxes
|
41
|
+
)
|
42
|
+
table_row = [
|
43
|
+
model_name,
|
44
|
+
prediction_image,
|
45
|
+
len(boxes["predictions"]["box_data"]),
|
46
|
+
mean_confidence_map,
|
47
|
+
result.speed,
|
48
|
+
]
|
49
|
+
if table is not None:
|
50
|
+
table.add_data(*table_row)
|
51
|
+
return table
|
52
|
+
return table_row
|
53
|
+
|
54
|
+
|
55
|
+
def plot_pose_validation_results(
|
56
|
+
dataloader,
|
57
|
+
class_label_map,
|
58
|
+
model_name: str,
|
59
|
+
predictor: PosePredictor,
|
60
|
+
visualize_skeleton: bool,
|
61
|
+
table: wandb.Table,
|
62
|
+
max_validation_batches: int,
|
63
|
+
epoch: Optional[int] = None,
|
64
|
+
) -> wandb.Table:
|
65
|
+
data_idx = 0
|
66
|
+
for batch_idx, batch in enumerate(dataloader):
|
67
|
+
for img_idx, image_path in enumerate(batch["im_file"]):
|
68
|
+
prediction_result = predictor(image_path)[0].to("cpu")
|
69
|
+
table_row = plot_pose_predictions(
|
70
|
+
prediction_result, model_name, visualize_skeleton
|
71
|
+
)
|
72
|
+
ground_truth_image = wandb.Image(
|
73
|
+
annotate_keypoint_batch(
|
74
|
+
image_path, batch["keypoints"][img_idx], visualize_skeleton
|
75
|
+
),
|
76
|
+
boxes={
|
77
|
+
"ground-truth": {
|
78
|
+
"box_data": get_ground_truth_bbox_annotations(
|
79
|
+
img_idx, image_path, batch, class_label_map
|
80
|
+
),
|
81
|
+
"class_labels": class_label_map,
|
82
|
+
},
|
83
|
+
},
|
84
|
+
)
|
85
|
+
table_row = [data_idx, batch_idx, ground_truth_image] + table_row[1:]
|
86
|
+
table_row = [epoch] + table_row if epoch is not None else table_row
|
87
|
+
table_row = [model_name] + table_row
|
88
|
+
table.add_data(*table_row)
|
89
|
+
data_idx += 1
|
90
|
+
if batch_idx + 1 == max_validation_batches:
|
91
|
+
break
|
92
|
+
return table
|
@@ -64,10 +64,10 @@ class WandbCallback(xgb.callback.TrainingCallback):
|
|
64
64
|
Passing `WandbCallback` to XGBoost will:
|
65
65
|
|
66
66
|
- log the booster model configuration to Weights & Biases
|
67
|
-
- log evaluation metrics collected by XGBoost, such as rmse, accuracy etc to Weights & Biases
|
67
|
+
- log evaluation metrics collected by XGBoost, such as rmse, accuracy etc. to Weights & Biases
|
68
68
|
- log training metric collected by XGBoost (if you provide training data to eval_set)
|
69
69
|
- log the best score and the best iteration
|
70
|
-
- save and upload your trained model to
|
70
|
+
- save and upload your trained model to Weights & Biases Artifacts (when `log_model = True`)
|
71
71
|
- log feature importance plot when `log_feature_importance=True` (default).
|
72
72
|
- Capture the best eval metric in `wandb.summary` when `define_metric=True` (default).
|
73
73
|
|
@@ -81,6 +81,7 @@ class WandbCallback(xgb.callback.TrainingCallback):
|
|
81
81
|
alpha=10,
|
82
82
|
n_estimators=10,
|
83
83
|
tree_method="hist",
|
84
|
+
callbacks=[WandbCallback()],
|
84
85
|
)
|
85
86
|
|
86
87
|
xg_reg = xgb.XGBRegressor(**bst_params)
|
@@ -88,7 +89,6 @@ class WandbCallback(xgb.callback.TrainingCallback):
|
|
88
89
|
X_train,
|
89
90
|
y_train,
|
90
91
|
eval_set=[(X_test, y_test)],
|
91
|
-
callbacks=[WandbCallback()],
|
92
92
|
)
|
93
93
|
```
|
94
94
|
"""
|
@@ -16,8 +16,11 @@ class WandbCallback:
|
|
16
16
|
Usage:
|
17
17
|
```python
|
18
18
|
from wandb.integration.yolov8.yolov8 import WandbCallback
|
19
|
+
|
19
20
|
model = YOLO("yolov8n.pt")
|
20
|
-
wandb_logger = WandbCallback(
|
21
|
+
wandb_logger = WandbCallback(
|
22
|
+
model,
|
23
|
+
)
|
21
24
|
for event, callback_fn in wandb_logger.callbacks.items():
|
22
25
|
model.add_callback(event, callback_fn)
|
23
26
|
```
|
@@ -222,9 +225,16 @@ def add_callbacks(
|
|
222
225
|
Usage:
|
223
226
|
```python
|
224
227
|
from wandb.integration.yolov8 import add_callbacks as add_wandb_callbacks
|
228
|
+
|
225
229
|
model = YOLO("yolov8n.pt")
|
226
|
-
add_wandb_callbacks(
|
227
|
-
|
230
|
+
add_wandb_callbacks(
|
231
|
+
model,
|
232
|
+
)
|
233
|
+
model.train(
|
234
|
+
data="coco128.yaml",
|
235
|
+
epochs=3,
|
236
|
+
imgsz=640,
|
237
|
+
)
|
228
238
|
```
|
229
239
|
"""
|
230
240
|
wandb.termwarn(
|
@@ -234,6 +244,15 @@ def add_callbacks(
|
|
234
244
|
""",
|
235
245
|
repeat=False,
|
236
246
|
)
|
247
|
+
wandb.termwarn(
|
248
|
+
"""This wandb callback is no longer functional and would be deprecated in the near future.
|
249
|
+
We recommend you to use the updated callback using `from wandb.integration.ultralytics import add_wandb_callback`.
|
250
|
+
The updated callback is tested and supported for ultralytics 8.0.167 and above.
|
251
|
+
You can refer to https://docs.wandb.ai/guides/integrations/ultralytics for the updated documentation.
|
252
|
+
Please report any issues to https://github.com/wandb/wandb/issues with the tag `yolov8`.
|
253
|
+
""",
|
254
|
+
repeat=False,
|
255
|
+
)
|
237
256
|
|
238
257
|
if RANK in [-1, 0]:
|
239
258
|
wandb_logger = WandbCallback(
|
wandb/old/settings.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import configparser
|
2
|
+
import getpass
|
2
3
|
import os
|
3
4
|
import tempfile
|
4
5
|
from typing import Any, Optional
|
@@ -124,6 +125,12 @@ class Settings:
|
|
124
125
|
# if not writable, fall back to a temp directory
|
125
126
|
if not os.access(default_config_dir, os.W_OK):
|
126
127
|
default_config_dir = os.path.join(tempfile.gettempdir(), ".config", "wandb")
|
128
|
+
# if not writable (if tempdir is shared, for example), try creating a subdir
|
129
|
+
if not os.access(default_config_dir, os.W_OK):
|
130
|
+
username = getpass.getuser()
|
131
|
+
default_config_dir = os.path.join(
|
132
|
+
tempfile.gettempdir(), username, ".config", "wandb"
|
133
|
+
)
|
127
134
|
|
128
135
|
config_dir = os.environ.get(env.CONFIG_DIR, default_config_dir)
|
129
136
|
os.makedirs(config_dir, exist_ok=True)
|