model2vec 0.3.1__py3-none-any.whl → 0.3.2__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.
model2vec/utils.py CHANGED
@@ -26,17 +26,19 @@ _MODULE_MAP = (("scikit-learn", "sklearn"),)
26
26
 
27
27
  def get_package_extras(package: str, extra: str) -> Iterator[str]:
28
28
  """Get the extras of the package."""
29
- message = metadata(package)
29
+ try:
30
+ message = metadata(package)
31
+ except Exception as e:
32
+ raise ImportError(f"Could not retrieve metadata for package '{package}': {e}")
33
+
30
34
  all_packages = message.get_all("Requires-Dist") or []
31
35
  for package in all_packages:
32
36
  name, *rest = package.split(";", maxsplit=1)
33
- if not rest:
34
- continue
35
- _, found_extra = rest[0].split("==", maxsplit=1)
36
- # Strip off quotes
37
- found_extra = found_extra.strip(' "')
38
- if found_extra == extra:
39
- yield name
37
+ if rest:
38
+ # Extract and clean the extra requirement
39
+ found_extra = rest[0].split("==")[-1].strip(" \"'")
40
+ if found_extra == extra:
41
+ yield name.strip()
40
42
 
41
43
 
42
44
  def importable(module: str, extra: str) -> None:
model2vec/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version_triple__ = (0, 3, 1)
1
+ __version_triple__ = (0, 3, 2)
2
2
  __version__ = ".".join(map(str, __version_triple__))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: model2vec
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Distill a Small Static Model from any Sentence Transformer
5
5
  Author-email: Stéphan Tulkens <stephantul@gmail.com>, Thomas van Dongen <thomas123@live.nl>
6
6
  License: MIT License
@@ -47,6 +47,7 @@ Requires-Dist: numpy
47
47
  Requires-Dist: rich
48
48
  Requires-Dist: tqdm
49
49
  Requires-Dist: tokenizers >=0.20
50
+ Requires-Dist: safetensors
50
51
  Requires-Dist: setuptools
51
52
  Provides-Extra: dev
52
53
  Requires-Dist: black ; extra == 'dev'
@@ -2,15 +2,15 @@ model2vec/__init__.py,sha256=osue7o8CuO_1T9opJAWfnbg4SspGKx0cHuyWv8Tedfs,124
2
2
  model2vec/hf_utils.py,sha256=Z-_V2kYagBX7m9_--e2ZAGP4irfRpqIlBQgGwYswpoU,7772
3
3
  model2vec/model.py,sha256=DuzsHaTBf0fTsp0ovVPzFs3EzDqGnFd5bGC94vumYuU,12031
4
4
  model2vec/model_card_template.md,sha256=rQo4bE3VPXH3XB9OUCe7FCenhBc4wv6L1sNURVT4Sro,2747
5
- model2vec/utils.py,sha256=ID5TYV9dvcQccfqBbeVVAK66qfKm0tYf6O9xbISlcOQ,2577
6
- model2vec/version.py,sha256=fgJbJS8ResifrwglA284jEeq3crjuclMKhZfSCctVnQ,84
5
+ model2vec/utils.py,sha256=AyKPu7w7XO2DhJEBN8NrO53vZj5rZpbwWJNxjagCKIk,2684
6
+ model2vec/version.py,sha256=YUIpQDxUrCbh0vtQtU7z3qcWjcuAHAhcRI706SxPcGw,84
7
7
  model2vec/distill/__init__.py,sha256=KpFRhafXVceM1xhorJhXbd8OnX8dwOGcWMbXglZxd4U,330
8
8
  model2vec/distill/distillation.py,sha256=yDdIW4nqR5Vw4cUYL4p7hrJnIzZWO9fV9LiqZHe_z8s,11504
9
9
  model2vec/distill/inference.py,sha256=QgHAEkLoeq-jPyKnFTB6p6Ry-ZGZqonkZaEg2S7VTOY,6123
10
10
  model2vec/distill/tokenizer.py,sha256=xtVsMTxquqTufoP9z39C4Itg2LLcGViqeguz-M7y-u8,4293
11
11
  model2vec/distill/utils.py,sha256=lzGyvFUO8mUcz63wnTRimGhQCsXzqnQfG5vRRKDGxic,721
12
- model2vec-0.3.1.dist-info/LICENSE,sha256=sCFPFI7OrnOfkWIJ54z-FXEsS4EMi8nUS2wtHRYWqrY,1074
13
- model2vec-0.3.1.dist-info/METADATA,sha256=sSDg_zBOB90cmsCzw3KFz785oWC1jlgGbMddWkDQWh8,22614
14
- model2vec-0.3.1.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
15
- model2vec-0.3.1.dist-info/top_level.txt,sha256=cprhxJcbtkFiydp0BGvdCVNupTWg07-3p93jFStc78g,10
16
- model2vec-0.3.1.dist-info/RECORD,,
12
+ model2vec-0.3.2.dist-info/LICENSE,sha256=sCFPFI7OrnOfkWIJ54z-FXEsS4EMi8nUS2wtHRYWqrY,1074
13
+ model2vec-0.3.2.dist-info/METADATA,sha256=mMDSZ9I2XhHGnXZhzO0TUtwuerJL3zD_yeVtjRp4clc,22641
14
+ model2vec-0.3.2.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
15
+ model2vec-0.3.2.dist-info/top_level.txt,sha256=cprhxJcbtkFiydp0BGvdCVNupTWg07-3p93jFStc78g,10
16
+ model2vec-0.3.2.dist-info/RECORD,,