Spaces:
Running on Zero
Running on Zero
Fix post-run settings editing and run-size feedback
Browse files- FRONTEND_SOURCE.json +7 -7
- RELEASE_MANIFEST.json +3 -3
- client.js +10 -6
- index.html +24 -6
FRONTEND_SOURCE.json
CHANGED
|
@@ -5,19 +5,19 @@
|
|
| 5 |
"source": "Runner r14 single-engine browser UI; selected .track tile renderer added from simulator atlas",
|
| 6 |
"source_sha256": "65d1e5f2c4e19b4951b828e82510005ab99a5270cf3dcb9f4eaa0fa1af8c40f8"
|
| 7 |
},
|
| 8 |
-
"client_sha256": "
|
| 9 |
"identity_note": "The historical source fields describe the base frontend; local packaged file hashes describe this candidate's derived frontend.",
|
| 10 |
-
"local_customization_id": "v1.2-
|
| 11 |
-
"output_sha256": "
|
| 12 |
"packaged_frontend_files": {
|
| 13 |
"assets/track-atlas.json": "d97c8900e3e5fb17734b5bd61d1f4f4b196d9be30af9848e2e273ae7e4079ae4",
|
| 14 |
-
"client.js": "
|
| 15 |
"help.html": "d9b1e3b87641d73d4504b54ee33fa3c7d0917ea9c9c454cc632665fd41ace950",
|
| 16 |
"hf-auth.js": "3f3938bbc0935e4e9230c094029ef46e03beea74be199887c50e053e03dafcfe",
|
| 17 |
-
"index.html": "
|
| 18 |
"track-library.js": "351ec4c026b49420ce963f4310cb000d9e987fd28e6dac5ecd0176509340f6e6",
|
| 19 |
"track-map.js": "ab5374aa49c7ccec90a787ee8c56cd71beb56b903bf2bbc322783e6f43c009f0"
|
| 20 |
},
|
| 21 |
-
"packaged_frontend_sha256": "
|
| 22 |
-
"status": "Local
|
| 23 |
}
|
|
|
|
| 5 |
"source": "Runner r14 single-engine browser UI; selected .track tile renderer added from simulator atlas",
|
| 6 |
"source_sha256": "65d1e5f2c4e19b4951b828e82510005ab99a5270cf3dcb9f4eaa0fa1af8c40f8"
|
| 7 |
},
|
| 8 |
+
"client_sha256": "33db7b712c5a217e9117ed988b413161a991e51c7160f701d4678368a0c8068f",
|
| 9 |
"identity_note": "The historical source fields describe the base frontend; local packaged file hashes describe this candidate's derived frontend.",
|
| 10 |
+
"local_customization_id": "v1.2-post-run-settings",
|
| 11 |
+
"output_sha256": "d9ac0ffeab82fae96a3de03112776ecd1895ec9d54a67e917e427fedda97940a",
|
| 12 |
"packaged_frontend_files": {
|
| 13 |
"assets/track-atlas.json": "d97c8900e3e5fb17734b5bd61d1f4f4b196d9be30af9848e2e273ae7e4079ae4",
|
| 14 |
+
"client.js": "33db7b712c5a217e9117ed988b413161a991e51c7160f701d4678368a0c8068f",
|
| 15 |
"help.html": "d9b1e3b87641d73d4504b54ee33fa3c7d0917ea9c9c454cc632665fd41ace950",
|
| 16 |
"hf-auth.js": "3f3938bbc0935e4e9230c094029ef46e03beea74be199887c50e053e03dafcfe",
|
| 17 |
+
"index.html": "d9ac0ffeab82fae96a3de03112776ecd1895ec9d54a67e917e427fedda97940a",
|
| 18 |
"track-library.js": "351ec4c026b49420ce963f4310cb000d9e987fd28e6dac5ecd0176509340f6e6",
|
| 19 |
"track-map.js": "ab5374aa49c7ccec90a787ee8c56cd71beb56b903bf2bbc322783e6f43c009f0"
|
| 20 |
},
|
| 21 |
+
"packaged_frontend_sha256": "bbb00919027590a62f1f86be6d085467d88f4841f86517d7b261af4261415de4",
|
| 22 |
+
"status": "Local post-run settings candidate; hosted verification pending"
|
| 23 |
}
|
RELEASE_MANIFEST.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
"CUDA_REFERENCE.md": "f7453c3254d244f8b0de41fde5851cb025159f5cea4a4d1a5d8208a955550c6c",
|
| 9 |
"DATA_POLICY.md": "fc5978528abe1c21c14882417ac8a706e04a0831bbd3fdb3de8c64442c1a7b3d",
|
| 10 |
"FEEDBACK.md": "f95b8f6afbf4a360976c0edca5d52f5b3a0b668c9a944d4947b840a7c53a122a",
|
| 11 |
-
"FRONTEND_SOURCE.json": "
|
| 12 |
"GODOT_LICENSE": "fb2b3bb82c60f1e76841ba2122eb902f8e39c151476fe21ce10c9a05d1045304",
|
| 13 |
"IMPORTER_BUILD_RECEIPT.json": "4ba5c533cc617105478e4d85c83f456a7dfa68b1388049624619871ba9e42e9d",
|
| 14 |
"LICENSE": "53d5851b6440feeae36f72a5f57fcab37858c48b7084765ece4b0c54b9a28ed8",
|
|
@@ -60,13 +60,13 @@
|
|
| 60 |
"builtin_tracks/tracks/Replica R08 Demolition Derby.track": "6f11a9ffbcb477c9d19964566b1b612d2a94675605246e93e21f27bbbdb357ef",
|
| 61 |
"builtin_tracks/tracks/Replica R09 Eau Noir.track": "3ec0a78478cca1a4f0d2d98ac81f40783928adf271b70f0c32d295a6da2cdaa9",
|
| 62 |
"builtin_tracks/tracks/Replica The Champions Trial.track": "a3bfb76422affc774b44c739b0636d08acb901fa7615b9adcb52c069f79834e1",
|
| 63 |
-
"client.js": "
|
| 64 |
"delivery.py": "6bdba2e87c3e19a41440cb16103695af27105f8bafbae38948bbb1b936ed0c1b",
|
| 65 |
"gpu_tickets.py": "b81aadb5ed42cec9212d44da7e7bbb7b413c5bd517383cac0b49ec9b4d659c92",
|
| 66 |
"help.html": "d9b1e3b87641d73d4504b54ee33fa3c7d0917ea9c9c454cc632665fd41ace950",
|
| 67 |
"hf-auth.js": "3f3938bbc0935e4e9230c094029ef46e03beea74be199887c50e053e03dafcfe",
|
| 68 |
"hf_identity.py": "913fb1e089af21f376e8359a20cbc838d5bcd7971def6989a4382d53c1127b37",
|
| 69 |
-
"index.html": "
|
| 70 |
"native/analysis.patch": "42f79de67cb0734cffb2a7582f5479cab42ab82675884b8b42b9f158d46a98e8",
|
| 71 |
"native/build-receipt.json": "559a7e4e382f9f7caa1c5ceb566a5a0bbefad2ed3a2e2cf604e31c9c3890c348",
|
| 72 |
"native/selective-freeze-build-receipt.json": "ed804b1cd49a9ba34abc6f7cadaf4fb97807e27f3d14af117f8292a2d3f2d172",
|
|
|
|
| 8 |
"CUDA_REFERENCE.md": "f7453c3254d244f8b0de41fde5851cb025159f5cea4a4d1a5d8208a955550c6c",
|
| 9 |
"DATA_POLICY.md": "fc5978528abe1c21c14882417ac8a706e04a0831bbd3fdb3de8c64442c1a7b3d",
|
| 10 |
"FEEDBACK.md": "f95b8f6afbf4a360976c0edca5d52f5b3a0b668c9a944d4947b840a7c53a122a",
|
| 11 |
+
"FRONTEND_SOURCE.json": "72f13c54789521848862ff61da9938d8887180399dda609da8e673757cd77602",
|
| 12 |
"GODOT_LICENSE": "fb2b3bb82c60f1e76841ba2122eb902f8e39c151476fe21ce10c9a05d1045304",
|
| 13 |
"IMPORTER_BUILD_RECEIPT.json": "4ba5c533cc617105478e4d85c83f456a7dfa68b1388049624619871ba9e42e9d",
|
| 14 |
"LICENSE": "53d5851b6440feeae36f72a5f57fcab37858c48b7084765ece4b0c54b9a28ed8",
|
|
|
|
| 60 |
"builtin_tracks/tracks/Replica R08 Demolition Derby.track": "6f11a9ffbcb477c9d19964566b1b612d2a94675605246e93e21f27bbbdb357ef",
|
| 61 |
"builtin_tracks/tracks/Replica R09 Eau Noir.track": "3ec0a78478cca1a4f0d2d98ac81f40783928adf271b70f0c32d295a6da2cdaa9",
|
| 62 |
"builtin_tracks/tracks/Replica The Champions Trial.track": "a3bfb76422affc774b44c739b0636d08acb901fa7615b9adcb52c069f79834e1",
|
| 63 |
+
"client.js": "33db7b712c5a217e9117ed988b413161a991e51c7160f701d4678368a0c8068f",
|
| 64 |
"delivery.py": "6bdba2e87c3e19a41440cb16103695af27105f8bafbae38948bbb1b936ed0c1b",
|
| 65 |
"gpu_tickets.py": "b81aadb5ed42cec9212d44da7e7bbb7b413c5bd517383cac0b49ec9b4d659c92",
|
| 66 |
"help.html": "d9b1e3b87641d73d4504b54ee33fa3c7d0917ea9c9c454cc632665fd41ace950",
|
| 67 |
"hf-auth.js": "3f3938bbc0935e4e9230c094029ef46e03beea74be199887c50e053e03dafcfe",
|
| 68 |
"hf_identity.py": "913fb1e089af21f376e8359a20cbc838d5bcd7971def6989a4382d53c1127b37",
|
| 69 |
+
"index.html": "d9ac0ffeab82fae96a3de03112776ecd1895ec9d54a67e917e427fedda97940a",
|
| 70 |
"native/analysis.patch": "42f79de67cb0734cffb2a7582f5479cab42ab82675884b8b42b9f158d46a98e8",
|
| 71 |
"native/build-receipt.json": "559a7e4e382f9f7caa1c5ceb566a5a0bbefad2ed3a2e2cf604e31c9c3890c348",
|
| 72 |
"native/selective-freeze-build-receipt.json": "ed804b1cd49a9ba34abc6f7cadaf4fb97807e27f3d14af117f8292a2d3f2d172",
|
client.js
CHANGED
|
@@ -55,10 +55,12 @@ async function runTrackSource(priorContext=null){
|
|
| 55 |
throw Error('Choose or select a track before starting this run.');
|
| 56 |
}
|
| 57 |
function buttons() {
|
| 58 |
-
const
|
|
|
|
| 59 |
trackLibrary?.setBusy(unavailable);
|
| 60 |
window.HFAuth?.setBusy(unavailable);
|
| 61 |
-
|
|
|
|
| 62 |
window.setEditorBusy?.(unavailable);
|
| 63 |
$('run').disabled = unavailable || !capabilitiesReady || !networkSource() || ($('backend').value==='gpu'&&!gpuAvailable);
|
| 64 |
$('backend').disabled = unavailable || !capabilitiesReady;
|
|
@@ -100,10 +102,10 @@ function buttons() {
|
|
| 100 |
if($('bucket_recipe_items'))$('bucket_recipe_items').disabled=unavailable||!bucketToken;
|
| 101 |
if($('bucket_recipe_import'))$('bucket_recipe_import').disabled=unavailable||!bucketToken||!$('bucket_recipe_items')?.value;
|
| 102 |
if($('bucket_autosave'))$('bucket_autosave').disabled=unavailable||!bucketToken;
|
| 103 |
-
syncRunModeUI(
|
| 104 |
}
|
| 105 |
const trainingOnlyControls=['population','generations','mutation','mutation_end','schedule','adaptive_mutation','selection','parents','elite','crossover','decay','preset','reward_preset','add','rewards'];
|
| 106 |
-
function syncRunModeUI(unavailable=busy||
|
| 107 |
const evaluation=$('run_mode')?.value==='evaluate';
|
| 108 |
for(const id of trainingOnlyControls){const node=$(id);if(node)node.disabled=unavailable||evaluation;}
|
| 109 |
if($('native_settings'))$('native_settings').hidden=evaluation;
|
|
@@ -1010,10 +1012,12 @@ $('run').onclick = async () => {
|
|
| 1010 |
say('Comparison stopped. Earlier verified results remain in the table. '+displayError(error));
|
| 1011 |
return;
|
| 1012 |
}
|
| 1013 |
-
|
|
|
|
| 1014 |
$('runState').style.color='#ffb5a2';
|
| 1015 |
const quotaRejected=isGpuQuotaError(error)||String(error?.message??'').startsWith('GPU allowance is exhausted for this request.');
|
| 1016 |
-
$('runSummary').textContent='
|
|
|
|
| 1017 |
? 'HF rejected this GPU request before a result was published.'
|
| 1018 |
: 'No downloadable result was received. A connection error does not prove the server stopped.');
|
| 1019 |
say(displayError(error));
|
|
|
|
| 55 |
throw Error('Choose or select a track before starting this run.');
|
| 56 |
}
|
| 57 |
function buttons() {
|
| 58 |
+
const settingsUnavailable=busy||bundleRestoring||bucketOperation;
|
| 59 |
+
const unavailable=settingsUnavailable||!!job;
|
| 60 |
trackLibrary?.setBusy(unavailable);
|
| 61 |
window.HFAuth?.setBusy(unavailable);
|
| 62 |
+
// A pending result blocks another run, but its receipt does not own the next recipe.
|
| 63 |
+
window.setTrainingBusy?.(settingsUnavailable,unavailable);
|
| 64 |
window.setEditorBusy?.(unavailable);
|
| 65 |
$('run').disabled = unavailable || !capabilitiesReady || !networkSource() || ($('backend').value==='gpu'&&!gpuAvailable);
|
| 66 |
$('backend').disabled = unavailable || !capabilitiesReady;
|
|
|
|
| 102 |
if($('bucket_recipe_items'))$('bucket_recipe_items').disabled=unavailable||!bucketToken;
|
| 103 |
if($('bucket_recipe_import'))$('bucket_recipe_import').disabled=unavailable||!bucketToken||!$('bucket_recipe_items')?.value;
|
| 104 |
if($('bucket_autosave'))$('bucket_autosave').disabled=unavailable||!bucketToken;
|
| 105 |
+
syncRunModeUI(settingsUnavailable);
|
| 106 |
}
|
| 107 |
const trainingOnlyControls=['population','generations','mutation','mutation_end','schedule','adaptive_mutation','selection','parents','elite','crossover','decay','preset','reward_preset','add','rewards'];
|
| 108 |
+
function syncRunModeUI(unavailable=busy||bundleRestoring||bucketOperation){
|
| 109 |
const evaluation=$('run_mode')?.value==='evaluate';
|
| 110 |
for(const id of trainingOnlyControls){const node=$(id);if(node)node.disabled=unavailable||evaluation;}
|
| 111 |
if($('native_settings'))$('native_settings').hidden=evaluation;
|
|
|
|
| 1012 |
say('Comparison stopped. Earlier verified results remain in the table. '+displayError(error));
|
| 1013 |
return;
|
| 1014 |
}
|
| 1015 |
+
const workLimit=error?.code==='TRAINING_WORK_LIMIT';
|
| 1016 |
+
$('runState').textContent=workLimit?'SETTINGS NEED ADJUSTMENT — no run started':'ERROR — no successful result confirmed';
|
| 1017 |
$('runState').style.color='#ffb5a2';
|
| 1018 |
const quotaRejected=isGpuQuotaError(error)||String(error?.message??'').startsWith('GPU allowance is exhausted for this request.');
|
| 1019 |
+
$('runSummary').textContent=workLimit?'No run was submitted. Change population, generations, or ticks on Training runs & presets, then try again.':
|
| 1020 |
+
'Elapsed: '+((performance.now()-started)/1000).toFixed(1)+' s\n'+(quotaRejected
|
| 1021 |
? 'HF rejected this GPU request before a result was published.'
|
| 1022 |
: 'No downloadable result was received. A connection error does not prove the server stopped.');
|
| 1023 |
say(displayError(error));
|
index.html
CHANGED
|
@@ -67,6 +67,7 @@
|
|
| 67 |
<details><summary>Effective training settings</summary><pre id="effectiveSettings"></pre></details><details><summary>Generation results</summary><pre id="generationHistory"></pre></details><details><summary>About star challenge checks</summary><p>After a run, supported conditions are checked against its named policy with a bounded fresh replay. Results appear in the Star challenge check panel when available. These are predictions for the reconstructed replica track, not original-game awards; opponent races and unsupported conditions are left unchecked.</p></details></section></div>
|
| 68 |
</div><section id="training" class="pane" hidden><div class="card"><h2>Training settings</h2><p class="hint">Choose the track on Drive & view. The first-run settings are a starting point; you can change them or load one of your saved recipes. Starting a new run never rewrites your saved recipes.</p><p><button id="starter_settings_reset" type="button">Apply first-run settings to this form</button> <span id="starter_settings_status" role="status" aria-live="polite">Saved recipes are unchanged.</span></p><p><label for="trackPresetTraining">Training track</label><select id="trackPresetTraining" data-track-library disabled><option value="">Upload a custom track</option></select></p><p data-track-status role="status" class="hint">Loading built-in replica tracks…</p><div id="training_controls"><label for="training_ticks">Simulated ticks per generation</label><input id="training_ticks" type="number" min="1" max="18000" value="900"><small>60 ticks = one simulated second. The first-run setting is 900 ticks (15 simulated seconds) per generation. Current preview limit: population × generations × ticks ≤ 4,000,000; execution timeout 25 seconds.</small>
|
| 69 |
<div class="row"><div><label for="population">Population</label><input id="population" type="number" min="1" max="128" value="32" disabled><small>1–128 cars in this beta. The first-run setting is 32.</small></div><div><label for="generations">Generations</label><input id="generations" type="number" min="1" max="1000" value="20" disabled><small>1–1,000; the first-run setting is 20.</small></div></div>
|
|
|
|
| 70 |
<label id="mutation_label" for="mutation">Mutation rate</label><input id="mutation" type="number" min="0" max="4.2" step="0.01" value="0.3" disabled><small>Use a positive mutation rate, including when continuing an uploaded network. A one-generation run still evaluates the uploaded parent.</small>
|
| 71 |
|
| 72 |
<details id="native_settings"><summary>Native evolution settings</summary>
|
|
@@ -328,13 +329,28 @@
|
|
| 328 |
const data={};for(const name of fields)data[name]=booleans.includes(name)?q(name).checked:strings.includes(name)?q(name).value:Number(q(name).value);
|
| 329 |
data.ticks=Number(q('training_ticks').value);data.rewards=rewards();data.freeze={layers:[...selectedFreeze.layers],inputs:[...selectedFreeze.inputs],outputs:[...selectedFreeze.outputs]};return api.settings(data);
|
| 330 |
}
|
| 331 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
function applySettings(value){
|
| 333 |
const data=api.settings(value);
|
| 334 |
for(const name of fields){if(booleans.includes(name))q(name).checked=data[name];else q(name).value=data[name];}
|
| 335 |
q('training_ticks').value=data.ticks;q('rewards').replaceChildren();data.rewards.forEach(rewardRow);
|
| 336 |
for(const kind of ['layers','inputs','outputs'])selectedFreeze[kind]=[...data.freeze[kind]];renderFreeze();
|
| 337 |
-
q('recipe_draft').value=JSON.stringify(data,null,2);
|
| 338 |
}
|
| 339 |
const editable=[...fields,'training_ticks','add','reward_preset','preset','starter_settings_reset'];
|
| 340 |
for(const id of editable)q(id).disabled=false;
|
|
@@ -354,11 +370,13 @@
|
|
| 354 |
message('Imported recipe staged in the training form. Save it explicitly to add it to this browser’s recipe library. No run started.');
|
| 355 |
};
|
| 356 |
q('recipe_slot').addEventListener('change',()=>{stagedPortableRecipe=false;});
|
| 357 |
-
window.setTrainingBusy=
|
| 358 |
-
for(const id of editable)q(id).disabled=
|
| 359 |
-
for(const node of q('rewards').querySelectorAll('input,select,button'))node.disabled=
|
| 360 |
-
for(const id of ['recipe_save','recipe_load','recipe_apply_draft','recipe_slot','recipe_name','recipe_import','recipe_clear','batch_save','batch_load','batch_slot','batch_name','batch_recipe_sequence','carry','queue_add','batch_add_recipe'])q(id).disabled=
|
| 361 |
};
|
|
|
|
|
|
|
| 362 |
q('add').onclick=()=>{if(q('rewards').children.length>=5)return;const used=rewards().map(r=>r.metric);rewardRow({metric:api.metrics.find(m=>!used.includes(m)),type:'default',weight:1});q('reward_preset').value='custom';};
|
| 363 |
q('reward_preset').onchange=()=>{
|
| 364 |
const key=q('reward_preset').value;if(key==='custom')return;
|
|
|
|
| 67 |
<details><summary>Effective training settings</summary><pre id="effectiveSettings"></pre></details><details><summary>Generation results</summary><pre id="generationHistory"></pre></details><details><summary>About star challenge checks</summary><p>After a run, supported conditions are checked against its named policy with a bounded fresh replay. Results appear in the Star challenge check panel when available. These are predictions for the reconstructed replica track, not original-game awards; opponent races and unsupported conditions are left unchecked.</p></details></section></div>
|
| 68 |
</div><section id="training" class="pane" hidden><div class="card"><h2>Training settings</h2><p class="hint">Choose the track on Drive & view. The first-run settings are a starting point; you can change them or load one of your saved recipes. Starting a new run never rewrites your saved recipes.</p><p><button id="starter_settings_reset" type="button">Apply first-run settings to this form</button> <span id="starter_settings_status" role="status" aria-live="polite">Saved recipes are unchanged.</span></p><p><label for="trackPresetTraining">Training track</label><select id="trackPresetTraining" data-track-library disabled><option value="">Upload a custom track</option></select></p><p data-track-status role="status" class="hint">Loading built-in replica tracks…</p><div id="training_controls"><label for="training_ticks">Simulated ticks per generation</label><input id="training_ticks" type="number" min="1" max="18000" value="900"><small>60 ticks = one simulated second. The first-run setting is 900 ticks (15 simulated seconds) per generation. Current preview limit: population × generations × ticks ≤ 4,000,000; execution timeout 25 seconds.</small>
|
| 69 |
<div class="row"><div><label for="population">Population</label><input id="population" type="number" min="1" max="128" value="32" disabled><small>1–128 cars in this beta. The first-run setting is 32.</small></div><div><label for="generations">Generations</label><input id="generations" type="number" min="1" max="1000" value="20" disabled><small>1–1,000; the first-run setting is 20.</small></div></div>
|
| 70 |
+
<p id="work_budget" class="hint" role="status" aria-live="polite"></p>
|
| 71 |
<label id="mutation_label" for="mutation">Mutation rate</label><input id="mutation" type="number" min="0" max="4.2" step="0.01" value="0.3" disabled><small>Use a positive mutation rate, including when continuing an uploaded network. A one-generation run still evaluates the uploaded parent.</small>
|
| 72 |
|
| 73 |
<details id="native_settings"><summary>Native evolution settings</summary>
|
|
|
|
| 329 |
const data={};for(const name of fields)data[name]=booleans.includes(name)?q(name).checked:strings.includes(name)?q(name).value:Number(q(name).value);
|
| 330 |
data.ticks=Number(q('training_ticks').value);data.rewards=rewards();data.freeze={layers:[...selectedFreeze.layers],inputs:[...selectedFreeze.inputs],outputs:[...selectedFreeze.outputs]};return api.settings(data);
|
| 331 |
}
|
| 332 |
+
function updateWorkBudget(){
|
| 333 |
+
const p=Number(q('population').value),g=Number(q('generations').value),t=Number(q('training_ticks').value),box=q('work_budget');
|
| 334 |
+
if(q('run_mode')?.value==='evaluate'){box.textContent='Frozen evaluation uses one car and one generation; the training population and generation count do not apply.';box.style.color='';return;}
|
| 335 |
+
if(![p,g,t].every(n=>Number.isInteger(n)&&n>0)){box.textContent='Enter positive whole numbers to see the run size.';box.style.color='';return;}
|
| 336 |
+
const work=p*g*t,maximum=4000000,maxGenerations=Math.floor(maximum/(p*t));
|
| 337 |
+
box.textContent='Planned work: '+work.toLocaleString()+' / 4,000,000 vehicle-ticks'+(work>maximum?'. Too large; at '+p+' cars and '+t+' ticks, '+(maxGenerations?'use at most '+maxGenerations+' generations':'reduce cars or ticks first')+'.':'.');
|
| 338 |
+
box.style.color=work>maximum?'#ffb5a2':'';
|
| 339 |
+
}
|
| 340 |
+
function executableSettings(){
|
| 341 |
+
const data=currentSettings(),work=data.population*data.generations*data.ticks;
|
| 342 |
+
if(q('run_mode')?.value!=='evaluate'&&work>4000000){
|
| 343 |
+
const maxGenerations=Math.floor(4000000/(data.population*data.ticks));
|
| 344 |
+
throw Object.assign(Error('This recipe needs '+work.toLocaleString()+' vehicle-ticks (limit 4,000,000). At '+data.population+' cars and '+data.ticks+' ticks, '+(maxGenerations?'use at most '+maxGenerations+' generations':'reduce cars or ticks first')+'.'),{code:'TRAINING_WORK_LIMIT'});
|
| 345 |
+
}
|
| 346 |
+
return data;
|
| 347 |
+
}
|
| 348 |
function applySettings(value){
|
| 349 |
const data=api.settings(value);
|
| 350 |
for(const name of fields){if(booleans.includes(name))q(name).checked=data[name];else q(name).value=data[name];}
|
| 351 |
q('training_ticks').value=data.ticks;q('rewards').replaceChildren();data.rewards.forEach(rewardRow);
|
| 352 |
for(const kind of ['layers','inputs','outputs'])selectedFreeze[kind]=[...data.freeze[kind]];renderFreeze();
|
| 353 |
+
q('recipe_draft').value=JSON.stringify(data,null,2);updateWorkBudget();
|
| 354 |
}
|
| 355 |
const editable=[...fields,'training_ticks','add','reward_preset','preset','starter_settings_reset'];
|
| 356 |
for(const id of editable)q(id).disabled=false;
|
|
|
|
| 370 |
message('Imported recipe staged in the training form. Save it explicitly to add it to this browser’s recipe library. No run started.');
|
| 371 |
};
|
| 372 |
q('recipe_slot').addEventListener('change',()=>{stagedPortableRecipe=false;});
|
| 373 |
+
window.setTrainingBusy=(settingsBusy,controlsBusy=settingsBusy)=>{
|
| 374 |
+
for(const id of editable)q(id).disabled=settingsBusy;
|
| 375 |
+
for(const node of q('rewards').querySelectorAll('input,select,button'))node.disabled=settingsBusy;
|
| 376 |
+
for(const id of ['recipe_save','recipe_load','recipe_apply_draft','recipe_slot','recipe_name','recipe_import','recipe_clear','batch_save','batch_load','batch_slot','batch_name','batch_recipe_sequence','carry','queue_add','batch_add_recipe'])q(id).disabled=controlsBusy;
|
| 377 |
};
|
| 378 |
+
for(const id of ['population','generations','training_ticks'])q(id).addEventListener('input',updateWorkBudget);
|
| 379 |
+
q('run_mode')?.addEventListener('change',updateWorkBudget);
|
| 380 |
q('add').onclick=()=>{if(q('rewards').children.length>=5)return;const used=rewards().map(r=>r.metric);rewardRow({metric:api.metrics.find(m=>!used.includes(m)),type:'default',weight:1});q('reward_preset').value='custom';};
|
| 381 |
q('reward_preset').onchange=()=>{
|
| 382 |
const key=q('reward_preset').value;if(key==='custom')return;
|