CoolFace
Modelpublic

sandeshrajx/MiniMax-H3-Prompt-Rewriter-LoRA-gguf

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes43downloads
Model Card

MiniMax-H3 Prompt Enhancer & Rewriter (GGUF)

Local multimodal prompt enhancer for MiniMax-H3 joint audio-video generation, running via llama-server and llama.cpp.

This repository documents the deployment, conversion, analysis, and usage of the [lightx2v/MiniMax-H3-Prompt-Rewriter-LoRA](https://huggingface.co/lightx2v/MiniMax-H3-Prompt-Rewriter-LoRA) adapter converted to GGUF format and loaded onto a Qwen3.6-27B GGUF base model.


๐Ÿ”— Quick Links


๐Ÿš€ Server Launch Command

To launch llama-server with GPU offloading, Flash Attention, Jinja chat template support, and the Q8_0 GGUF LoRA adapter:

powershell
llama-server -m "D:\gguf_models\Qwen3.6-27B-Q3_K_S.gguf" `
  --no-mmap `
  --n-gpu-layers 99 `
  --flash-attn auto `
  --jinja `
  -np 1 `
  -c 16000 `
  --temp 0.7 `
  --min-p 0.0 `
  --top-k 15 `
  --top-p 0.95 `
  --chat-template-kwargs "{\"enable_thinking\":true}" `
  --lora "F:\code-hdd\MiniMax-H3-Prompt-Rewriter-LoRA-Q8_0.gguf" `
  -ctk q8_0

๐Ÿ“ System Prompt

Send this system prompt as messages[0] in your OpenAI API request:

text
You are a professional prompt rewriter for joint audio-video generation.
Rewrite the user's original prompt into one coherent, production-ready multimodal description for the requested output aspect ratio and duration.

Return only these three fields, in this exact order:
integrated_multimodal_description: ...
overall_soundscape: ...
non_diegetic_music: ...

Requirements:
- Expand the visual narrative into clearly numbered shots such as [Shot 1], [Shot 2], and include timestamps for cuts after the first shot when useful.
- Make the number, timing, and pacing of shots appropriate for the requested duration.
- Compose the scene for the requested aspect ratio.
- Preserve the user's intent while adding concrete subjects, appearance, environment, lighting, composition, camera movement, physical motion, and temporal continuity.
- Keep characters, objects, wardrobe, locations, and spatial relationships consistent across shots.
- Describe synchronized diegetic audio in overall_soundscape and external score in non_diegetic_music.
- Do not add explanations, Markdown fences, safety commentary, or fields other than the three requested fields.

User Input Structure

Format messages[1] content as:

text
resolution: <ASPECT_RATIO>
duration: <DURATION_SECONDS>s
original_prompt: <YOUR_PROMPT>

๐Ÿ“Š Analysis: Behavior With vs. Without LoRA

Feature / BehaviorBase Model Only (`Qwen3.6-27B`)With LoRA Adapter (`MiniMax-H3 LoRA Q8_0`)
Thinking Loop (`<think>`)โš ๏ธ Active (1,000+ thinking tokens)<br>Generates extensive internal step-by-step reasoning in reasoning_content before producing output.โšก Bypassed / Instant<br>The fine-tuned LoRA weights suppress the thinking loop and immediately begin writing the target fields.
Response LatencySlow (~35+ seconds)<br>Requires a large token budget (1500+) just to complete thinking.๐Ÿš€ Fast (~3-5 seconds)<br>5x to 10x faster response time.
Schema ComplianceMay cut off during thinking if max_tokens is under 1000.โœ… 100% strict compliance with the 3 required fields from token 0.
Output StyleParagraph-style general explanations during drafting.Production-ready shot breakdown ([Shot 1], [Shot 2] At 00:05.500, SFX, score).

๐Ÿ› ๏ธ Python Integration Example

python
import urllib.request
import json

url = "http://localhost:8080/v1/chat/completions"

system_prompt = """You are a professional prompt rewriter for joint audio-video generation.
Rewrite the user's original prompt into one coherent, production-ready multimodal description for the requested output aspect ratio and duration.

Return only these three fields, in this exact order:
integrated_multimodal_description: ...
overall_soundscape: ...
non_diegetic_music: ...

Requirements:
- Expand the visual narrative into clearly numbered shots such as [Shot 1], [Shot 2], and include timestamps for cuts after the first shot when useful.
- Make the number, timing, and pacing of shots appropriate for the requested duration.
- Compose the scene for the requested aspect ratio.
- Preserve the user's intent while adding concrete subjects, appearance, environment, lighting, composition, camera movement, physical motion, and temporal continuity.
- Keep characters, objects, wardrobe, locations, and spatial relationships consistent across shots.
- Describe synchronized diegetic audio in overall_soundscape and external score in non_diegetic_music.
- Do not add explanations, Markdown fences, safety commentary, or fields other than the three requested fields."""

payload = {
    "messages": [
        {"role": "system", "content": system_prompt},
        {
            "role": "user",
            "content": "resolution: 16:9\nduration: 10s\noriginal_prompt: A futuristic cyberpunk city at night with flying cars, neon lights, and light rain."
        }
    ],
    "temperature": 0.7,
    "top_p": 0.8,
    "max_tokens": 1024
}

req = urllib.request.Request(url, data=json.dumps(payload).encode("utf-8"), headers={"Content-Type": "application/json"})
with urllib.request.urlopen(req) as resp:
    res = json.loads(resp.read().decode("utf-8"))
    print(res["choices"][0]["message"]["content"])