mmproj upgrade

This commit is contained in:
2026-01-21 12:13:39 +01:00
parent 8149ac8c8b
commit b83f2e6e38
11 changed files with 258 additions and 31 deletions

View File

@@ -760,6 +760,14 @@ async function fetchHuggingFaceInfo() {
modelfileSection.dataset.ggufFilename = data.gguf_filename;
modelfileSection.style.display = 'block';
// Show mmproj info if modelfile includes mmproj configuration
const mmprojInfo = document.getElementById('mmproj-info');
if (data.modelfile_content && data.modelfile_content.includes('# mmproj_url:')) {
mmprojInfo.style.display = 'block';
} else {
mmprojInfo.style.display = 'none';
}
outputBox.innerHTML = '<div class="success-message">Model information fetched! Please review and customize the Modelfile below.</div>';
} else {
fileSelectSection.style.display = 'none';
@@ -811,6 +819,14 @@ async function generateModelfileFromSelection() {
modelfileSection.dataset.ggufFilename = data.gguf_filename;
modelfileSection.style.display = 'block';
// Show mmproj info if modelfile includes mmproj configuration
const mmprojInfo = document.getElementById('mmproj-info');
if (data.modelfile_content && data.modelfile_content.includes('# mmproj_url:')) {
mmprojInfo.style.display = 'block';
} else {
mmprojInfo.style.display = 'none';
}
fileSelectSection.style.display = 'none';
outputBox.innerHTML = '<div class="success-message">Modelfile generated! Please review and customize below.</div>';
} else {
@@ -835,6 +851,35 @@ async function createHuggingFaceModel() {
return;
}
// Parse mmproj info from modelfile content
let mmprojUrl = null;
let mmprojFilename = null;
const mmprojUrlMatch = modelfileContent.match(/#\s*mmproj_url:\s*([^\s]+)/);
const mmprojQuantMatch = modelfileContent.match(/#\s*mmproj_quant:\s*([^\s]+)/);
if (mmprojUrlMatch) {
mmprojUrl = mmprojUrlMatch[1];
const mmprojQuant = mmprojQuantMatch ? mmprojQuantMatch[1] : 'BF16';
// Determine mmproj filename based on repo pattern
if (mmprojUrl.includes('/unsloth/')) {
mmprojFilename = `mmproj-${mmprojQuant}.gguf`;
} else {
// Try to extract base name from modelfile content or gguf filename
const baseMatch = ggufFilename.match(/^(.+?)-Q[0-9]/i);
if (baseMatch) {
mmprojFilename = `${baseMatch[1]}-${mmprojQuant}-mmproj.gguf`;
} else {
mmprojFilename = `mmproj-${mmprojQuant}.gguf`;
}
}
// Convert to resolve URL if needed
if (!mmprojUrl.includes('/resolve/')) {
mmprojUrl = `${mmprojUrl}/resolve/main/${mmprojFilename}`;
}
}
try {
const response = await fetch('/api/install/huggingface/create', {
method: 'POST',
@@ -845,7 +890,9 @@ async function createHuggingFaceModel() {
model_name: modelName,
modelfile_content: modelfileContent,
file_url: fileUrl,
gguf_filename: ggufFilename
gguf_filename: ggufFilename,
mmproj_url: mmprojUrl,
mmproj_filename: mmprojFilename
})
});