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.
Files changed (62) hide show
  1. wandb/__init__.py +2 -2
  2. wandb/__init__.pyi +1 -1
  3. wandb/apis/public/runs.py +2 -0
  4. wandb/bin/nvidia_gpu_stats +0 -0
  5. wandb/cli/cli.py +0 -2
  6. wandb/data_types.py +9 -2019
  7. wandb/env.py +0 -5
  8. wandb/{sklearn → integration/sklearn}/calculate/calibration_curves.py +7 -7
  9. wandb/{sklearn → integration/sklearn}/calculate/class_proportions.py +1 -1
  10. wandb/{sklearn → integration/sklearn}/calculate/confusion_matrix.py +3 -2
  11. wandb/{sklearn → integration/sklearn}/calculate/elbow_curve.py +6 -6
  12. wandb/{sklearn → integration/sklearn}/calculate/learning_curve.py +2 -2
  13. wandb/{sklearn → integration/sklearn}/calculate/outlier_candidates.py +2 -2
  14. wandb/{sklearn → integration/sklearn}/calculate/residuals.py +8 -8
  15. wandb/{sklearn → integration/sklearn}/calculate/silhouette.py +2 -2
  16. wandb/{sklearn → integration/sklearn}/calculate/summary_metrics.py +2 -2
  17. wandb/{sklearn → integration/sklearn}/plot/classifier.py +5 -5
  18. wandb/{sklearn → integration/sklearn}/plot/clusterer.py +10 -6
  19. wandb/{sklearn → integration/sklearn}/plot/regressor.py +5 -5
  20. wandb/{sklearn → integration/sklearn}/plot/shared.py +3 -3
  21. wandb/{sklearn → integration/sklearn}/utils.py +8 -8
  22. wandb/{wandb_torch.py → integration/torch/wandb_torch.py} +36 -32
  23. wandb/proto/v3/wandb_base_pb2.py +2 -1
  24. wandb/proto/v3/wandb_internal_pb2.py +2 -1
  25. wandb/proto/v3/wandb_server_pb2.py +2 -1
  26. wandb/proto/v3/wandb_settings_pb2.py +2 -1
  27. wandb/proto/v3/wandb_telemetry_pb2.py +2 -1
  28. wandb/proto/v4/wandb_base_pb2.py +2 -1
  29. wandb/proto/v4/wandb_internal_pb2.py +2 -1
  30. wandb/proto/v4/wandb_server_pb2.py +2 -1
  31. wandb/proto/v4/wandb_settings_pb2.py +2 -1
  32. wandb/proto/v4/wandb_telemetry_pb2.py +2 -1
  33. wandb/proto/v5/wandb_base_pb2.py +3 -2
  34. wandb/proto/v5/wandb_internal_pb2.py +3 -2
  35. wandb/proto/v5/wandb_server_pb2.py +3 -2
  36. wandb/proto/v5/wandb_settings_pb2.py +3 -2
  37. wandb/proto/v5/wandb_telemetry_pb2.py +3 -2
  38. wandb/sdk/data_types/audio.py +165 -0
  39. wandb/sdk/data_types/bokeh.py +70 -0
  40. wandb/sdk/data_types/graph.py +405 -0
  41. wandb/sdk/data_types/image.py +156 -0
  42. wandb/sdk/data_types/table.py +1204 -0
  43. wandb/sdk/data_types/trace_tree.py +2 -2
  44. wandb/sdk/data_types/utils.py +49 -0
  45. wandb/sdk/service/service.py +2 -9
  46. wandb/sdk/service/streams.py +0 -7
  47. wandb/sdk/wandb_init.py +10 -3
  48. wandb/sdk/wandb_run.py +6 -152
  49. wandb/sdk/wandb_setup.py +1 -1
  50. wandb/sklearn.py +35 -0
  51. wandb/util.py +6 -2
  52. {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/METADATA +1 -1
  53. {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/RECORD +61 -57
  54. wandb/sdk/lib/console.py +0 -39
  55. /wandb/{sklearn → integration/sklearn}/__init__.py +0 -0
  56. /wandb/{sklearn → integration/sklearn}/calculate/__init__.py +0 -0
  57. /wandb/{sklearn → integration/sklearn}/calculate/decision_boundaries.py +0 -0
  58. /wandb/{sklearn → integration/sklearn}/calculate/feature_importances.py +0 -0
  59. /wandb/{sklearn → integration/sklearn}/plot/__init__.py +0 -0
  60. {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/WHEEL +0 -0
  61. {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/entry_points.txt +0 -0
  62. {wandb-0.18.0.dist-info → wandb-0.18.1.dist-info}/licenses/LICENSE +0 -0
@@ -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)