multimodalart HF Staff commited on
Commit
4ee5618
·
verified ·
1 Parent(s): 8dbe163

add banner and correct job tracking for org

Browse files
ui/src/app/api/hf-hub/route.ts CHANGED
@@ -2,6 +2,7 @@ import { NextRequest, NextResponse } from 'next/server';
2
  import { whoAmI, createRepo, uploadFiles, datasetInfo } from '@huggingface/hub';
3
  import { readdir, stat, readFile } from 'fs/promises';
4
  import path from 'path';
 
5
 
6
  export async function POST(request: NextRequest) {
7
  try {
 
2
  import { whoAmI, createRepo, uploadFiles, datasetInfo } from '@huggingface/hub';
3
  import { readdir, stat, readFile } from 'fs/promises';
4
  import path from 'path';
5
+ import { File } from 'undici';
6
 
7
  export async function POST(request: NextRequest) {
8
  try {
ui/src/app/api/hf-jobs/route.ts CHANGED
@@ -59,16 +59,20 @@ export async function POST(request: NextRequest) {
59
  await writeFile(scriptPath, uvScript);
60
 
61
  // Submit HF job using uv run
 
62
  const jobId = await submitHFJobUV(
63
  token,
64
  hardware,
65
  scriptPath,
66
- participateHackathon ? 'lora-training-frenzi' : undefined
67
  );
68
 
 
 
69
  return NextResponse.json({
70
  success: true,
71
  jobId,
 
72
  message: `Job submitted successfully with ID: ${jobId}`
73
  });
74
  } catch (error: any) {
 
59
  await writeFile(scriptPath, uvScript);
60
 
61
  // Submit HF job using uv run
62
+ const namespaceOverride = participateHackathon ? 'lora-training-frenzi' : undefined;
63
  const jobId = await submitHFJobUV(
64
  token,
65
  hardware,
66
  scriptPath,
67
+ namespaceOverride
68
  );
69
 
70
+ const jobNamespace = namespaceOverride ?? namespace;
71
+
72
  return NextResponse.json({
73
  success: true,
74
  jobId,
75
+ jobNamespace,
76
  message: `Job submitted successfully with ID: ${jobId}`
77
  });
78
  } catch (error: any) {
ui/src/app/dashboard/page.tsx CHANGED
@@ -59,8 +59,27 @@ export default function Dashboard() {
59
  </Link>
60
  </div>
61
  ) : (
62
- <div className="flex flex-wrap items-center gap-3 text-sm">
63
- <HFLoginButton size="md" />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  <Link
65
  href="/settings"
66
  className="text-xs text-blue-400 hover:text-blue-300"
 
59
  </Link>
60
  </div>
61
  ) : (
62
+ <div className="flex flex-col gap-4 text-sm">
63
+ <p className="text-sm text-gray-300">
64
+ If you are joining for the hackathon, please join this{' '}
65
+ <a
66
+ href="https://huggingface.co/organizations/lora-training-frenzi/share/kEyyVNQXBPWqmARdwHFVdIiFqqONHZPOtz"
67
+ target="_blank"
68
+ rel="noopener noreferrer"
69
+ className="text-blue-400 underline"
70
+ >
71
+ organization
72
+ </a>{' '}
73
+ and authorize the <code className="bg-gray-800 px-1 rounded">lorafrenzi</code> organization when logging in.
74
+ </p>
75
+ <div className="flex flex-wrap items-start gap-4">
76
+ <HFLoginButton size="md" />
77
+ <img
78
+ src="https://huggingface.co/spaces/multimodalart/ai-toolkit/resolve/main/add_org_to_oauth.png"
79
+ alt="Authorize lorafrenzi organization"
80
+ className="max-w-xs rounded border border-gray-800"
81
+ />
82
+ </div>
83
  <Link
84
  href="/settings"
85
  className="text-xs text-blue-400 hover:text-blue-300"
ui/src/components/HFJobsWorkflow.tsx CHANGED
@@ -314,7 +314,8 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
314
 
315
  if (response.data.success) {
316
  const hfJobId = response.data.jobId;
317
-
 
318
  // Save job to local database for tracking
319
  let localJobId = undefined;
320
  try {
@@ -325,8 +326,8 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
325
  ...jobConfig,
326
  hf_job_id: hfJobId,
327
  hf_job_url:
328
- hfJobId !== 'unknown' && resolvedNamespace
329
- ? `https://huggingface.co/jobs/${resolvedNamespace}/${hfJobId}`
330
  : null,
331
  dataset_repo: datasetRepo,
332
  hardware,
@@ -353,8 +354,8 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
353
  ...jobConfig,
354
  hf_job_id: hfJobId,
355
  hf_job_url:
356
- hfJobId !== 'unknown' && resolvedNamespace
357
- ? `https://huggingface.co/jobs/${resolvedNamespace}/${hfJobId}`
358
  : null,
359
  dataset_repo: datasetRepo,
360
  hardware,
@@ -377,6 +378,7 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
377
  jobId: hfJobId,
378
  message: response.data.message,
379
  localJobId: localJobId,
 
380
  });
381
  setCurrentStep('complete');
382
  onComplete(hfJobId, localJobId);
@@ -583,10 +585,11 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
583
  </p>
584
  {jobResult?.jobId && jobResult.jobId !== 'unknown' && (
585
  <p className="text-sm">
586
- <strong>Monitor Job:</strong> <a
587
- href={`https://huggingface.co/jobs/${namespace}/${jobResult.jobId}`}
588
- target="_blank"
589
- rel="noopener noreferrer"
 
590
  className="text-blue-400 underline"
591
  >
592
  View on HF Jobs →
@@ -594,7 +597,15 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
594
  </p>
595
  )}
596
  <p className="text-sm">
597
- <strong>Dataset:</strong> <a href={uploadResult?.url} target="_blank" rel="noopener noreferrer" className="text-blue-400 underline">{uploadResult?.repoId}</a>
 
 
 
 
 
 
 
 
598
  </p>
599
  <p className="text-sm">
600
  <strong>Hardware:</strong> {hardware}
 
314
 
315
  if (response.data.success) {
316
  const hfJobId = response.data.jobId;
317
+ const jobNamespace = response.data.jobNamespace || resolvedNamespace;
318
+
319
  // Save job to local database for tracking
320
  let localJobId = undefined;
321
  try {
 
326
  ...jobConfig,
327
  hf_job_id: hfJobId,
328
  hf_job_url:
329
+ hfJobId !== 'unknown'
330
+ ? `https://huggingface.co/jobs/${jobNamespace}/${hfJobId}`
331
  : null,
332
  dataset_repo: datasetRepo,
333
  hardware,
 
354
  ...jobConfig,
355
  hf_job_id: hfJobId,
356
  hf_job_url:
357
+ hfJobId !== 'unknown'
358
+ ? `https://huggingface.co/jobs/${jobNamespace}/${hfJobId}`
359
  : null,
360
  dataset_repo: datasetRepo,
361
  hardware,
 
378
  jobId: hfJobId,
379
  message: response.data.message,
380
  localJobId: localJobId,
381
+ jobNamespace,
382
  });
383
  setCurrentStep('complete');
384
  onComplete(hfJobId, localJobId);
 
585
  </p>
586
  {jobResult?.jobId && jobResult.jobId !== 'unknown' && (
587
  <p className="text-sm">
588
+ <strong>Monitor Job:</strong>{' '}
589
+ <a
590
+ href={`https://huggingface.co/jobs/${jobResult.jobNamespace || namespace}/${jobResult.jobId}`}
591
+ target="_blank"
592
+ rel="noopener noreferrer"
593
  className="text-blue-400 underline"
594
  >
595
  View on HF Jobs →
 
597
  </p>
598
  )}
599
  <p className="text-sm">
600
+ <strong>Dataset:</strong>{' '}
601
+ <a
602
+ href={uploadResult?.url}
603
+ target="_blank"
604
+ rel="noopener noreferrer"
605
+ className="text-blue-400 underline"
606
+ >
607
+ {uploadResult?.repoId}
608
+ </a>
609
  </p>
610
  <p className="text-sm">
611
  <strong>Hardware:</strong> {hardware}