Sync from davanstrien/uv-scripts via hub-sync
Browse files- wevisone-detect.py +4 -1
wevisone-detect.py
CHANGED
|
@@ -240,11 +240,14 @@ def merge_cross_class_duplicates(
|
|
| 240 |
def jobs_flavor() -> str:
|
| 241 |
"""Return the HF Jobs hardware flavor this run is on, or "" when it cannot be told.
|
| 242 |
|
| 243 |
-
HF Jobs sets
|
|
|
|
| 244 |
in the public Jobs hardware list: first by GPU model and count, then by the CPU_CORES and
|
| 245 |
MEMORY values that Jobs sets in the container (to tell a10g-small from a10g-large, or
|
| 246 |
cpu-basic from cpu-upgrade). Any failure (no network, older huggingface_hub) returns "".
|
| 247 |
"""
|
|
|
|
|
|
|
| 248 |
hardware = os.environ.get("ACCELERATOR") or ""
|
| 249 |
if "-" in hardware or any(character.isdigit() for character in hardware):
|
| 250 |
return hardware # already a flavor name
|
|
|
|
| 240 |
def jobs_flavor() -> str:
|
| 241 |
"""Return the HF Jobs hardware flavor this run is on, or "" when it cannot be told.
|
| 242 |
|
| 243 |
+
HF Jobs sets HF_JOB_FLAVOR to the flavor name. Without it (ACCELERATOR holds only
|
| 244 |
+
"cpu" or "gpu", not the flavor name), the flavor is looked up
|
| 245 |
in the public Jobs hardware list: first by GPU model and count, then by the CPU_CORES and
|
| 246 |
MEMORY values that Jobs sets in the container (to tell a10g-small from a10g-large, or
|
| 247 |
cpu-basic from cpu-upgrade). Any failure (no network, older huggingface_hub) returns "".
|
| 248 |
"""
|
| 249 |
+
if os.environ.get("HF_JOB_FLAVOR"):
|
| 250 |
+
return os.environ["HF_JOB_FLAVOR"]
|
| 251 |
hardware = os.environ.get("ACCELERATOR") or ""
|
| 252 |
if "-" in hardware or any(character.isdigit() for character in hardware):
|
| 253 |
return hardware # already a flavor name
|