Upload settings_utils.py with huggingface_hub
Browse files- settings_utils.py +10 -1
settings_utils.py
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
import os
|
2 |
|
|
|
|
|
|
|
|
|
3 |
|
4 |
class Settings:
|
5 |
_instance = None
|
@@ -13,7 +17,10 @@ class Settings:
|
|
13 |
def __setattr__(self, key, value):
|
14 |
if key.endswith("_key") or key in {"_instance", "_settings"}:
|
15 |
raise AttributeError(f"Modifying '{key}' is not allowed.")
|
16 |
-
|
|
|
|
|
|
|
17 |
self._settings[key] = value
|
18 |
|
19 |
def __getattr__(self, key):
|
@@ -42,6 +49,8 @@ class Settings:
|
|
42 |
|
43 |
settings = Settings()
|
44 |
settings.allow_unverified_code = False
|
|
|
|
|
45 |
|
46 |
|
47 |
def get_settings():
|
|
|
1 |
import os
|
2 |
|
3 |
+
from .logging_utils import get_logger
|
4 |
+
|
5 |
+
logger = get_logger()
|
6 |
+
|
7 |
|
8 |
class Settings:
|
9 |
_instance = None
|
|
|
17 |
def __setattr__(self, key, value):
|
18 |
if key.endswith("_key") or key in {"_instance", "_settings"}:
|
19 |
raise AttributeError(f"Modifying '{key}' is not allowed.")
|
20 |
+
if key in self._settings:
|
21 |
+
logger.info(
|
22 |
+
f"unitxt.settings.{key} changed: {self._settings[key]} -> {value}"
|
23 |
+
)
|
24 |
self._settings[key] = value
|
25 |
|
26 |
def __getattr__(self, key):
|
|
|
49 |
|
50 |
settings = Settings()
|
51 |
settings.allow_unverified_code = False
|
52 |
+
settings.use_only_local_catalogs = False
|
53 |
+
settings.global_loader_limit = None
|
54 |
|
55 |
|
56 |
def get_settings():
|