Spaces:
Running
Running
propagates changes
Browse files
scripts/trackio_tonic/trackio_api_client.py
CHANGED
@@ -44,7 +44,12 @@ class TrackioAPIClient:
|
|
44 |
# Initialize gradio client
|
45 |
if GRADIO_CLIENT_AVAILABLE and self.space_url:
|
46 |
try:
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
48 |
logger.info(f"β
Connected to Trackio Space: {self.space_id}")
|
49 |
except Exception as e:
|
50 |
logger.error(f"β Failed to connect to Trackio Space: {e}")
|
@@ -125,6 +130,14 @@ class TrackioAPIClient:
|
|
125 |
result = self._make_api_call("/create_experiment_interface", name, description)
|
126 |
|
127 |
if "success" in result:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
logger.info(f"Experiment created successfully: {result['data']}")
|
129 |
return result
|
130 |
else:
|
|
|
44 |
# Initialize gradio client
|
45 |
if GRADIO_CLIENT_AVAILABLE and self.space_url:
|
46 |
try:
|
47 |
+
# Ensure we pass hf_token if Client supports it (older versions ignore extra kwargs)
|
48 |
+
try:
|
49 |
+
self.client = Client(self.space_url, hf_token=self.hf_token) # type: ignore
|
50 |
+
except TypeError:
|
51 |
+
# Fallback for older gradio_client versions without hf_token param
|
52 |
+
self.client = Client(self.space_url)
|
53 |
logger.info(f"β
Connected to Trackio Space: {self.space_id}")
|
54 |
except Exception as e:
|
55 |
logger.error(f"β Failed to connect to Trackio Space: {e}")
|
|
|
130 |
result = self._make_api_call("/create_experiment_interface", name, description)
|
131 |
|
132 |
if "success" in result:
|
133 |
+
# Gradio returns [message, dropdown] when two outputs are wired
|
134 |
+
# Normalize to a string for logging
|
135 |
+
try:
|
136 |
+
payload = result.get("data")
|
137 |
+
if isinstance(payload, (list, tuple)):
|
138 |
+
result["data"] = payload[0]
|
139 |
+
except Exception:
|
140 |
+
pass
|
141 |
logger.info(f"Experiment created successfully: {result['data']}")
|
142 |
return result
|
143 |
else:
|
templates/spaces/trackio/app.py
CHANGED
@@ -116,7 +116,11 @@ class TrackioSpace:
|
|
116 |
from datasets import load_dataset
|
117 |
|
118 |
logger.info(f"π Loading experiments directly from {self.dataset_repo}")
|
119 |
-
|
|
|
|
|
|
|
|
|
120 |
logger.info(f"β
Successfully loaded dataset from {self.dataset_repo}")
|
121 |
|
122 |
# Convert dataset to experiments dict
|
@@ -704,8 +708,11 @@ def test_dataset_connection(hf_token: str, dataset_repo: str) -> str:
|
|
704 |
|
705 |
from datasets import load_dataset
|
706 |
|
707 |
-
# Test loading the dataset
|
708 |
-
|
|
|
|
|
|
|
709 |
|
710 |
# Count experiments and analyze structure
|
711 |
experiment_count = len(dataset['train']) if 'train' in dataset else 0
|
@@ -2139,4 +2146,4 @@ with gr.Blocks(title="Trackio - Experiment Tracking", theme=gr.themes.Soft()) as
|
|
2139 |
|
2140 |
# Launch the app
|
2141 |
if __name__ == "__main__":
|
2142 |
-
demo.launch()
|
|
|
116 |
from datasets import load_dataset
|
117 |
|
118 |
logger.info(f"π Loading experiments directly from {self.dataset_repo}")
|
119 |
+
try:
|
120 |
+
dataset = load_dataset(self.dataset_repo, token=self.hf_token)
|
121 |
+
except Exception:
|
122 |
+
# Relax verification to handle split metadata mismatches
|
123 |
+
dataset = load_dataset(self.dataset_repo, token=self.hf_token, verification_mode="no_checks") # type: ignore[arg-type]
|
124 |
logger.info(f"β
Successfully loaded dataset from {self.dataset_repo}")
|
125 |
|
126 |
# Convert dataset to experiments dict
|
|
|
708 |
|
709 |
from datasets import load_dataset
|
710 |
|
711 |
+
# Test loading the dataset (with relaxed verification fallback)
|
712 |
+
try:
|
713 |
+
dataset = load_dataset(dataset_repo, token=hf_token)
|
714 |
+
except Exception:
|
715 |
+
dataset = load_dataset(dataset_repo, token=hf_token, verification_mode="no_checks") # type: ignore[arg-type]
|
716 |
|
717 |
# Count experiments and analyze structure
|
718 |
experiment_count = len(dataset['train']) if 'train' in dataset else 0
|
|
|
2146 |
|
2147 |
# Launch the app
|
2148 |
if __name__ == "__main__":
|
2149 |
+
demo.launch(show_error=True)
|
templates/spaces/trackio/dataset_utils.py
CHANGED
@@ -45,12 +45,24 @@ class TrackioDatasetManager:
|
|
45 |
bool: True if dataset exists and is accessible, False otherwise
|
46 |
"""
|
47 |
try:
|
|
|
48 |
load_dataset(self.dataset_repo, token=self.hf_token)
|
49 |
logger.info(f"β
Dataset {self.dataset_repo} exists and is accessible")
|
50 |
return True
|
51 |
except Exception as e:
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
def load_existing_experiments(self) -> List[Dict[str, Any]]:
|
56 |
"""
|
@@ -64,7 +76,11 @@ class TrackioDatasetManager:
|
|
64 |
logger.info("π No existing dataset found, returning empty list")
|
65 |
return []
|
66 |
|
67 |
-
|
|
|
|
|
|
|
|
|
68 |
|
69 |
if 'train' not in dataset:
|
70 |
logger.info("π No 'train' split found in dataset")
|
|
|
45 |
bool: True if dataset exists and is accessible, False otherwise
|
46 |
"""
|
47 |
try:
|
48 |
+
# Try standard load first
|
49 |
load_dataset(self.dataset_repo, token=self.hf_token)
|
50 |
logger.info(f"β
Dataset {self.dataset_repo} exists and is accessible")
|
51 |
return True
|
52 |
except Exception as e:
|
53 |
+
# Retry with relaxed verification to handle split metadata mismatches
|
54 |
+
try:
|
55 |
+
logger.info(f"π Standard load failed: {e}. Retrying with relaxed verification...")
|
56 |
+
load_dataset(
|
57 |
+
self.dataset_repo,
|
58 |
+
token=self.hf_token,
|
59 |
+
verification_mode="no_checks" # type: ignore[arg-type]
|
60 |
+
)
|
61 |
+
logger.info(f"β
Dataset {self.dataset_repo} accessible with relaxed verification")
|
62 |
+
return True
|
63 |
+
except Exception as e2:
|
64 |
+
logger.info(f"π Dataset {self.dataset_repo} doesn't exist or isn't accessible: {e2}")
|
65 |
+
return False
|
66 |
|
67 |
def load_existing_experiments(self) -> List[Dict[str, Any]]:
|
68 |
"""
|
|
|
76 |
logger.info("π No existing dataset found, returning empty list")
|
77 |
return []
|
78 |
|
79 |
+
# Load with relaxed verification to avoid split-metadata mismatches blocking reads
|
80 |
+
try:
|
81 |
+
dataset = load_dataset(self.dataset_repo, token=self.hf_token)
|
82 |
+
except Exception:
|
83 |
+
dataset = load_dataset(self.dataset_repo, token=self.hf_token, verification_mode="no_checks") # type: ignore[arg-type]
|
84 |
|
85 |
if 'train' not in dataset:
|
86 |
logger.info("π No 'train' split found in dataset")
|
templates/spaces/trackio/trackio_api_client.py
CHANGED
@@ -44,7 +44,10 @@ class TrackioAPIClient:
|
|
44 |
# Initialize gradio client
|
45 |
if GRADIO_CLIENT_AVAILABLE and self.space_url:
|
46 |
try:
|
47 |
-
|
|
|
|
|
|
|
48 |
logger.info(f"β
Connected to Trackio Space: {self.space_id}")
|
49 |
except Exception as e:
|
50 |
logger.error(f"β Failed to connect to Trackio Space: {e}")
|
@@ -125,6 +128,12 @@ class TrackioAPIClient:
|
|
125 |
result = self._make_api_call("/create_experiment_interface", name, description)
|
126 |
|
127 |
if "success" in result:
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
logger.info(f"Experiment created successfully: {result['data']}")
|
129 |
return result
|
130 |
else:
|
|
|
44 |
# Initialize gradio client
|
45 |
if GRADIO_CLIENT_AVAILABLE and self.space_url:
|
46 |
try:
|
47 |
+
try:
|
48 |
+
self.client = Client(self.space_url, hf_token=self.hf_token) # type: ignore
|
49 |
+
except TypeError:
|
50 |
+
self.client = Client(self.space_url)
|
51 |
logger.info(f"β
Connected to Trackio Space: {self.space_id}")
|
52 |
except Exception as e:
|
53 |
logger.error(f"β Failed to connect to Trackio Space: {e}")
|
|
|
128 |
result = self._make_api_call("/create_experiment_interface", name, description)
|
129 |
|
130 |
if "success" in result:
|
131 |
+
try:
|
132 |
+
payload = result.get("data")
|
133 |
+
if isinstance(payload, (list, tuple)):
|
134 |
+
result["data"] = payload[0]
|
135 |
+
except Exception:
|
136 |
+
pass
|
137 |
logger.info(f"Experiment created successfully: {result['data']}")
|
138 |
return result
|
139 |
else:
|