Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
moar fixes
Browse files
ui/src/app/api/hf-jobs/route.ts
CHANGED
|
@@ -617,7 +617,7 @@ def generate_model_card_readme(repo_id: str, config: dict, model_name: str, cura
|
|
| 617 |
|
| 618 |
gallery_section = ""
|
| 619 |
if prompt_bullets:
|
| 620 |
-
gallery_section = "<Gallery
|
| 621 |
|
| 622 |
# Determine torch dtype based on model
|
| 623 |
dtype = "torch.bfloat16" if "flux" in arch.lower() else "torch.float16"
|
|
|
|
| 617 |
|
| 618 |
gallery_section = ""
|
| 619 |
if prompt_bullets:
|
| 620 |
+
gallery_section = "<Gallery />\\n\\n" + "### Prompts\\n\\n" + "\\n".join(prompt_bullets) + "\\n\\n"
|
| 621 |
|
| 622 |
# Determine torch dtype based on model
|
| 623 |
dtype = "torch.bfloat16" if "flux" in arch.lower() else "torch.float16"
|
ui/src/app/jobs/new/SimpleJob.tsx
CHANGED
|
@@ -136,7 +136,6 @@ export default function SimpleJob({
|
|
| 136 |
docKey="config.name"
|
| 137 |
onChange={value => setJobConfig(value, 'config.name')}
|
| 138 |
placeholder="Enter training name"
|
| 139 |
-
disabled={runId !== null}
|
| 140 |
required
|
| 141 |
/>
|
| 142 |
<SelectInput
|
|
|
|
| 136 |
docKey="config.name"
|
| 137 |
onChange={value => setJobConfig(value, 'config.name')}
|
| 138 |
placeholder="Enter training name"
|
|
|
|
| 139 |
required
|
| 140 |
/>
|
| 141 |
<SelectInput
|
ui/src/app/jobs/new/page.tsx
CHANGED
|
@@ -293,6 +293,8 @@ export default function TrainingForm() {
|
|
| 293 |
// Redirect to the job detail page
|
| 294 |
if (localJobId) {
|
| 295 |
router.push(`/jobs/${localJobId}`);
|
|
|
|
|
|
|
| 296 |
}
|
| 297 |
}}
|
| 298 |
forceHFBackend={usingBrowserDb}
|
|
|
|
| 293 |
// Redirect to the job detail page
|
| 294 |
if (localJobId) {
|
| 295 |
router.push(`/jobs/${localJobId}`);
|
| 296 |
+
} else {
|
| 297 |
+
router.push('/jobs');
|
| 298 |
}
|
| 299 |
}}
|
| 300 |
forceHFBackend={usingBrowserDb}
|
ui/src/components/HFJobsWorkflow.tsx
CHANGED
|
@@ -333,9 +333,37 @@ export default function HFJobsWorkflow({ jobConfig, onComplete }: HFJobsWorkflow
|
|
| 333 |
console.log('Saved HF Job to local storage:', savedJob);
|
| 334 |
} catch (localSaveError: any) {
|
| 335 |
console.warn('Failed to save HF Job locally:', localSaveError);
|
| 336 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
}
|
| 338 |
-
|
| 339 |
setJobResult({
|
| 340 |
jobId: hfJobId,
|
| 341 |
message: response.data.message,
|
|
|
|
| 333 |
console.log('Saved HF Job to local storage:', savedJob);
|
| 334 |
} catch (localSaveError: any) {
|
| 335 |
console.warn('Failed to save HF Job locally:', localSaveError);
|
| 336 |
+
// Attempt to create a fallback entry with a unique name if the conflict is due to duplicates
|
| 337 |
+
if (localSaveError?.code === 'P2002') {
|
| 338 |
+
const fallbackName = `${jobConfig.config.name}-${hfJobId?.slice(-6) || Date.now()}`.replace(/[^a-zA-Z0-9-_]/g, '_');
|
| 339 |
+
try {
|
| 340 |
+
const savedJob = await upsertJob({
|
| 341 |
+
name: `${fallbackName}-hf-cloud`,
|
| 342 |
+
gpu_ids: hardware,
|
| 343 |
+
job_config: {
|
| 344 |
+
...jobConfig,
|
| 345 |
+
hf_job_id: hfJobId,
|
| 346 |
+
hf_job_url:
|
| 347 |
+
hfJobId !== 'unknown' && resolvedNamespace
|
| 348 |
+
? `https://huggingface.co/jobs/${resolvedNamespace}/${hfJobId}`
|
| 349 |
+
: null,
|
| 350 |
+
dataset_repo: datasetRepo,
|
| 351 |
+
hardware,
|
| 352 |
+
is_hf_job: true,
|
| 353 |
+
training_backend: 'hf-jobs',
|
| 354 |
+
hf_job_submitted: true,
|
| 355 |
+
},
|
| 356 |
+
info: response.data.message || 'HF Job submitted',
|
| 357 |
+
status: 'submitted',
|
| 358 |
+
});
|
| 359 |
+
localJobId = savedJob.id;
|
| 360 |
+
console.log('Saved HF Job with fallback name:', savedJob);
|
| 361 |
+
} catch (fallbackError) {
|
| 362 |
+
console.warn('Fallback save for HF Job failed:', fallbackError);
|
| 363 |
+
}
|
| 364 |
+
}
|
| 365 |
}
|
| 366 |
+
|
| 367 |
setJobResult({
|
| 368 |
jobId: hfJobId,
|
| 369 |
message: response.data.message,
|