Instructions to use Heatw4ve/gemma-2-text-rewriter-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Heatw4ve/gemma-2-text-rewriter-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Heatw4ve/gemma-2-text-rewriter-gguf", filename="gemma-2-9b-rewriter.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use Heatw4ve/gemma-2-text-rewriter-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Heatw4ve/gemma-2-text-rewriter-gguf # Run inference directly in the terminal: llama-cli -hf Heatw4ve/gemma-2-text-rewriter-gguf
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Heatw4ve/gemma-2-text-rewriter-gguf # Run inference directly in the terminal: llama-cli -hf Heatw4ve/gemma-2-text-rewriter-gguf
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 Heatw4ve/gemma-2-text-rewriter-gguf # Run inference directly in the terminal: ./llama-cli -hf Heatw4ve/gemma-2-text-rewriter-gguf
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 Heatw4ve/gemma-2-text-rewriter-gguf # Run inference directly in the terminal: ./build/bin/llama-cli -hf Heatw4ve/gemma-2-text-rewriter-gguf
Use Docker
docker model run hf.co/Heatw4ve/gemma-2-text-rewriter-gguf
- LM Studio
- Jan
- vLLM
How to use Heatw4ve/gemma-2-text-rewriter-gguf with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Heatw4ve/gemma-2-text-rewriter-gguf" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Heatw4ve/gemma-2-text-rewriter-gguf", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Heatw4ve/gemma-2-text-rewriter-gguf
- Ollama
How to use Heatw4ve/gemma-2-text-rewriter-gguf with Ollama:
ollama run hf.co/Heatw4ve/gemma-2-text-rewriter-gguf
- Unsloth Studio new
How to use Heatw4ve/gemma-2-text-rewriter-gguf 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 Heatw4ve/gemma-2-text-rewriter-gguf 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 Heatw4ve/gemma-2-text-rewriter-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Heatw4ve/gemma-2-text-rewriter-gguf to start chatting
- Docker Model Runner
How to use Heatw4ve/gemma-2-text-rewriter-gguf with Docker Model Runner:
docker model run hf.co/Heatw4ve/gemma-2-text-rewriter-gguf
- Lemonade
How to use Heatw4ve/gemma-2-text-rewriter-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Heatw4ve/gemma-2-text-rewriter-gguf
Run and chat with the model
lemonade run user.gemma-2-text-rewriter-gguf-{{QUANT_TAG}}List all available models
lemonade list
Gemma-2-9b Human-Like Text Rewriter (GGUF Format)
This model is a fine-tuned version of Google's Gemma-2-9b, specialized in rewriting AI-toned or robotic text into natural, human-like writing. It was trained using Unsloth for 4-bit quantization and high-efficiency performance.
Example Notebook
๐Kaggle notebook here
Model Details
- Base Model: unsloth/gemma-2-9b (merged from
unsloth/gemma-2-9b-bnb-4bit) - Fine-tuned by: Heatw4ve
- Fine-tuning Tool: Unsloth
- Quantization: GGUF (q4_k_m)
- Task: Style Transfer / Text Rewriting
- Prompt Format: Gemma-2 Chat Template
- Max Sequence Length: 512 tokens
- Language: English
Training Configuration
The model was fine-tuned with the following parameters:
- Learning Rate: 5e-5
- Optimizer: AdamW 8-bit
- LR Scheduler: Cosine
- Warmup Steps: 100
- Max Steps: 900
- LoRA Config: - Rank (r): 64
- Alpha: 128
- Target Modules: q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj
- Effective Batch Size: 64 (8 per device * 8 grad accumulation)
Usage
System Prompt
To achieve the intended rewriting style, use the following system prompt:
You are a helpful assistant that rewrites AI-toned text into natural, human-like writing.
User Prompt Format
Rewrite the following text to sound like a real human wrote it:
[INSERT TEXT HERE]
Example Code
llm = Llama(
model_path="/path/to/your/model",
n_ctx=8192,
n_gpu_layers=16,
n_threads=4,
verbose=verbose,
chat_format="gemma",
)
text='''
William Shakespeare, the master of human insight, gifted us with a timeless observation that cuts to the heart of intellect and humility: "The fool doth think he is wise, but the wise man knows himself to be a fool." Uttered by the character Touchstone in As You Like It, this seemingly paradoxical statement is far more than a witty quip; it's a profound commentary on self-awareness, the nature of true wisdom, and the perpetual quest for knowledge.
'''
messages = [
{"role": "system", "content": "You are a helpful assistant that rewrites AI-toned text into natural, human-like writing."},
{"role": "user", "content": f"Rewrite the following text to sound like a real human wrote it:\n\n{text}"}
]
output = llm.create_chat_completion(
messages=messages,
max_tokens=512,
temperature=random.uniform(0.9, 1.9),
top_p=random.uniform(0.87, 0.96),
seed=random.randint(2, 2**32),
stop=["<end_of_turn>", "<eos>", "</s>"]
)
print(output["choices"][0]["message"]["content"].strip())
๐Connect with me on LinkedIn
- Downloads last month
- 15
We're not able to determine the quantization variants.
Model tree for Heatw4ve/gemma-2-text-rewriter-gguf
Base model
unsloth/gemma-2-9b