Upload folder using huggingface_hub
Browse files- hf_utils.py +3 -3
- operator.py +2 -2
- utils.py +2 -7
- version.py +1 -1
hf_utils.py
CHANGED
@@ -24,10 +24,10 @@ class UnitxtVersionsConflictError(ValueError):
|
|
24 |
def __init__(self, error_in: str, hf_unitxt_version, installed_unitxt_version):
|
25 |
assert hf_unitxt_version != installed_unitxt_version
|
26 |
if compare_versions(hf_unitxt_version, installed_unitxt_version) == 1:
|
27 |
-
msg = f"Located locally installed Unitxt version {installed_unitxt_version} that is older than the Unitxt {error_in} version {hf_unitxt_version}. Please either (1) update the local Unitxt package or (2) uninstall the local unitxt package (3) remove the calls to the
|
28 |
if compare_versions(hf_unitxt_version, installed_unitxt_version) == -1:
|
29 |
-
msg = f"Located locally installed Unitxt version {installed_unitxt_version} that is newer than Unitxt {error_in} version {hf_unitxt_version}. Please either (1) force-reload the {error_in} version or (2) downgrade the locally installed Unitxt version to {error_in} version or (3) uninstall the locally installed Unitxt, if you are not using the direct Unitxt APIs"
|
30 |
-
msg
|
31 |
super().__init__(msg)
|
32 |
|
33 |
|
|
|
24 |
def __init__(self, error_in: str, hf_unitxt_version, installed_unitxt_version):
|
25 |
assert hf_unitxt_version != installed_unitxt_version
|
26 |
if compare_versions(hf_unitxt_version, installed_unitxt_version) == 1:
|
27 |
+
msg = f"Located locally installed Unitxt version {installed_unitxt_version} that is older than the Huggingface Unitxt {error_in} version {hf_unitxt_version}. Please either (1) update the local Unitxt package or (2) uninstall the local unitxt package (3) remove the calls to the Huggingface {error_in} API and use only the direct Unitxt APIs."
|
28 |
if compare_versions(hf_unitxt_version, installed_unitxt_version) == -1:
|
29 |
+
msg = f"Located locally installed Unitxt version {installed_unitxt_version} that is newer than the Huggingface Unitxt {error_in} version {hf_unitxt_version}. Please either (1) force-reload the {error_in} version or (2) downgrade the locally installed Unitxt version to {error_in} version or (3) uninstall the locally installed Unitxt, if you are not using the direct Unitxt APIs"
|
30 |
+
msg += "For more details see: https://unitxt.readthedocs.io/en/latest/docs/installation.html"
|
31 |
super().__init__(msg)
|
32 |
|
33 |
|
operator.py
CHANGED
@@ -26,8 +26,8 @@ class PackageRequirementsMixin(Artifact):
|
|
26 |
default_factory=list
|
27 |
)
|
28 |
|
29 |
-
def
|
30 |
-
super().
|
31 |
self.check_missing_requirements()
|
32 |
|
33 |
def check_missing_requirements(self, requirements=None):
|
|
|
26 |
default_factory=list
|
27 |
)
|
28 |
|
29 |
+
def prepare(self):
|
30 |
+
super().prepare()
|
31 |
self.check_missing_requirements()
|
32 |
|
33 |
def check_missing_requirements(self, requirements=None):
|
utils.py
CHANGED
@@ -4,8 +4,6 @@ import os
|
|
4 |
from functools import lru_cache
|
5 |
from typing import Any, Dict
|
6 |
|
7 |
-
import pkg_resources
|
8 |
-
|
9 |
from .text_utils import is_made_of_sub_strings
|
10 |
|
11 |
|
@@ -68,11 +66,8 @@ def is_package_installed(package_name):
|
|
68 |
Returns:
|
69 |
- bool: True if the package is installed, False otherwise.
|
70 |
"""
|
71 |
-
|
72 |
-
|
73 |
-
return True
|
74 |
-
except pkg_resources.DistributionNotFound:
|
75 |
-
return False
|
76 |
|
77 |
|
78 |
def is_module_available(module_name):
|
|
|
4 |
from functools import lru_cache
|
5 |
from typing import Any, Dict
|
6 |
|
|
|
|
|
7 |
from .text_utils import is_made_of_sub_strings
|
8 |
|
9 |
|
|
|
66 |
Returns:
|
67 |
- bool: True if the package is installed, False otherwise.
|
68 |
"""
|
69 |
+
unitxt_pkg = importlib.util.find_spec(package_name)
|
70 |
+
return unitxt_pkg is not None
|
|
|
|
|
|
|
71 |
|
72 |
|
73 |
def is_module_available(module_name):
|
version.py
CHANGED
@@ -1 +1 @@
|
|
1 |
-
version = "1.12.
|
|
|
1 |
+
version = "1.12.2"
|