Explorar o código

修复前端报错

lxylxy123321 hai 1 semana
pai
achega
c5e58c2e87
Modificáronse 2 ficheiros con 9 adicións e 9 borrados
  1. 4 4
      frontend/src/pages/Inference.tsx
  2. 5 5
      frontend/src/pages/Training.tsx

+ 4 - 4
frontend/src/pages/Inference.tsx

@@ -154,19 +154,19 @@ export function Inference() {
           <div style={{ display: 'grid', gridTemplateColumns: 'repeat(4, 1fr)', gap: 12 }}>
             <div>
               <label style={{ display: 'block', fontSize: 12, color: '#888', marginBottom: 4 }}>最大输出长度</label>
-              <Select options={MAX_TOKEN_PRESETS} value={maxTokens} onChange={setMaxTokens} />
+              <Select options={MAX_TOKEN_PRESETS} value={String(maxTokens)} onChange={v => setMaxTokens(Number(v))} />
             </div>
             <div>
               <label style={{ display: 'block', fontSize: 12, color: '#888', marginBottom: 4 }}>Temperature</label>
-              <Select options={TEMP_PRESETS} value={temperature} onChange={setTemperature} />
+              <Select options={TEMP_PRESETS} value={String(temperature)} onChange={v => setTemperature(Number(v))} />
             </div>
             <div>
               <label style={{ display: 'block', fontSize: 12, color: '#888', marginBottom: 4 }}>Top P</label>
-              <Select options={TOP_P_PRESETS} value={topP} onChange={setTopP} />
+              <Select options={TOP_P_PRESETS} value={String(topP)} onChange={v => setTopP(Number(v))} />
             </div>
             <div>
               <label style={{ display: 'block', fontSize: 12, color: '#888', marginBottom: 4 }}>重复惩罚</label>
-              <Select options={REP_PENALTY_PRESETS} value={repetitionPenalty} onChange={setRepetitionPenalty} />
+              <Select options={REP_PENALTY_PRESETS} value={String(repetitionPenalty)} onChange={v => setRepetitionPenalty(Number(v))} />
             </div>
           </div>
 

+ 5 - 5
frontend/src/pages/Training.tsx

@@ -449,15 +449,15 @@ export function Training() {
         <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 12, marginBottom: 16 }}>
           <div>
             <label style={{ display: 'block', fontSize: 12, color: '#666', marginBottom: 4 }}>训练轮数 (Epochs)</label>
-            <Select options={EPOCH_PRESETS} value={epochs} onChange={setEpochs} />
+            <Select options={EPOCH_PRESETS} value={String(epochs)} onChange={v => setEpochs(Number(v))} />
           </div>
           <div>
             <label style={{ display: 'block', fontSize: 12, color: '#666', marginBottom: 4 }}>批次大小 (Batch Size)</label>
-            <Select options={BATCH_SIZE_PRESETS} value={batchSize} onChange={setBatchSize} />
+            <Select options={BATCH_SIZE_PRESETS} value={String(batchSize)} onChange={v => setBatchSize(Number(v))} />
           </div>
           <div>
             <label style={{ display: 'block', fontSize: 12, color: '#666', marginBottom: 4 }}>梯度累积</label>
-            <Select options={GRAD_ACC_PRESETS} value={gradAcc} onChange={setGradAcc} />
+            <Select options={GRAD_ACC_PRESETS} value={String(gradAcc)} onChange={v => setGradAcc(Number(v))} />
           </div>
           <div>
             <label style={{ display: 'block', fontSize: 12, color: '#666', marginBottom: 4 }}>学习率</label>
@@ -465,11 +465,11 @@ export function Training() {
           </div>
           <div>
             <label style={{ display: 'block', fontSize: 12, color: '#666', marginBottom: 4 }}>最大序列长度</label>
-            <Select options={SEQ_LEN_PRESETS} value={seqLen} onChange={setSeqLen} />
+            <Select options={SEQ_LEN_PRESETS} value={String(seqLen)} onChange={v => setSeqLen(Number(v))} />
           </div>
           <div>
             <label style={{ display: 'block', fontSize: 12, color: '#666', marginBottom: 4 }}>LoRA Rank (R)</label>
-            <Select options={LORA_R_PRESETS} value={loraR} onChange={setLoraR} />
+            <Select options={LORA_R_PRESETS} value={String(loraR)} onChange={v => setLoraR(Number(v))} />
           </div>
         </div>