Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -993,12 +993,17 @@ class TelemetryManager:
|
|
| 993 |
class ResourceMonitor:
|
| 994 |
@staticmethod
|
| 995 |
def get_metrics() -> Dict:
|
| 996 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 997 |
return {
|
| 998 |
-
"ram_used_gb": round(
|
| 999 |
-
"ram_avail_gb": round(
|
| 1000 |
-
"ram_total_gb": round(
|
| 1001 |
-
"ram_pct":
|
| 1002 |
"cpu_usage_pct": psutil.cpu_percent(interval=None),
|
| 1003 |
"load_avg": os.getloadavg()[0] if hasattr(os, 'getloadavg') else 0
|
| 1004 |
}
|
|
@@ -1236,13 +1241,11 @@ class ZeroEngine:
|
|
| 1236 |
|
| 1237 |
# Calculate optimal parameters with token purchases
|
| 1238 |
# HARD-CODE: Force 18GB total RAM for Hugging Face Spaces reliability
|
| 1239 |
-
import psutil
|
| 1240 |
-
ram = psutil.virtual_memory()
|
| 1241 |
total_ram_gb = 18.0 # HARD-CODED: 18GB total for container
|
| 1242 |
available_ram_gb = 16.0 # HARD-CODED: 16GB usable for model (2GB reserved)
|
| 1243 |
|
| 1244 |
logger.info(f"[RAM] HARD-CODED: Total: {total_ram_gb:.1f}GB, Available: {available_ram_gb:.1f}GB")
|
| 1245 |
-
logger.info(f"[RAM] (Ignoring host system
|
| 1246 |
|
| 1247 |
# Define missing variables
|
| 1248 |
session_id = session_id if session_id else None
|
|
|
|
| 993 |
class ResourceMonitor:
|
| 994 |
@staticmethod
|
| 995 |
def get_metrics() -> Dict:
|
| 996 |
+
# HARD-CODE: Use container RAM limits instead of host system memory
|
| 997 |
+
total_ram_gb = 18.0 # 18GB total
|
| 998 |
+
avail_ram_gb = 16.0 # 16GB usable
|
| 999 |
+
used_ram_gb = total_ram_gb - avail_ram_gb # 2GB used by system
|
| 1000 |
+
ram_pct = (used_ram_gb / total_ram_gb) * 100
|
| 1001 |
+
|
| 1002 |
return {
|
| 1003 |
+
"ram_used_gb": round(used_ram_gb, 2),
|
| 1004 |
+
"ram_avail_gb": round(avail_ram_gb, 2),
|
| 1005 |
+
"ram_total_gb": round(total_ram_gb, 2),
|
| 1006 |
+
"ram_pct": round(ram_pct, 2),
|
| 1007 |
"cpu_usage_pct": psutil.cpu_percent(interval=None),
|
| 1008 |
"load_avg": os.getloadavg()[0] if hasattr(os, 'getloadavg') else 0
|
| 1009 |
}
|
|
|
|
| 1241 |
|
| 1242 |
# Calculate optimal parameters with token purchases
|
| 1243 |
# HARD-CODE: Force 18GB total RAM for Hugging Face Spaces reliability
|
|
|
|
|
|
|
| 1244 |
total_ram_gb = 18.0 # HARD-CODED: 18GB total for container
|
| 1245 |
available_ram_gb = 16.0 # HARD-CODED: 16GB usable for model (2GB reserved)
|
| 1246 |
|
| 1247 |
logger.info(f"[RAM] HARD-CODED: Total: {total_ram_gb:.1f}GB, Available: {available_ram_gb:.1f}GB")
|
| 1248 |
+
logger.info(f"[RAM] (Ignoring host system memory)")
|
| 1249 |
|
| 1250 |
# Define missing variables
|
| 1251 |
session_id = session_id if session_id else None
|