Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
update progress handling | fix logo link zone | prioritize sambanova as a provider
Browse files
backend/tasks/get_model_providers.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
from huggingface_hub import model_info
|
2 |
-
PREFERRED_PROVIDERS = ["
|
3 |
|
4 |
def filter_providers(providers):
|
5 |
return [provider for provider in providers if provider in PREFERRED_PROVIDERS]
|
|
|
1 |
from huggingface_hub import model_info
|
2 |
+
PREFERRED_PROVIDERS = ["sambanova", "novita"]
|
3 |
|
4 |
def filter_providers(providers):
|
5 |
return [provider for provider in providers if provider in PREFERRED_PROVIDERS]
|
frontend/src/components/BenchmarkEvaluation.jsx
CHANGED
@@ -81,6 +81,62 @@ const BenchmarkEvaluation = ({ sessionId, isDefaultDocument, onComplete }) => {
|
|
81 |
setElapsedTime(timeElapsed);
|
82 |
}, 1000);
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
if (isDefault) {
|
85 |
simulateEvaluation();
|
86 |
} else {
|
@@ -98,8 +154,9 @@ const BenchmarkEvaluation = ({ sessionId, isDefaultDocument, onComplete }) => {
|
|
98 |
if (simulationTimeoutRef.current) {
|
99 |
clearTimeout(simulationTimeoutRef.current);
|
100 |
}
|
|
|
101 |
};
|
102 |
-
}, [isDefault]);
|
103 |
|
104 |
// Simulate the evaluation process for pre-calculated documents
|
105 |
const simulateEvaluation = () => {
|
@@ -162,13 +219,46 @@ const BenchmarkEvaluation = ({ sessionId, isDefaultDocument, onComplete }) => {
|
|
162 |
|
163 |
if (logsResponse.ok) {
|
164 |
const logsResult = await logsResponse.json();
|
|
|
|
|
165 |
if (logsResult.is_completed) {
|
166 |
setEvaluationComplete(true);
|
|
|
|
|
|
|
|
|
|
|
167 |
clearInterval(pollingIntervalRef.current);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
}
|
169 |
}
|
170 |
} catch (error) {
|
171 |
console.log("Error polling logs:", error);
|
|
|
172 |
}
|
173 |
}, 2000);
|
174 |
} else {
|
|
|
81 |
setElapsedTime(timeElapsed);
|
82 |
}, 1000);
|
83 |
|
84 |
+
// Gestionnaire pour détecter quand la page redevient visible
|
85 |
+
const handleVisibilityChange = () => {
|
86 |
+
if (
|
87 |
+
document.visibilityState === "visible" &&
|
88 |
+
!isDefault &&
|
89 |
+
!evaluationComplete
|
90 |
+
) {
|
91 |
+
console.log("Page became visible, checking evaluation status...");
|
92 |
+
// Force une nouvelle requête pour récupérer l'état d'évaluation
|
93 |
+
const checkEvaluationStatus = async () => {
|
94 |
+
try {
|
95 |
+
const logsResponse = await fetch(
|
96 |
+
`${API_CONFIG.BASE_URL}/evaluation-logs/${sessionId}`
|
97 |
+
);
|
98 |
+
|
99 |
+
if (logsResponse.ok) {
|
100 |
+
const logsResult = await logsResponse.json();
|
101 |
+
if (logsResult.is_completed) {
|
102 |
+
// Mettre fin à l'évaluation si elle est terminée
|
103 |
+
setEvaluationComplete(true);
|
104 |
+
|
105 |
+
// Avancer à la dernière étape des messages
|
106 |
+
setStartingMessageIndex(STARTING_MESSAGES.length - 1);
|
107 |
+
|
108 |
+
// Nettoyer les intervalles
|
109 |
+
if (pollingIntervalRef.current) {
|
110 |
+
clearInterval(pollingIntervalRef.current);
|
111 |
+
}
|
112 |
+
if (startingMessageIntervalRef.current) {
|
113 |
+
clearInterval(startingMessageIntervalRef.current);
|
114 |
+
}
|
115 |
+
} else {
|
116 |
+
// Si l'évaluation est toujours en cours, mettre à jour l'étape actuelle
|
117 |
+
// basée sur le temps écoulé
|
118 |
+
const progress = Math.min(
|
119 |
+
Math.floor(
|
120 |
+
(Date.now() - startTimeRef.current) /
|
121 |
+
MESSAGE_CHANGE_INTERVAL.DEFAULT
|
122 |
+
),
|
123 |
+
STARTING_MESSAGES.length - 1
|
124 |
+
);
|
125 |
+
setStartingMessageIndex(progress);
|
126 |
+
}
|
127 |
+
}
|
128 |
+
} catch (error) {
|
129 |
+
console.error("Error checking evaluation status:", error);
|
130 |
+
}
|
131 |
+
};
|
132 |
+
|
133 |
+
checkEvaluationStatus();
|
134 |
+
}
|
135 |
+
};
|
136 |
+
|
137 |
+
// Ajouter l'écouteur pour le changement de visibilité
|
138 |
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
139 |
+
|
140 |
if (isDefault) {
|
141 |
simulateEvaluation();
|
142 |
} else {
|
|
|
154 |
if (simulationTimeoutRef.current) {
|
155 |
clearTimeout(simulationTimeoutRef.current);
|
156 |
}
|
157 |
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
158 |
};
|
159 |
+
}, [isDefault, sessionId, evaluationComplete]);
|
160 |
|
161 |
// Simulate the evaluation process for pre-calculated documents
|
162 |
const simulateEvaluation = () => {
|
|
|
219 |
|
220 |
if (logsResponse.ok) {
|
221 |
const logsResult = await logsResponse.json();
|
222 |
+
|
223 |
+
// Vérifier si l'évaluation est terminée
|
224 |
if (logsResult.is_completed) {
|
225 |
setEvaluationComplete(true);
|
226 |
+
|
227 |
+
// Avancer à la dernière étape du message
|
228 |
+
setStartingMessageIndex(STARTING_MESSAGES.length - 1);
|
229 |
+
|
230 |
+
// Arrêter les intervalles
|
231 |
clearInterval(pollingIntervalRef.current);
|
232 |
+
if (startingMessageIntervalRef.current) {
|
233 |
+
clearInterval(startingMessageIntervalRef.current);
|
234 |
+
}
|
235 |
+
} else {
|
236 |
+
// Si l'évaluation est toujours en cours, estimer la progression
|
237 |
+
// en fonction du temps écoulé
|
238 |
+
const elapsedSinceStart = Date.now() - startTimeRef.current;
|
239 |
+
|
240 |
+
// Estimer la progression (en supposant qu'une évaluation prend environ 80 secondes)
|
241 |
+
const estimatedTotalTime = 80000; // 80 secondes
|
242 |
+
const estimatedProgress = Math.min(
|
243 |
+
elapsedSinceStart / estimatedTotalTime,
|
244 |
+
1
|
245 |
+
);
|
246 |
+
|
247 |
+
// Calculer l'étape estimée (0 à STARTING_MESSAGES.length - 1)
|
248 |
+
const estimatedStepIndex = Math.min(
|
249 |
+
Math.floor(estimatedProgress * STARTING_MESSAGES.length),
|
250 |
+
STARTING_MESSAGES.length - 1
|
251 |
+
);
|
252 |
+
|
253 |
+
// Mettre à jour l'index des messages de démarrage si nécessaire
|
254 |
+
if (estimatedStepIndex > startingMessageIndex) {
|
255 |
+
setStartingMessageIndex(estimatedStepIndex);
|
256 |
+
}
|
257 |
}
|
258 |
}
|
259 |
} catch (error) {
|
260 |
console.log("Error polling logs:", error);
|
261 |
+
// Ne pas arrêter le polling en cas d'erreurs réseau temporaires
|
262 |
}
|
263 |
}, 2000);
|
264 |
} else {
|
frontend/src/components/BenchmarkGenerator.jsx
CHANGED
@@ -98,6 +98,67 @@ const BenchmarkGenerator = ({ sessionId, isDefaultDocument, onComplete }) => {
|
|
98 |
setElapsedTime(timeElapsed);
|
99 |
}, 1000);
|
100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
if (isDefault) {
|
102 |
simulateGeneration();
|
103 |
} else {
|
@@ -115,8 +176,9 @@ const BenchmarkGenerator = ({ sessionId, isDefaultDocument, onComplete }) => {
|
|
115 |
if (simulationIntervalRef.current) {
|
116 |
clearInterval(simulationIntervalRef.current);
|
117 |
}
|
|
|
118 |
};
|
119 |
-
}, [isDefault]);
|
120 |
|
121 |
// Simulate the benchmark generation for pre-calculated documents
|
122 |
const simulateGeneration = () => {
|
@@ -167,10 +229,11 @@ const BenchmarkGenerator = ({ sessionId, isDefaultDocument, onComplete }) => {
|
|
167 |
useEffect(() => {
|
168 |
if (generationLogs.length === 0) return;
|
169 |
|
170 |
-
//
|
171 |
-
|
172 |
-
|
173 |
|
|
|
174 |
generationLogs.forEach((log) => {
|
175 |
const match = log.match(/\[SUCCESS\] Stage completed: (\w+)/);
|
176 |
if (match && match[1]) {
|
@@ -180,20 +243,28 @@ const BenchmarkGenerator = ({ sessionId, isDefaultDocument, onComplete }) => {
|
|
180 |
!newCompletedSteps.includes(completedStep)
|
181 |
) {
|
182 |
newCompletedSteps.push(completedStep);
|
183 |
-
// Set active step to the index of the next step
|
184 |
-
const stepIndex = BENCHMARK_STEPS.indexOf(completedStep);
|
185 |
-
if (stepIndex >= 0 && stepIndex + 1 > newActiveStep) {
|
186 |
-
newActiveStep = stepIndex + 1;
|
187 |
-
if (newActiveStep >= BENCHMARK_STEPS.length) {
|
188 |
-
newActiveStep = BENCHMARK_STEPS.length;
|
189 |
-
}
|
190 |
-
}
|
191 |
}
|
192 |
}
|
193 |
});
|
194 |
|
195 |
-
//
|
196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
197 |
setCompletedSteps(newCompletedSteps);
|
198 |
setActiveStep(newActiveStep);
|
199 |
}
|
@@ -214,8 +285,8 @@ const BenchmarkGenerator = ({ sessionId, isDefaultDocument, onComplete }) => {
|
|
214 |
"[SUCCESS] Configuration and ingestion completed successfully"
|
215 |
)
|
216 |
) ||
|
217 |
-
|
218 |
-
|
219 |
|
220 |
if (isComplete) {
|
221 |
setCurrentPhase("complete");
|
|
|
98 |
setElapsedTime(timeElapsed);
|
99 |
}, 1000);
|
100 |
|
101 |
+
// Gestionnaire pour détecter quand la page redevient visible
|
102 |
+
const handleVisibilityChange = () => {
|
103 |
+
if (
|
104 |
+
document.visibilityState === "visible" &&
|
105 |
+
!isDefault &&
|
106 |
+
!generationComplete
|
107 |
+
) {
|
108 |
+
console.log("Page became visible, checking for missed steps...");
|
109 |
+
// Force une nouvelle requête pour récupérer les logs
|
110 |
+
const checkCurrentState = async () => {
|
111 |
+
try {
|
112 |
+
// D'abord essayer de récupérer les logs de benchmark
|
113 |
+
const logsResponse = await fetch(
|
114 |
+
`${API_CONFIG.BASE_URL}/benchmark-logs/${sessionId}`
|
115 |
+
);
|
116 |
+
|
117 |
+
if (logsResponse.ok) {
|
118 |
+
const logsResult = await logsResponse.json();
|
119 |
+
if (logsResult.logs) {
|
120 |
+
setGenerationLogs(logsResult.logs);
|
121 |
+
}
|
122 |
+
|
123 |
+
// Si la tâche est terminée, mettre à jour l'état
|
124 |
+
if (logsResult.is_completed) {
|
125 |
+
setGenerationComplete(true);
|
126 |
+
if (pollingIntervalRef.current) {
|
127 |
+
clearInterval(pollingIntervalRef.current);
|
128 |
+
}
|
129 |
+
if (onComplete) {
|
130 |
+
onComplete({
|
131 |
+
success: true,
|
132 |
+
sessionId,
|
133 |
+
logs: logsResult.logs,
|
134 |
+
});
|
135 |
+
}
|
136 |
+
}
|
137 |
+
} else {
|
138 |
+
// Si la tâche de benchmark n'existe pas, essayer les logs de configuration
|
139 |
+
const configResponse = await fetch(
|
140 |
+
`${API_CONFIG.BASE_URL}/config-logs/${sessionId}`
|
141 |
+
);
|
142 |
+
|
143 |
+
if (configResponse.ok) {
|
144 |
+
const configResult = await configResponse.json();
|
145 |
+
if (configResult.logs) {
|
146 |
+
setGenerationLogs(configResult.logs);
|
147 |
+
}
|
148 |
+
}
|
149 |
+
}
|
150 |
+
} catch (error) {
|
151 |
+
console.error("Error checking for missed steps:", error);
|
152 |
+
}
|
153 |
+
};
|
154 |
+
|
155 |
+
checkCurrentState();
|
156 |
+
}
|
157 |
+
};
|
158 |
+
|
159 |
+
// Ajouter l'écouteur pour le changement de visibilité
|
160 |
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
161 |
+
|
162 |
if (isDefault) {
|
163 |
simulateGeneration();
|
164 |
} else {
|
|
|
176 |
if (simulationIntervalRef.current) {
|
177 |
clearInterval(simulationIntervalRef.current);
|
178 |
}
|
179 |
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
180 |
};
|
181 |
+
}, [isDefault, sessionId, generationComplete, onComplete]);
|
182 |
|
183 |
// Simulate the benchmark generation for pre-calculated documents
|
184 |
const simulateGeneration = () => {
|
|
|
229 |
useEffect(() => {
|
230 |
if (generationLogs.length === 0) return;
|
231 |
|
232 |
+
// Recalculer complètement les étapes complétées à chaque fois
|
233 |
+
// au lieu de simplement ajouter les nouvelles étapes
|
234 |
+
const newCompletedSteps = [];
|
235 |
|
236 |
+
// Identifier toutes les étapes complétées dans tous les logs
|
237 |
generationLogs.forEach((log) => {
|
238 |
const match = log.match(/\[SUCCESS\] Stage completed: (\w+)/);
|
239 |
if (match && match[1]) {
|
|
|
243 |
!newCompletedSteps.includes(completedStep)
|
244 |
) {
|
245 |
newCompletedSteps.push(completedStep);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
}
|
247 |
}
|
248 |
});
|
249 |
|
250 |
+
// Déterminer l'étape active basée sur les étapes complétées
|
251 |
+
let newActiveStep = 0;
|
252 |
+
if (newCompletedSteps.length > 0) {
|
253 |
+
// Trouver l'étape la plus avancée dans les logs
|
254 |
+
const maxCompletedStepIndex = Math.max(
|
255 |
+
...newCompletedSteps.map((step) => BENCHMARK_STEPS.indexOf(step))
|
256 |
+
);
|
257 |
+
newActiveStep = maxCompletedStepIndex + 1;
|
258 |
+
|
259 |
+
// S'assurer que l'activeStep ne dépasse pas le nombre total d'étapes
|
260 |
+
if (newActiveStep >= BENCHMARK_STEPS.length) {
|
261 |
+
newActiveStep = BENCHMARK_STEPS.length;
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
// Mettre à jour l'état si les étapes ont changé
|
266 |
+
// Comparer les tableaux avec JSON.stringify pour une comparaison profonde
|
267 |
+
if (JSON.stringify(newCompletedSteps) !== JSON.stringify(completedSteps)) {
|
268 |
setCompletedSteps(newCompletedSteps);
|
269 |
setActiveStep(newActiveStep);
|
270 |
}
|
|
|
285 |
"[SUCCESS] Configuration and ingestion completed successfully"
|
286 |
)
|
287 |
) ||
|
288 |
+
newCompletedSteps.includes("lighteval") ||
|
289 |
+
newActiveStep >= BENCHMARK_STEPS.length;
|
290 |
|
291 |
if (isComplete) {
|
292 |
setCurrentPhase("complete");
|
frontend/src/components/Intro.jsx
CHANGED
@@ -12,11 +12,18 @@ const Intro = () => {
|
|
12 |
<Box sx={{ textAlign: "center", mb: 4 }}>
|
13 |
<Box
|
14 |
sx={{
|
|
|
15 |
height: "60px",
|
16 |
-
mb: 4,
|
17 |
display: "flex",
|
18 |
justifyContent: "center",
|
19 |
cursor: "pointer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}}
|
21 |
onClick={handleLogoClick}
|
22 |
>
|
|
|
12 |
<Box sx={{ textAlign: "center", mb: 4 }}>
|
13 |
<Box
|
14 |
sx={{
|
15 |
+
width: "60px",
|
16 |
height: "60px",
|
|
|
17 |
display: "flex",
|
18 |
justifyContent: "center",
|
19 |
cursor: "pointer",
|
20 |
+
margin: "0 auto",
|
21 |
+
mb: 4,
|
22 |
+
opacity: 0.9,
|
23 |
+
transition: "opacity 0.3s ease",
|
24 |
+
"&:hover": {
|
25 |
+
opacity: 1,
|
26 |
+
},
|
27 |
}}
|
28 |
onClick={handleLogoClick}
|
29 |
>
|
frontend/src/components/Logo/HFLogo.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|