multimodalart HF Staff commited on
Commit
fcb9ec2
·
verified ·
1 Parent(s): dc3376a

add check before dataset upload

Browse files
ui/src/components/HFJobsWorkflow.tsx CHANGED
@@ -253,6 +253,18 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
253
  throw new Error('Unable to determine a namespace. Validate your HF token or set a namespace in Settings.');
254
  }
255
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  if (datasetSource === 'existing') {
257
  // Use existing dataset - just validate it exists
258
  if (!existingDatasetId) {
@@ -318,7 +330,7 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
318
  }
319
  }
320
  } catch (err: any) {
321
- setError(err.response?.data?.error || 'Failed to process dataset');
322
  } finally {
323
  setLoading(false);
324
  }
 
253
  throw new Error('Unable to determine a namespace. Validate your HF token or set a namespace in Settings.');
254
  }
255
 
256
+ if (requiresControlImages) {
257
+ if (!hasControlDataset) {
258
+ throw new Error('Instruction models require a control dataset. Please select or upload a control dataset before continuing.');
259
+ }
260
+
261
+ const samples = jobConfig?.config?.process?.[0]?.sample?.samples ?? [];
262
+ const missingCtrl = samples.filter((sample: any) => !sample?.ctrl_img || !String(sample.ctrl_img).trim());
263
+ if (missingCtrl.length > 0) {
264
+ throw new Error('Instruction models require a control image for every sample prompt. Please add control images before continuing.');
265
+ }
266
+ }
267
+
268
  if (datasetSource === 'existing') {
269
  // Use existing dataset - just validate it exists
270
  if (!existingDatasetId) {
 
330
  }
331
  }
332
  } catch (err: any) {
333
+ setError(err.response?.data?.error || err.message || 'Failed to process dataset');
334
  } finally {
335
  setLoading(false);
336
  }