hyper-models 0.3.3__tar.gz → 0.3.5__tar.gz

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 (24) hide show
  1. {hyper_models-0.3.3 → hyper_models-0.3.5}/PKG-INFO +10 -9
  2. {hyper_models-0.3.3 → hyper_models-0.3.5}/README.md +8 -8
  3. {hyper_models-0.3.3 → hyper_models-0.3.5}/pyproject.toml +2 -1
  4. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper_models/models.py +17 -3
  5. {hyper_models-0.3.3 → hyper_models-0.3.5}/.gitignore +0 -0
  6. {hyper_models-0.3.3 → hyper_models-0.3.5}/LICENSE +0 -0
  7. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/__init__.py +0 -0
  8. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/__init__.py +0 -0
  9. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/encoders.py +0 -0
  10. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/experimental.py +0 -0
  11. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/himo.py +0 -0
  12. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/hyper3_clip.py +0 -0
  13. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/lorentz.py +0 -0
  14. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/losses.py +0 -0
  15. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/objectives.py +0 -0
  16. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/models/tren.py +0 -0
  17. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/training/__init__.py +0 -0
  18. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper3_clip/training/distributed.py +0 -0
  19. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper_models/__init__.py +0 -0
  20. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper_models/loader.py +0 -0
  21. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper_models/loaders.py +0 -0
  22. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper_models/preprocessing.py +0 -0
  23. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper_models/registry.py +0 -0
  24. {hyper_models-0.3.3 → hyper_models-0.3.5}/src/hyper_models/torch_models.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: hyper-models
3
- Version: 0.3.3
3
+ Version: 0.3.5
4
4
  Summary: A model zoo for non-Euclidean embedding models (hyperbolic, spherical, product manifolds)
5
5
  Project-URL: Homepage, https://github.com/Hyper3Labs/hyper-models
6
6
  Project-URL: Repository, https://github.com/Hyper3Labs/hyper-models
@@ -30,6 +30,7 @@ Requires-Dist: pytest>=7.0; extra == 'dev'
30
30
  Requires-Dist: ruff>=0.1; extra == 'dev'
31
31
  Requires-Dist: tomli>=2.0; (python_version < '3.11') and extra == 'dev'
32
32
  Provides-Extra: ml
33
+ Requires-Dist: omegaconf>=2.3.0; extra == 'ml'
33
34
  Requires-Dist: protobuf>=4.25.0; extra == 'ml'
34
35
  Requires-Dist: pyyaml>=6.0.0; extra == 'ml'
35
36
  Requires-Dist: safetensors>=0.4.0; extra == 'ml'
@@ -96,7 +97,7 @@ hyper_models.list_loaders()
96
97
  # Load model (auto-downloads from Hugging Face Hub)
97
98
  model = hyper_models.load("hycoclip-vit-s")
98
99
  model.geometry # 'hyperboloid'
99
- model.dim # 513
100
+ model.dim # 513
100
101
 
101
102
  # Encode PIL images
102
103
  images = [Image.open("image.jpg")]
@@ -104,9 +105,9 @@ embeddings = model.encode_images(images) # (1, 513) ndarray
104
105
 
105
106
  # Get model info
106
107
  info = hyper_models.get_model_info("hycoclip-vit-s")
107
- info.hub_id # 'mnm-matin/hyperbolic-clip'
108
- info.loader # 'onnx'
109
- info.license # 'CC-BY-NC'
108
+ info.hub_id # 'mnm-matin/hyperbolic-clip'
109
+ info.loader # 'onnx'
110
+ info.license # 'CC-BY-NC'
110
111
 
111
112
  # Low-level: preprocess images yourself
112
113
  batch = hyper_models.preprocess_images(images) # (B, 3, 224, 224)
