Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
make the hackathon on by default
Browse files
ui/src/components/HFJobsWorkflow.tsx
CHANGED
|
@@ -152,7 +152,8 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
|
|
| 152 |
const [hardware, setHardware] = useState(settings.HF_JOBS_DEFAULT_HARDWARE || 'a100-large');
|
| 153 |
const [namespace, setNamespace] = useState(settings.HF_JOBS_NAMESPACE || '');
|
| 154 |
const [autoUpload, setAutoUpload] = useState(true);
|
| 155 |
-
const [participateHackathon, setParticipateHackathon] = useState(
|
|
|
|
| 156 |
|
| 157 |
const requiresControlImages = (() => {
|
| 158 |
try {
|
|
@@ -163,6 +164,14 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
|
|
| 163 |
}
|
| 164 |
})();
|
| 165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
const hasControlDataset = (() => {
|
| 167 |
try {
|
| 168 |
const datasets = jobConfig?.config?.process?.[0]?.datasets ?? [];
|
|
@@ -179,10 +188,17 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
|
|
| 179 |
})();
|
| 180 |
|
| 181 |
useEffect(() => {
|
| 182 |
-
if (!hackathonEligible
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
}
|
| 185 |
-
}, [hackathonEligible, participateHackathon]);
|
| 186 |
|
| 187 |
// Progress state
|
| 188 |
const [validationResult, setValidationResult] = useState<any>(null);
|
|
@@ -330,12 +346,14 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
|
|
| 330 |
return;
|
| 331 |
}
|
| 332 |
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
|
|
|
|
|
|
| 339 |
}
|
| 340 |
}
|
| 341 |
|
|
@@ -456,7 +474,10 @@ export default function HFJobsWorkflow({ jobConfig, onComplete, hackathonEligibl
|
|
| 456 |
</span>
|
| 457 |
}
|
| 458 |
checked={participateHackathon}
|
| 459 |
-
onChange={value =>
|
|
|
|
|
|
|
|
|
|
| 460 |
/>
|
| 461 |
)}
|
| 462 |
<p className="text-sm text-gray-400">
|
|
|
|
| 152 |
const [hardware, setHardware] = useState(settings.HF_JOBS_DEFAULT_HARDWARE || 'a100-large');
|
| 153 |
const [namespace, setNamespace] = useState(settings.HF_JOBS_NAMESPACE || '');
|
| 154 |
const [autoUpload, setAutoUpload] = useState(true);
|
| 155 |
+
const [participateHackathon, setParticipateHackathon] = useState(() => hackathonEligible);
|
| 156 |
+
const [participationTouched, setParticipationTouched] = useState(false);
|
| 157 |
|
| 158 |
const requiresControlImages = (() => {
|
| 159 |
try {
|
|
|
|
| 164 |
}
|
| 165 |
})();
|
| 166 |
|
| 167 |
+
const samplingDisabled = (() => {
|
| 168 |
+
try {
|
| 169 |
+
return Boolean(jobConfig?.config?.process?.[0]?.train?.disable_sampling);
|
| 170 |
+
} catch (error) {
|
| 171 |
+
return false;
|
| 172 |
+
}
|
| 173 |
+
})();
|
| 174 |
+
|
| 175 |
const hasControlDataset = (() => {
|
| 176 |
try {
|
| 177 |
const datasets = jobConfig?.config?.process?.[0]?.datasets ?? [];
|
|
|
|
| 188 |
})();
|
| 189 |
|
| 190 |
useEffect(() => {
|
| 191 |
+
if (!hackathonEligible) {
|
| 192 |
+
if (participateHackathon) {
|
| 193 |
+
setParticipateHackathon(false);
|
| 194 |
+
}
|
| 195 |
+
if (participationTouched) {
|
| 196 |
+
setParticipationTouched(false);
|
| 197 |
+
}
|
| 198 |
+
} else if (!participateHackathon && !participationTouched) {
|
| 199 |
+
setParticipateHackathon(true);
|
| 200 |
}
|
| 201 |
+
}, [hackathonEligible, participateHackathon, participationTouched]);
|
| 202 |
|
| 203 |
// Progress state
|
| 204 |
const [validationResult, setValidationResult] = useState<any>(null);
|
|
|
|
| 346 |
return;
|
| 347 |
}
|
| 348 |
|
| 349 |
+
if (!samplingDisabled) {
|
| 350 |
+
const samples = jobConfig?.config?.process?.[0]?.sample?.samples ?? [];
|
| 351 |
+
const missingCtrl = samples.filter((sample: any) => !sample?.ctrl_img || !String(sample.ctrl_img).trim());
|
| 352 |
+
if (missingCtrl.length > 0) {
|
| 353 |
+
setError('Instruction models require a control image for every sample prompt. Please add control images before submitting.');
|
| 354 |
+
setLoading(false);
|
| 355 |
+
return;
|
| 356 |
+
}
|
| 357 |
}
|
| 358 |
}
|
| 359 |
|
|
|
|
| 474 |
</span>
|
| 475 |
}
|
| 476 |
checked={participateHackathon}
|
| 477 |
+
onChange={value => {
|
| 478 |
+
setParticipationTouched(true);
|
| 479 |
+
setParticipateHackathon(value);
|
| 480 |
+
}}
|
| 481 |
/>
|
| 482 |
)}
|
| 483 |
<p className="text-sm text-gray-400">
|