Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions webui/configs/model_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@
],

"yue2": [
{"name": "ar_lora", "type": "text", "scope": "session", "session_option": "yue2.ar_lora", "label": "ar_lora", "label_en": "AR LoRA adapter", "default": ""},
{"name": "ar_lora_scale", "type": "number", "scope": "session", "session_option": "yue2.ar_lora_scale", "label": "ar_lora_scale", "label_en": "AR LoRA strength", "default": 1, "step": 0.1},
{"name": "ar_lora", "type": "text", "scope": "session", "session_option": "yue2.ar_lora", "label": "ar_lora", "label_en": "AR LoRA adapter", "default": "", "placeholder": "/path/to/ar_lora_inst_v3abc.safetensors", "info": "Unfused AR adapter for score and semantic planning; relative paths resolve against the model root. Reload the model after changing this value."},
{"name": "ar_lora_scale", "type": "number", "scope": "session", "session_option": "yue2.ar_lora_scale", "label": "ar_lora_scale", "label_en": "AR LoRA strength", "default": 1, "step": 0.1, "info": "Scales the AR adapter deltas; 0 disables it. Reload the model after changing this value."},
{"name": "nar_lora", "type": "text", "scope": "session", "session_option": "yue2.nar_lora", "label": "nar_lora", "label_en": "NAR LoRA adapter", "default": "", "placeholder": "/path/to/nar_lora_joint_v4.safetensors", "info": "Unfused NAR adapter for acoustic detail; relative paths resolve against the model root. Reload the model after changing this value."},
{"name": "nar_lora_scale", "type": "number", "scope": "session", "session_option": "yue2.nar_lora_scale", "label": "nar_lora_scale", "label_en": "NAR LoRA strength", "default": 1, "step": 0.1, "info": "Scales the LoRA deltas only; any full vae2llm/llm2vae projection replacements in the adapter stay at full strength. 0 disables the entire adapter. Reload the model after changing this value."},
{"name": "main_gguf", "type": "choice", "scope": "session", "session_option": "yue2.model_gguf", "label": "main_gguf", "label_en": "Main weights", "default": "yue2-3b-q8_0.gguf", "choices": ["yue2-3b-q8_0.gguf", "yue2-3b-q4_0.gguf", "yue2-3b-bf16.gguf"], "info": "Reload the model after changing this value."},
{"name": "vae_gguf", "type": "choice", "scope": "session", "session_option": "yue2.vae_gguf", "label": "vae_gguf", "label_en": "VAE weights", "default": "yue2-vae-f16.gguf", "choices": ["yue2-vae-f16.gguf", "yue2-vae-f32.gguf"], "info": "Reload the model after changing this value."},
{"name": "style", "type": "text", "label": "style", "label_en": "Style", "default": "English, indie pop, bright acoustic guitar, soft drums, warm lead vocal, polished demo mix", "placeholder": "English, city pop, groovy bass, synth, energetic vocal"},
Expand Down
84 changes: 42 additions & 42 deletions webui/native/dist/index.html

Large diffs are not rendered by default.

67 changes: 56 additions & 11 deletions webui/native/src/lib/models/yue2/Yue2Panel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,41 @@

let coverAudioFile: File | null = null;
let loraInput: HTMLInputElement | null = null;
let narLoraInput: HTMLInputElement | null = null;
let loraError = '';
let narLoraError = '';
let loraUpload: AbortController | null = null;
onDestroy(() => loraUpload?.abort());

async function selectLora(file: File | null) {
// One uploader for both adapters: the two branches take the same kind of file and differ only in
// which option receives the resulting server path.
async function selectLora(file: File | null, branch: 'ar' | 'nar') {
if (!file) return;
const fail = (message: string) => {
if (branch === 'ar') loraError = message;
else narLoraError = message;
};
loraError = '';
narLoraError = '';
if (!file.name.toLowerCase().endsWith('.safetensors')) {
loraError = 'Select an unfused AR .safetensors adapter.';
fail(`Select an unfused ${branch.toUpperCase()} .safetensors adapter.`);
return;
}
loraUploading = true;
loraUpload = new AbortController();
try {
const path = await uploadFile(file, loraUpload.signal);
setNamedParameter('ar_lora', path);
log(`YuE2 AR LoRA selected: ${file.name}`);
setNamedParameter(branch === 'ar' ? 'ar_lora' : 'nar_lora', path);
log(`YuE2 ${branch.toUpperCase()} LoRA selected: ${file.name}`);
} catch (error) {
if (!loraUpload.signal.aborted) {
loraError = error instanceof Error ? error.message : String(error);
fail(error instanceof Error ? error.message : String(error));
}
} finally {
loraUploading = false;
loraUpload = null;
if (loraInput) loraInput.value = '';
if (narLoraInput) narLoraInput.value = '';
}
}
let coverAudioInput: HTMLInputElement | null = null;
Expand Down Expand Up @@ -299,16 +309,16 @@
<div class="yue2-field">
<label for="param-ar_lora">AR LoRA adapter</label>
<input id="param-ar_lora" type="text" placeholder="Server path (.safetensors)"
disabled={!server?.ui_management || busy || loraUploading}
disabled={busy || loraUploading}
value={String(advancedValues.ar_lora ?? '')}
on:input={(event) => setNamedParameter('ar_lora', event.currentTarget.value.trim())} />
<input id="yue2-ar-lora-file" class="file file-native" type="file" accept=".safetensors"
bind:this={loraInput} disabled={!server?.ui_management || busy || loraUploading}
on:change={(event) => selectLora(event.currentTarget.files?.[0] || null)} />
bind:this={loraInput} disabled={busy || loraUploading}
on:change={(event) => selectLora(event.currentTarget.files?.[0] || null, 'ar')} />
<div class="media-actions">
<button type="button" disabled={!server?.ui_management || busy || loraUploading}
<button type="button" disabled={busy || loraUploading}
on:click={() => loraInput?.click()}>{loraUploading ? 'Uploading...' : 'Choose AR LoRA'}</button>
<button type="button" disabled={!server?.ui_management || busy || loraUploading || !advancedValues.ar_lora}
<button type="button" disabled={busy || loraUploading || !advancedValues.ar_lora}
on:click={() => { setNamedParameter('ar_lora', ''); loraError = ''; }}>Clear</button>
</div>
<small>LoRA requirements vary. Read the original adapter's documentation for usage instructions.</small>
Expand All @@ -317,7 +327,7 @@
<div class="yue2-field">
<label for="param-ar_lora_scale">AR LoRA strength</label>
<input id="param-ar_lora_scale" type="number" step="0.1"
disabled={!server?.ui_management || busy || loraUploading || !advancedValues.ar_lora}
disabled={busy || loraUploading || !advancedValues.ar_lora}
value={Number(advancedValues.ar_lora_scale ?? 1)}
on:change={(event) => {
if (Number.isFinite(event.currentTarget.valueAsNumber)) {
Expand All @@ -328,6 +338,41 @@
</div>
{/if}

{#if specByName('nar_lora')}
<div class="yue2-grid">
<div class="yue2-field">
<label for="param-nar_lora">NAR LoRA adapter</label>
<input id="param-nar_lora" type="text" placeholder="Server path (.safetensors)"
disabled={busy || loraUploading}
value={String(advancedValues.nar_lora ?? '')}
on:input={(event) => setNamedParameter('nar_lora', event.currentTarget.value.trim())} />
<input id="yue2-nar-lora-file" class="file file-native" type="file" accept=".safetensors"
bind:this={narLoraInput} disabled={busy || loraUploading}
on:change={(event) => selectLora(event.currentTarget.files?.[0] || null, 'nar')} />
<div class="media-actions">
<button type="button" disabled={busy || loraUploading}
on:click={() => narLoraInput?.click()}>{loraUploading ? 'Uploading...' : 'Choose NAR LoRA'}</button>
<button type="button" disabled={busy || loraUploading || !advancedValues.nar_lora}
on:click={() => { setNamedParameter('nar_lora', ''); narLoraError = ''; }}>Clear</button>
</div>
{#if narLoraError}<span class="yue2-error" role="alert">{narLoraError}</span>{/if}
<small>Unfused NAR adapter for acoustic detail; relative paths resolve against the model root. Reload the model after changing this value.</small>
</div>
<div class="yue2-field">
<label for="param-nar_lora_scale">NAR LoRA strength</label>
<input id="param-nar_lora_scale" type="number" step="0.1"
disabled={busy || !advancedValues.nar_lora}
value={Number(advancedValues.nar_lora_scale ?? 1)}
on:change={(event) => {
if (Number.isFinite(event.currentTarget.valueAsNumber)) {
setNamedParameter('nar_lora_scale', event.currentTarget.valueAsNumber);
}
}} />
<small>Scales the LoRA deltas only; any full vae2llm/llm2vae projection replacement in the adapter stays at full strength.</small>
</div>
</div>
{/if}

<div class="yue2-grid yue2-grid-core">
{#each coreSpecs as spec}
<div class="yue2-field" class:wide={spec.type === 'text'}>
Expand Down
4 changes: 3 additions & 1 deletion webui/native/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,9 @@
advancedValues = {
...advancedValues,
ar_lora: configured?.['yue2.ar_lora'] ?? '',
ar_lora_scale: Number(configured?.['yue2.ar_lora_scale'] ?? 1)
ar_lora_scale: Number(configured?.['yue2.ar_lora_scale'] ?? 1),
nar_lora: configured?.['yue2.nar_lora'] ?? '',
nar_lora_scale: Number(configured?.['yue2.nar_lora_scale'] ?? 1)
};
}
text = '';
Expand Down
Loading