Spaces:
Running
Running
resolves the urls correctly
Browse files
config_test_monitoring_auto_resolve_20250727_161709.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "HuggingFaceTB/SmolLM3-3B",
|
| 3 |
+
"batch_size": 8,
|
| 4 |
+
"learning_rate": 2e-05
|
| 5 |
+
}
|
scripts/trackio_tonic/trackio_api_client.py
CHANGED
|
@@ -54,17 +54,31 @@ class TrackioAPIClient:
|
|
| 54 |
def _resolve_space_url(self) -> Optional[str]:
|
| 55 |
"""Resolve Space URL using Hugging Face Hub API"""
|
| 56 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
if not HF_HUB_AVAILABLE:
|
| 58 |
logger.warning("⚠️ Hugging Face Hub not available, using default URL format")
|
| 59 |
# Fallback to default URL format
|
| 60 |
-
space_name =
|
| 61 |
return f"https://{space_name}.hf.space"
|
| 62 |
|
| 63 |
# Use Hugging Face Hub API to get Space info
|
| 64 |
api = HfApi(token=self.hf_token)
|
| 65 |
|
| 66 |
# Get Space info
|
| 67 |
-
space_info = api.space_info(
|
| 68 |
if space_info and hasattr(space_info, 'host'):
|
| 69 |
# Use the host directly from space_info
|
| 70 |
space_url = space_info.host
|
|
@@ -72,7 +86,7 @@ class TrackioAPIClient:
|
|
| 72 |
return space_url
|
| 73 |
else:
|
| 74 |
# Fallback to default URL format
|
| 75 |
-
space_name =
|
| 76 |
space_url = f"https://{space_name}.hf.space"
|
| 77 |
logger.info(f"✅ Using fallback Space URL: {space_url}")
|
| 78 |
return space_url
|
|
|
|
| 54 |
def _resolve_space_url(self) -> Optional[str]:
|
| 55 |
"""Resolve Space URL using Hugging Face Hub API"""
|
| 56 |
try:
|
| 57 |
+
# Clean the space_id - remove any URL prefixes
|
| 58 |
+
clean_space_id = self.space_id
|
| 59 |
+
if clean_space_id.startswith('http'):
|
| 60 |
+
# Extract space ID from URL
|
| 61 |
+
if '/spaces/' in clean_space_id:
|
| 62 |
+
clean_space_id = clean_space_id.split('/spaces/')[-1]
|
| 63 |
+
else:
|
| 64 |
+
# Try to extract from URL format
|
| 65 |
+
clean_space_id = clean_space_id.replace('https://', '').replace('http://', '')
|
| 66 |
+
if '.hf.space' in clean_space_id:
|
| 67 |
+
clean_space_id = clean_space_id.replace('.hf.space', '').replace('-', '/')
|
| 68 |
+
|
| 69 |
+
logger.info(f"🔧 Resolving Space URL for ID: {clean_space_id}")
|
| 70 |
+
|
| 71 |
if not HF_HUB_AVAILABLE:
|
| 72 |
logger.warning("⚠️ Hugging Face Hub not available, using default URL format")
|
| 73 |
# Fallback to default URL format
|
| 74 |
+
space_name = clean_space_id.replace('/', '-')
|
| 75 |
return f"https://{space_name}.hf.space"
|
| 76 |
|
| 77 |
# Use Hugging Face Hub API to get Space info
|
| 78 |
api = HfApi(token=self.hf_token)
|
| 79 |
|
| 80 |
# Get Space info
|
| 81 |
+
space_info = api.space_info(clean_space_id)
|
| 82 |
if space_info and hasattr(space_info, 'host'):
|
| 83 |
# Use the host directly from space_info
|
| 84 |
space_url = space_info.host
|
|
|
|
| 86 |
return space_url
|
| 87 |
else:
|
| 88 |
# Fallback to default URL format
|
| 89 |
+
space_name = clean_space_id.replace('/', '-')
|
| 90 |
space_url = f"https://{space_name}.hf.space"
|
| 91 |
logger.info(f"✅ Using fallback Space URL: {space_url}")
|
| 92 |
return space_url
|