pavelfedortsov/gemma4-e2b-lora-colloquial-ru
gemma4-e4b-colloquial-ru-merged
English: Full-weight Gemma 4 E4B checkpoint with colloquial Russian LoRA merged in for vLLM / RunPod Serverless. No PEFT at inference time.
What this model does
Rewrites formal Russian into casual chat-style Russian (Telegram-like), without profanity, while keeping facts, names, numbers, and paragraph structure.
Not a general chat model — use the instruction prefix from training (see below).
Model lineage
Merge was done with peft.merge_and_unload(); missing language_model k_norm weights for layers 24–41 were copied from the base checkpoint (required for vLLM).
Training data
- 50,000 SFT pairs, mat-free colloquial style
- Hub dataset: pavelfedortsov/russian-colloquial-sft-50k
- Built from kurumikz/telegram-corpus-russian-kazakh + Gemini pair generation (see dataset card)
User prompt template (training & inference):
Перепиши простым разговорным русским, как в переписке. Без мата и грубости. Сохрани смысл:
<формальный текст>Training configuration (LoRA → merge)
Config file (also in card_assets/train_colloquial_e4b_gpu.yaml):
Training metrics (LoRA run)
Checkpoints saved every 1000 steps under the LoRA adapter repo.
Inference
RunPod Serverless (vLLM)
MODEL_NAME=pavelfedortsov/gemma4-e4b-colloquial-ru-merged
HF_TOKEN=<your_token>
TRUST_REMOTE_CODE=true
DTYPE=bfloat16
MAX_MODEL_LEN=4096
GPU_MEMORY_UTILIZATION=0.90
ENFORCE_EAGER=true
ENABLE_LORA=false
LANGUAGE_MODEL_ONLY=true
LIMIT_MM_PER_PROMPT={"image":0,"audio":0,"video":0}Recommended GPU: ≥40 GB VRAM (merged ~32 GB weights in bf16).
Transformers (local)
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "pavelfedortsov/gemma4-e4b-colloquial-ru-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
formal = "Сегодня на совещании обсуждали внедрение новой версии API."
user = (
"Перепиши простым разговорным русским, как в переписке. "
"Без мата и грубости. Сохрани смысл:\n"
f"{formal}"
)
messages = [{"role": "user", "content": user}]
prompt = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.9)
print(tokenizer.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))OpenAI-compatible API (RunPod / vLLM)
curl "$RUNPOD_URL/v1/chat/completions" \
-H "Authorization: Bearer $RUNPOD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "pavelfedortsov/gemma4-e4b-colloquial-ru-merged",
"messages": [{
"role": "user",
"content": "Перепиши простым разговорным русским, как в переписке. Без мата и грубости. Сохрани смысл:\nВаш формальный текст."
}],
"max_tokens": 512,
"temperature": 0.7
}'Limitations
- Gemma license applies to the base architecture and weights.
- Quality varies on long news-style text; model may shorten or paraphrase aggressively.
- Not safety-tuned for production without your own evaluation.
- Merged vs LoRA inference can differ slightly in style.