@@ -149,10 +150,10 @@ HyperView auto-detects `hyper-models` names and routes them to the `hyper-models
149
150
  import hyperview as hv
150
151
 
151
152
  dataset = hv.Dataset.from_huggingface(
152
- name="demo",
153
- hf_dataset="uoft-cs/cifar10",
154
- split="train",
155
- image_key="img",
153
+ name="demo",
154
+ hf_dataset="uoft-cs/cifar10",
155
+ split="train",
156
+ image_key="img",
156
157
  )
157
158
 
158
159
  # Uses provider='hyper-models' automatically.
@@ -55,7 +55,7 @@ hyper_models.list_loaders()
55
55
  # Load model (auto-downloads from Hugging Face Hub)
56
56
  model = hyper_models.load("hycoclip-vit-s")
57
57
  model.geometry # 'hyperboloid'
58
- model.dim # 513
58
+ model.dim # 513
59
59
 
60
60
  # Encode PIL images
61
61
  images = [Image.open("image.jpg")]
@@ -63,9 +63,9 @@ embeddings = model.encode_images(images) # (1, 513) ndarray
63
63
 
64
64
  # Get model info
65
65
  info = hyper_models.get_model_info("hycoclip-vit-s")
66
- info.hub_id # 'mnm-matin/hyperbolic-clip'
67
- info.loader # 'onnx'
68
- info.license # 'CC-BY-NC'
66
+ info.hub_id # 'mnm-matin/hyperbolic-clip'
67
+ info.loader # 'onnx'
68
+ info.license # 'CC-BY-NC'
69
69
 
70
70
  # Low-level: preprocess images yourself
71
71
  batch = hyper_models.preprocess_images(images) # (B, 3, 224, 224)
@@ -108,10 +108,10 @@ HyperView auto-detects `hyper-models` names and routes them to the `hyper-models
108
108
  import hyperview as hv
109
109
 
110
110
  dataset = hv.Dataset.from_huggingface(
111
- name="demo",
112
- hf_dataset="uoft-cs/cifar10",
113
- split="train",
114
- image_key="img",
111
+ name="demo",
112
+ hf_dataset="uoft-cs/cifar10",
113
+ split="train",
114
+ image_key="img",
115
115
  )
116
116
 
117
117
  # Uses provider='hyper-models' automatically.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "hyper-models"
3
- version = "0.3.3"
3
+ version = "0.3.5"
4
4
  description = "A model zoo for non-Euclidean embedding models (hyperbolic, spherical, product manifolds)"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -44,6 +44,7 @@ ml = [
44
44
  "pyyaml>=6.0.0",
45
45
  "sentencepiece>=0.2.0",
46
46
  "protobuf>=4.25.0",
47
+ "omegaconf>=2.3.0",
47
48
  ]
48
49
 
49
50
  [project.urls]
@@ -3,6 +3,8 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from pathlib import Path
6
+ from shutil import copyfile
7
+ from tempfile import TemporaryDirectory
6
8
 
7
9
  import numpy as np
8
10
  from PIL import Image
@@ -32,14 +34,26 @@ class ONNXModel:
32
34
  self._output_name = output_name
33
35
  self._image_config = image_config or ImageConfig()
34
36
  self._session = None
37
+ self._artifact_directory = None
35
38
 
36
39
  def _ensure_session(self) -> None:
37
40
  if self._session is None:
38
41
  import onnxruntime as ort
39
42
 
40
- self._session = ort.InferenceSession(
41
- str(self._path), providers=["CPUExecutionProvider"]
42
- )
43
+ path = self._path
44
+ # Hub snapshots link the graph and external weights to different
45
+ # blob directories. New ONNX Runtime versions correctly reject
46
+ # external data outside the resolved graph directory. Materialize
47
+ # our catalog's graph and sidecars together, keeping validation on.
48
+ artifacts = [path, *path.parent.glob(f"{path.name}.*")]
49
+ if any(artifact.is_symlink() for artifact in artifacts):
50
+ self._artifact_directory = TemporaryDirectory(prefix="hyper-models-onnx-")
51
+ directory = Path(self._artifact_directory.name)
52
+ for artifact in artifacts:
53
+ if artifact.is_file():
54
+ copyfile(artifact, directory / artifact.name)
55
+ path = directory / path.name
56
+ self._session = ort.InferenceSession(str(path), providers=["CPUExecutionProvider"])
43
57
 
44
58
  def encode(self, inputs: np.ndarray) -> np.ndarray:
45
59
  """Encode preprocessed inputs (B, C, H, W) to embeddings (B, D)."""
File without changes
File without changes