Add LM Backend selector (PT vs VLLM) to reduce VRAM usage
PT backend uses ~1.6 GB VRAM vs ~9.2 GB for VLLM, making it accessible on lower-end GPUs. Adds dropdown in Advanced Settings defaulting to PT.
This commit is contained in:
@@ -596,6 +596,7 @@ export default function App() {
|
||||
lmTopK: params.lmTopK,
|
||||
lmTopP: params.lmTopP,
|
||||
lmNegativePrompt: params.lmNegativePrompt,
|
||||
lmBackend: params.lmBackend,
|
||||
referenceAudioUrl: params.referenceAudioUrl,
|
||||
sourceAudioUrl: params.sourceAudioUrl,
|
||||
audioCodes: params.audioCodes,
|
||||
|
||||
@@ -133,6 +133,7 @@ export const CreatePanel: React.FC<CreatePanelProps> = ({ onGenerate, isGenerati
|
||||
const [audioFormat, setAudioFormat] = useState<'mp3' | 'flac'>('mp3');
|
||||
const [inferenceSteps, setInferenceSteps] = useState(8);
|
||||
const [inferMethod, setInferMethod] = useState<'ode' | 'sde'>('ode');
|
||||
const [lmBackend, setLmBackend] = useState<'pt' | 'vllm'>('pt');
|
||||
const [shift, setShift] = useState(3.0);
|
||||
|
||||
// LM Parameters (under Expert)
|
||||
@@ -535,6 +536,7 @@ export const CreatePanel: React.FC<CreatePanelProps> = ({ onGenerate, isGenerati
|
||||
thinking,
|
||||
audioFormat,
|
||||
inferMethod,
|
||||
lmBackend,
|
||||
shift,
|
||||
lmTemperature,
|
||||
lmCfgScale,
|
||||
@@ -1298,6 +1300,20 @@ export const CreatePanel: React.FC<CreatePanelProps> = ({ onGenerate, isGenerati
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* LM Backend */}
|
||||
<div className="space-y-1.5">
|
||||
<label className="text-xs font-medium text-zinc-600 dark:text-zinc-400">LM Backend</label>
|
||||
<select
|
||||
value={lmBackend}
|
||||
onChange={(e) => setLmBackend(e.target.value as 'pt' | 'vllm')}
|
||||
className="w-full bg-zinc-50 dark:bg-black/20 border border-zinc-200 dark:border-white/10 rounded-lg px-2 py-1.5 text-xs text-zinc-900 dark:text-white focus:outline-none"
|
||||
>
|
||||
<option value="pt">PT (~1.6 GB VRAM)</option>
|
||||
<option value="vllm">VLLM (~9.2 GB VRAM)</option>
|
||||
</select>
|
||||
<p className="text-[10px] text-zinc-500">PT uses less VRAM, VLLM may be faster on powerful GPUs</p>
|
||||
</div>
|
||||
|
||||
{/* Seed */}
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between">
|
||||
|
||||
@@ -90,6 +90,7 @@ interface GenerateBody {
|
||||
lmTopK?: number;
|
||||
lmTopP?: number;
|
||||
lmNegativePrompt?: string;
|
||||
lmBackend?: 'pt' | 'vllm';
|
||||
|
||||
// Expert Parameters
|
||||
referenceAudioUrl?: string;
|
||||
@@ -189,6 +190,7 @@ router.post('/', authMiddleware, async (req: AuthenticatedRequest, res: Response
|
||||
lmTopK,
|
||||
lmTopP,
|
||||
lmNegativePrompt,
|
||||
lmBackend,
|
||||
referenceAudioUrl,
|
||||
sourceAudioUrl,
|
||||
audioCodes,
|
||||
@@ -252,6 +254,7 @@ router.post('/', authMiddleware, async (req: AuthenticatedRequest, res: Response
|
||||
lmTopK,
|
||||
lmTopP,
|
||||
lmNegativePrompt,
|
||||
lmBackend,
|
||||
referenceAudioUrl,
|
||||
sourceAudioUrl,
|
||||
audioCodes,
|
||||
|
||||
@@ -137,6 +137,7 @@ async function submitToApi(params: GenerationParams): Promise<{ taskId: string }
|
||||
use_cot_caption: false, // Explicitly disable CoT features that require LLM
|
||||
use_cot_language: false, // Explicitly disable CoT features that require LLM
|
||||
use_cot_metas: false, // Explicitly disable CoT features that require LLM
|
||||
lm_backend: params.lmBackend || 'pt',
|
||||
};
|
||||
|
||||
if (params.bpm && params.bpm > 0) body.bpm = params.bpm;
|
||||
@@ -150,7 +151,12 @@ async function submitToApi(params: GenerationParams): Promise<{ taskId: string }
|
||||
if (params.audioCodes) body.audio_code_string = params.audioCodes;
|
||||
if (params.repaintingStart !== undefined && params.repaintingStart > 0) body.repainting_start = params.repaintingStart;
|
||||
if (params.repaintingEnd !== undefined && params.repaintingEnd > 0) body.repainting_end = params.repaintingEnd;
|
||||
if (params.audioCoverStrength !== undefined && params.audioCoverStrength !== 1.0) body.audio_cover_strength = params.audioCoverStrength;
|
||||
// Always send audio_cover_strength for cover/repaint tasks, otherwise only when not default
|
||||
if (params.taskType === 'cover' || params.taskType === 'repaint' || params.sourceAudioUrl) {
|
||||
body.audio_cover_strength = params.audioCoverStrength ?? 1.0;
|
||||
} else if (params.audioCoverStrength !== undefined && params.audioCoverStrength !== 1.0) {
|
||||
body.audio_cover_strength = params.audioCoverStrength;
|
||||
}
|
||||
if (params.instruction) body.instruction = params.instruction;
|
||||
// LLM and CoT parameters only sent when thinking mode is enabled
|
||||
if (params.thinking) {
|
||||
@@ -340,6 +346,7 @@ export interface GenerationParams {
|
||||
lmTopK?: number;
|
||||
lmTopP?: number;
|
||||
lmNegativePrompt?: string;
|
||||
lmBackend?: 'pt' | 'vllm';
|
||||
|
||||
// Expert Parameters
|
||||
referenceAudioUrl?: string;
|
||||
@@ -603,7 +610,12 @@ async function processGeneration(
|
||||
if (params.audioCodes) args.push('--audio-codes', params.audioCodes);
|
||||
if (params.repaintingStart !== undefined && params.repaintingStart > 0) args.push('--repainting-start', String(params.repaintingStart));
|
||||
if (params.repaintingEnd !== undefined && params.repaintingEnd > 0) args.push('--repainting-end', String(params.repaintingEnd));
|
||||
if (params.audioCoverStrength !== undefined && params.audioCoverStrength !== 1.0) args.push('--audio-cover-strength', String(params.audioCoverStrength));
|
||||
// Always send audio_cover_strength for cover/repaint tasks, otherwise only when not default
|
||||
if (params.taskType === 'cover' || params.taskType === 'repaint' || params.sourceAudioUrl) {
|
||||
args.push('--audio-cover-strength', String(params.audioCoverStrength ?? 1.0));
|
||||
} else if (params.audioCoverStrength !== undefined && params.audioCoverStrength !== 1.0) {
|
||||
args.push('--audio-cover-strength', String(params.audioCoverStrength));
|
||||
}
|
||||
if (params.instruction) args.push('--instruction', params.instruction);
|
||||
if (params.thinking) args.push('--thinking');
|
||||
if (params.lmTemperature !== undefined) args.push('--lm-temperature', String(params.lmTemperature));
|
||||
@@ -611,6 +623,7 @@ async function processGeneration(
|
||||
if (params.lmTopK !== undefined && params.lmTopK > 0) args.push('--lm-top-k', String(params.lmTopK));
|
||||
if (params.lmTopP !== undefined) args.push('--lm-top-p', String(params.lmTopP));
|
||||
if (params.lmNegativePrompt) args.push('--lm-negative-prompt', params.lmNegativePrompt);
|
||||
if (params.lmBackend) args.push('--lm-backend', params.lmBackend);
|
||||
if (params.useCotMetas === false) args.push('--no-cot-metas');
|
||||
if (params.useCotCaption === false) args.push('--no-cot-caption');
|
||||
if (params.useCotLanguage === false) args.push('--no-cot-language');
|
||||
|
||||
@@ -232,6 +232,7 @@ export interface GenerationParams {
|
||||
lmTopK?: number;
|
||||
lmTopP?: number;
|
||||
lmNegativePrompt?: string;
|
||||
lmBackend?: 'pt' | 'vllm';
|
||||
|
||||
// Expert Parameters
|
||||
referenceAudioUrl?: string;
|
||||
|
||||
Reference in New Issue
Block a user