Spaces:
Sleeping
Sleeping
Update app.py
Browse filesMemory Requirement Estimation:
The estimate_memory_requirements function now caps the required memory at 16GB to accommodate the limitations of Hugging Face Spaces.
Validation Logic:
The validation logic in the validate_model function remains intact, ensuring that users are informed about memory constraints and provided with appropriate warnings.
app.py
CHANGED
@@ -21,6 +21,7 @@ import hashlib
|
|
21 |
from datetime import datetime
|
22 |
from typing import Dict, List, Optional
|
23 |
from huggingface_hub import login, HfApi
|
|
|
24 |
|
25 |
# ---------------------- UTILITY FUNCTIONS ----------------------
|
26 |
|
@@ -362,6 +363,10 @@ def estimate_memory_requirements(model_path, precision):
|
|
362 |
# Calculate total required memory
|
363 |
required_memory = (base_memory + (model_size if model_size else 12)) * memory_multiplier
|
364 |
|
|
|
|
|
|
|
|
|
365 |
return required_memory
|
366 |
except:
|
367 |
return 16 # Default safe estimate
|
|
|
21 |
from datetime import datetime
|
22 |
from typing import Dict, List, Optional
|
23 |
from huggingface_hub import login, HfApi
|
24 |
+
from types import SimpleNamespace
|
25 |
|
26 |
# ---------------------- UTILITY FUNCTIONS ----------------------
|
27 |
|
|
|
363 |
# Calculate total required memory
|
364 |
required_memory = (base_memory + (model_size if model_size else 12)) * memory_multiplier
|
365 |
|
366 |
+
# Adjust for Hugging Face Space
|
367 |
+
if required_memory > 16:
|
368 |
+
required_memory = 16 # Cap at 16GB for Hugging Face Space
|
369 |
+
|
370 |
return required_memory
|
371 |
except:
|
372 |
return 16 # Default safe estimate
|