Instructions to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M # Run inference directly in the terminal: llama cli -hf Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M # Run inference directly in the terminal: llama cli -hf Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
Use Docker
docker model run hf.co/Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
- SGLang
How to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with Ollama:
ollama run hf.co/Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
- Unsloth Studio
How to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix to start chatting
- Docker Model Runner
How to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with Docker Model Runner:
docker model run hf.co/Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
- Lemonade
How to use Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Lewdiculous/opus-v1.2-7b-GGUF-IQ-Imatrix:Q4_K_M
Run and chat with the model
lemonade run user.opus-v1.2-7b-GGUF-IQ-Imatrix-Q4_K_M
List all available models
lemonade list
- Atomic Chat
GGUF-Imatrix quantizations for dreamgen/opus-v1.2-7b.
It's important to use their Presets for SillyTavern due the peculiar prompt formatting of this model. And here is the text-gen samplers preset for SillyTavern I used.
What does "Imatrix" mean?
It stands for Importance Matrix, a technique used to improve the quality of quantized models.
The Imatrix is calculated based on calibration data, and it helps determine the importance of different model activations during the quantization process. The idea is to preserve the most important information during quantization, which can help reduce the loss of model performance.
One of the benefits of using an Imatrix is that it can lead to better model performance, especially when the calibration data is diverse.
For --imatrix data, imatrix-opus-v1.2-7b-F16.dat was used.
Base⇢ GGUF(F16)⇢ Imatrix-Data(F16)⇢ GGUF(Imatrix-Quants)
The new IQ3_S quant-option has shown to be better than the old Q3_K_S, so I added that instead of the later. Only supported in koboldcpp-1.59.1 or higher.
If you want any specific quantization to be added, feel free to ask.
All credits belong to the creator.
Image:
Original model information:
DreamGen Opus V1
Models for (steerable) story-writing and role-playing.
All Opus V1 models, including quants.
Resources
- Opus V1 prompting guide with many (interactive) examples and prompts that you can copy.
- Google Colab for interactive role-play using
opus-v1.2-7b. - Python code to format the prompt correctly.
- Join the community on Discord to get early access to new models.

Prompting
The models use an extended version of ChatML.
<|im_start|>system
(Story description in the right format here)
(Typically consists of plot description, style description and characters)<|im_end|>
<|im_start|>user
(Your instruction on how the story should continue)<|im_end|>
<|im_start|>text names= Alice
(Continuation of the story from the Alice character)<|im_end|>
<|im_start|>text
(Continuation of the story from no character in particular (pure narration))<|im_end|>
<|im_start|>user
(Your instruction on how the story should continue)<|im_end|>
<|im_start|>text names= Bob
(Continuation of the story from the Bob character)<|im_end|>
The Opus V1 extension is the addition of the text role, and the addition / modification of role names.
Pay attention to the following:
- The
textmessages can (but don't have to have)names, names are used to indicate the "active" character during role-play. - There can be multiple subsequent message with a
textrole, especially if names are involved. - There can be multiple names attached to a message.
- The format for names is
names= {{name[0]}}; {{name[1]}}, beware of the spaces afternames=and after the;. This spacing leads to most natural tokenization for the names.
While the main goal for the models is great story-writing and role-playing performance, the models are also capable of several writing related tasks as well as general assistance.
Here's how you can prompt the model for the following tasks
- Steerable Story-writing and Role-playing:
- Input:
- System prompt: You provide story / role-play description, which consists of:
- Plot description
- Style description
- Characters and their descriptions
- Conversation turns:
- Text / message turn: This represents part of the story or role play
- Instruction: This tells the model what should happen next
- System prompt: You provide story / role-play description, which consists of:
- Output: Continuation of the story / role-play.
- Input:
- Story plot summarization
- Input: A story, or a few chapters of a story.
- Output: A description of the story or chapters.
- Story character description
- Input: A story, or a few chapters of a story, set of characters.
- Output: A description of the characters.
- Story style description
- Input: A story, or a few chapters of a story.
- Output: A description the style of the story.
- Story description to chapters
- Input: A brief plot description and the desired number of chapters.
- Output: A description for each chapter.
- And more...
Sampling params
For story-writing and role-play, I recommend "Min P" based sampling with min_p in the range [0.01, 0.1] and with temperature in the range [0.5, 1.5], depending on your preferences. A good starting point would be min_p=0.1; temperature=0.8.
You may also benefit from setting presence, frequency and repetition penalties, especially at lower temperatures.
Dataset
The fine-tuning dataset consisted of ~100M tokens of steerable story-writing, role-playing, writing-assistant and general-assistant examples. Each example was up to 31000 tokens long.
All story-writing and role-playing examples were based on human-written text.
Running the model
The model is should be compatible with any software that supports the base model, but beware of prompting and tokenization.
I recommend using these model versions:
Running on DreamGen.com (free)
You can run the models on dreamgen.com for free — you can use the built-in UI for story-writing & role-playing, or use the API.
Running Locally
- Make sure your prompt is as close as possible to the Opus V1
- Regardless of which backend you use, it's important that you format your prompt well and that the tokenization works correctly.
- Read the prompt guide
- Read the prompt formatting code
- Make sure
<|im_start|>and<|im_end|>are tokenized correctly
- vLLM
- Google Colab: This is a simple interactive Google Colab to do role-play with the 7B model, it should fit on the T4 GPU.
- Code: This is simple script for interactive chat for one hard-coded scenario.
- SillyTavern
- Settings, v2 kindly provided by @MarinaraSpaghetti
- Settings screenshot
- This is just an attempt at approximating the Opus V1 prompt, it won't be perfect
- LM Studio
- Config
- Just like ChatML, just changed "assistant" to "text" role.
- HuggingFace
- Chat template
- Just like ChatML, just changed "assistant" to "text" role.
Known Issues
- 34B tokenization:
- There seems to be a mismatch between the tokenizer of the base and fine-tuned model. It's unclear whether this also affected training, or whether it's just incorrectly saved tokenizer (you can see
tokenizer.jsonwas not saved (bug report)). - This affects BOS and EOS (which aren't really used by Yi) and the tokenization of the first input token.
- Overall impact should be minor.
- There seems to be a mismatch between the tokenizer of the base and fine-tuned model. It's unclear whether this also affected training, or whether it's just incorrectly saved tokenizer (you can see
- 34B repetition:
- The 34B sometimes gets stuck repeating the same word, or synonyms. This seems to be a common problem across various Yi 34B fine-tunes.
- GGUF / Ooba:
- The tokenization might be messed up. Some users reported that
<|im_start|>and<|im_end|>are tokenized as multiple tokens.
- The tokenization might be messed up. Some users reported that
License
- This model is intended for personal use only, other use is not permitted.
- Downloads last month
- 1,052
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit

