wandb 0.18.0__py3-none-any.whl → 0.18.1__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.
- wandb/__init__.py +2 -2
- wandb/__init__.pyi +1 -1
- wandb/apis/public/runs.py +2 -0
- wandb/bin/nvidia_gpu_stats +0 -0
- wandb/cli/cli.py +0 -2
- wandb/data_types.py +9 -2019
- wandb/env.py +0 -5
- wandb/{sklearn → integration/sklearn}/calculate/calibration_curves.py +7 -7
- wandb/{sklearn → integration/sklearn}/calculate/class_proportions.py +1 -1
- wandb/{sklearn → integration/sklearn}/calculate/confusion_matrix.py +3 -2
- wandb/{sklearn → integration/sklearn}/calculate/elbow_curve.py +6 -6
- wandb/{sklearn → integration/sklearn}/calculate/learning_curve.py +2 -2
- wandb/{sklearn → integration/sklearn}/calculate/outlier_candidates.py +2 -2
- wandb/{sklearn → integration/sklearn}/calculate/residuals.py +8 -8
- wandb/{sklearn → integration/sklearn}/calculate/silhouette.py +2 -2
- wandb/{sklearn → integration/sklearn}/calculate/summary_metrics.py +2 -2
- wandb/{sklearn → integration/sklearn}/plot/classifier.py +5 -5
- wandb/{sklearn → integration/sklearn}/plot/clusterer.py +10 -6
- wandb/{sklearn → integration/sklearn}/plot/regressor.py +5 -5
- wandb/{sklearn → integration/sklearn}/plot/shared.py +3 -3
- wandb/{sklearn → integration/sklearn}/utils.py +8 -8
- wandb/{wandb_torch.py → integration/torch/wandb_torch.py} +36 -32
- wandb/proto/v3/wandb_base_pb2.py +2 -1
- wandb/proto/v3/wandb_internal_pb2.py +2 -1
- wandb/proto/v3/wandb_server_pb2.py +2 -1
- wandb/proto/v3/wandb_settings_pb2.py +2 -1
- wandb/proto/v3/wandb_telemetry_pb2.py +2 -1
- wandb/proto/v4/wandb_base_pb2.py +2 -1
- wandb/proto/v4/wandb_internal_pb2.py +2 -1
- wandb/proto/v4/wandb_server_pb2.py +2 -1
- wandb/proto/v4/wandb_settings_pb2.py +2 -1
- wandb/proto/v4/wandb_telemetry_pb2.py +2 -1
- wandb/proto/v5/wandb_base_pb2.py +3 -2
- wandb/proto/v5/wandb_internal_pb2.py +3 -2
- wandb/proto/v5/wandb_server_pb2.py +3 -2
- wandb/proto/v5/wandb_settings_pb2.py +3 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +3 -2
- wandb/sdk/data_types/audio.py +165 -0
- wandb/sdk/data_types/bokeh.py +70 -0
- wandb/sdk/data_types/graph.py +405 -0
- wandb/sdk/data_types/image.py +156 -0
- wandb/sdk/data_types/table.py +1204 -0
- wandb/sdk/data_types/trace_tree.py +2 -2
- wandb/sdk/data_types/utils.py +49 -0
- wandb/sdk/service/service.py +2 -9
- wandb/sdk/service/streams.py +0 -7
- wandb/sdk/wandb_init.py +10 -3
- wandb/sdk/wandb_run.py +6 -152
- wandb/sdk/wandb_setup.py +1 -1
- wandb/sklearn.py +35 -0
- wandb/util.py +6 -2
- {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/METADATA +1 -1
- {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/RECORD +61 -57
- wandb/sdk/lib/console.py +0 -39
- /wandb/{sklearn → integration/sklearn}/__init__.py +0 -0
- /wandb/{sklearn → integration/sklearn}/calculate/__init__.py +0 -0
- /wandb/{sklearn → integration/sklearn}/calculate/decision_boundaries.py +0 -0
- /wandb/{sklearn → integration/sklearn}/calculate/feature_importances.py +0 -0
- /wandb/{sklearn → integration/sklearn}/plot/__init__.py +0 -0
- {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/WHEEL +0 -0
- {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/data_types/image.py
CHANGED
@@ -10,6 +10,7 @@ from wandb import util
|
|
10
10
|
from wandb.sdk.lib import hashutil, runid
|
11
11
|
from wandb.sdk.lib.paths import LogicalPath
|
12
12
|
|
13
|
+
from . import _dtypes
|
13
14
|
from ._private import MEDIA_TMP
|
14
15
|
from .base_types.media import BatchableMedia, Media
|
15
16
|
from .helper_types.bounding_boxes_2d import BoundingBoxes2D
|
@@ -687,3 +688,158 @@ class Image(BatchableMedia):
|
|
687
688
|
self._image = pil_image.open(self._path)
|
688
689
|
self._image.load()
|
689
690
|
return self._image
|
691
|
+
|
692
|
+
|
693
|
+
# Custom dtypes for typing system
|
694
|
+
class _ImageFileType(_dtypes.Type):
|
695
|
+
name = "image-file"
|
696
|
+
legacy_names = ["wandb.Image"]
|
697
|
+
types = [Image]
|
698
|
+
|
699
|
+
def __init__(
|
700
|
+
self,
|
701
|
+
box_layers=None,
|
702
|
+
box_score_keys=None,
|
703
|
+
mask_layers=None,
|
704
|
+
class_map=None,
|
705
|
+
**kwargs,
|
706
|
+
):
|
707
|
+
box_layers = box_layers or {}
|
708
|
+
box_score_keys = box_score_keys or []
|
709
|
+
mask_layers = mask_layers or {}
|
710
|
+
class_map = class_map or {}
|
711
|
+
|
712
|
+
if isinstance(box_layers, _dtypes.ConstType):
|
713
|
+
box_layers = box_layers._params["val"]
|
714
|
+
if not isinstance(box_layers, dict):
|
715
|
+
raise TypeError("box_layers must be a dict")
|
716
|
+
else:
|
717
|
+
box_layers = _dtypes.ConstType(
|
718
|
+
{layer_key: set(box_layers[layer_key]) for layer_key in box_layers}
|
719
|
+
)
|
720
|
+
|
721
|
+
if isinstance(mask_layers, _dtypes.ConstType):
|
722
|
+
mask_layers = mask_layers._params["val"]
|
723
|
+
if not isinstance(mask_layers, dict):
|
724
|
+
raise TypeError("mask_layers must be a dict")
|
725
|
+
else:
|
726
|
+
mask_layers = _dtypes.ConstType(
|
727
|
+
{layer_key: set(mask_layers[layer_key]) for layer_key in mask_layers}
|
728
|
+
)
|
729
|
+
|
730
|
+
if isinstance(box_score_keys, _dtypes.ConstType):
|
731
|
+
box_score_keys = box_score_keys._params["val"]
|
732
|
+
if not isinstance(box_score_keys, list) and not isinstance(box_score_keys, set):
|
733
|
+
raise TypeError("box_score_keys must be a list or a set")
|
734
|
+
else:
|
735
|
+
box_score_keys = _dtypes.ConstType(set(box_score_keys))
|
736
|
+
|
737
|
+
if isinstance(class_map, _dtypes.ConstType):
|
738
|
+
class_map = class_map._params["val"]
|
739
|
+
if not isinstance(class_map, dict):
|
740
|
+
raise TypeError("class_map must be a dict")
|
741
|
+
else:
|
742
|
+
class_map = _dtypes.ConstType(class_map)
|
743
|
+
|
744
|
+
self.params.update(
|
745
|
+
{
|
746
|
+
"box_layers": box_layers,
|
747
|
+
"box_score_keys": box_score_keys,
|
748
|
+
"mask_layers": mask_layers,
|
749
|
+
"class_map": class_map,
|
750
|
+
}
|
751
|
+
)
|
752
|
+
|
753
|
+
def assign_type(self, wb_type=None):
|
754
|
+
if isinstance(wb_type, _ImageFileType):
|
755
|
+
box_layers_self = self.params["box_layers"].params["val"] or {}
|
756
|
+
box_score_keys_self = self.params["box_score_keys"].params["val"] or []
|
757
|
+
mask_layers_self = self.params["mask_layers"].params["val"] or {}
|
758
|
+
class_map_self = self.params["class_map"].params["val"] or {}
|
759
|
+
|
760
|
+
box_layers_other = wb_type.params["box_layers"].params["val"] or {}
|
761
|
+
box_score_keys_other = wb_type.params["box_score_keys"].params["val"] or []
|
762
|
+
mask_layers_other = wb_type.params["mask_layers"].params["val"] or {}
|
763
|
+
class_map_other = wb_type.params["class_map"].params["val"] or {}
|
764
|
+
|
765
|
+
# Merge the class_ids from each set of box_layers
|
766
|
+
box_layers = {
|
767
|
+
str(key): set(
|
768
|
+
list(box_layers_self.get(key, []))
|
769
|
+
+ list(box_layers_other.get(key, []))
|
770
|
+
)
|
771
|
+
for key in set(
|
772
|
+
list(box_layers_self.keys()) + list(box_layers_other.keys())
|
773
|
+
)
|
774
|
+
}
|
775
|
+
|
776
|
+
# Merge the class_ids from each set of mask_layers
|
777
|
+
mask_layers = {
|
778
|
+
str(key): set(
|
779
|
+
list(mask_layers_self.get(key, []))
|
780
|
+
+ list(mask_layers_other.get(key, []))
|
781
|
+
)
|
782
|
+
for key in set(
|
783
|
+
list(mask_layers_self.keys()) + list(mask_layers_other.keys())
|
784
|
+
)
|
785
|
+
}
|
786
|
+
|
787
|
+
# Merge the box score keys
|
788
|
+
box_score_keys = set(list(box_score_keys_self) + list(box_score_keys_other))
|
789
|
+
|
790
|
+
# Merge the class_map
|
791
|
+
class_map = {
|
792
|
+
str(key): class_map_self.get(key, class_map_other.get(key, None))
|
793
|
+
for key in set(
|
794
|
+
list(class_map_self.keys()) + list(class_map_other.keys())
|
795
|
+
)
|
796
|
+
}
|
797
|
+
|
798
|
+
return _ImageFileType(box_layers, box_score_keys, mask_layers, class_map)
|
799
|
+
|
800
|
+
return _dtypes.InvalidType()
|
801
|
+
|
802
|
+
@classmethod
|
803
|
+
def from_obj(cls, py_obj):
|
804
|
+
if not isinstance(py_obj, Image):
|
805
|
+
raise TypeError("py_obj must be a wandb.Image")
|
806
|
+
else:
|
807
|
+
if hasattr(py_obj, "_boxes") and py_obj._boxes:
|
808
|
+
box_layers = {
|
809
|
+
str(key): set(py_obj._boxes[key]._class_labels.keys())
|
810
|
+
for key in py_obj._boxes.keys()
|
811
|
+
}
|
812
|
+
box_score_keys = {
|
813
|
+
key
|
814
|
+
for val in py_obj._boxes.values()
|
815
|
+
for box in val._val
|
816
|
+
for key in box.get("scores", {}).keys()
|
817
|
+
}
|
818
|
+
|
819
|
+
else:
|
820
|
+
box_layers = {}
|
821
|
+
box_score_keys = set()
|
822
|
+
|
823
|
+
if hasattr(py_obj, "_masks") and py_obj._masks:
|
824
|
+
mask_layers = {
|
825
|
+
str(key): set(
|
826
|
+
py_obj._masks[key]._val["class_labels"].keys()
|
827
|
+
if hasattr(py_obj._masks[key], "_val")
|
828
|
+
else []
|
829
|
+
)
|
830
|
+
for key in py_obj._masks.keys()
|
831
|
+
}
|
832
|
+
else:
|
833
|
+
mask_layers = {}
|
834
|
+
|
835
|
+
if hasattr(py_obj, "_classes") and py_obj._classes:
|
836
|
+
class_set = {
|
837
|
+
str(item["id"]): item["name"] for item in py_obj._classes._class_set
|
838
|
+
}
|
839
|
+
else:
|
840
|
+
class_set = {}
|
841
|
+
|
842
|
+
return cls(box_layers, box_score_keys, mask_layers, class_set)
|
843
|
+
|
844
|
+
|
845
|
+
_dtypes.TypeRegistry.add(_ImageFileType)
|