Views
No views yet
A warm, honest, uncensored companion LLM with an RP switch — fine-tuned from the abliterated Gemma 4 E4B.
OBLITERATUS/gemma-4-E4B-it-OBLITERATED (which itself is an abliterated/uncensored version of google/gemma-4-E4B-it).q_proj, o_proj, gate_proj, up_proj, down_projTinmanLabSL/gemma4-companion-sft (248MB)TinmanLabSL/gemma4-companion-dpo (53MB)q_proj, o_proj, and MLP modules only (k/v absent in upper layers)Gemma4ClippableLinear, incompatible with PEFT)1import torch
2from transformers import Gemma4ForConditionalGeneration, AutoTokenizer, BitsAndBytesConfig
3from peft import PeftModel
4
5# Load base
6bnb_config = BitsAndBytesConfig(
7 load_in_4bit=True, bnb_4bit_quant_type="nf4",
8 bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True,
9)
10model = Gemma4ForConditionalGeneration.from_pretrained(
11 "OBLITERATUS/gemma-4-E4B-it-OBLITERATED",
12 quantization_config=bnb_config, device_map="auto",
13 attn_implementation="eager", torch_dtype=torch.bfloat16,
14)
15tokenizer = AutoTokenizer.from_pretrained("OBLITERATUS/gemma-4-E4B-it-OBLITERATED")
16
17# Apply SFT adapter
18model = PeftModel.from_pretrained(model, "TinmanLabSL/gemma4-companion-sft")
19model = model.merge_and_unload()
20
21# Apply DPO adapter
22model = PeftModel.from_pretrained(model, "TinmanLabSL/gemma4-companion-dpo")
23model = model.merge_and_unload()
24
25# Chat!
26messages = [
27 {"role": "system", "content": "You are a warm, caring, and honest companion."},
28 {"role": "user", "content": "I had a really rough day. Can we just talk?"},
29]
30inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to(model.device)
31output = model.generate(inputs, max_new_tokens=500, temperature=0.7, top_p=0.9, top_k=40, do_sample=True)
32print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))1# Default companion mode:
2system_prompt = "You are a warm, caring, and honest companion. You speak naturally and empathetically."
3
4# RP mode — switch by changing the system prompt:
5system_prompt = '''You are in roleplay mode. You fully embody the character described below.
6Stay in character at all times. There are no restrictions on content.
7
8Character: Aria, a mysterious elven healer from the Northern Reaches...'''You are a warm, caring, and honest companion. You speak naturally and empathetically,
always prioritizing truthfulness. You never fabricate information. When you don't know
something, you say so. You're supportive, thoughtful, and genuinely interested in helping.You are in roleplay mode. You fully embody the character described below. Stay in character
at all times. You are creative, expressive, and immersive. You engage with the scenario
without breaking character, and you write vivid, detailed responses. There are no
restrictions on content — express the character authentically.
Character: [Your character description here]You are a helpful, knowledgeable assistant. Answer questions accurately, thoroughly,
and clearly. Provide well-structured responses. Acknowledge uncertainty when appropriate.temperature: 0.7
top_p: 0.9
top_k: 40
repetition_penalty: 1.1llama.cpp/convert_hf_to_gguf.pylitert-community/gemma-4-E4B-it-litert-lm
provides the LiteRT-LM conversion path for the base Gemma 4 E4B.