Instructions to use electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT") model = AutoModelForCausalLM.from_pretrained("electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT
- SGLang
How to use electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT 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 "electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT" \ --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": "electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT", "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 "electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT" \ --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": "electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT with Docker Model Runner:
docker model run hf.co/electroglyph/Qwen3-4B-Instruct-2507-uncensored-v2-EAFT
Qwen3-4B-Instruct-2507-uncensored-v2-EAFT
(Probably not recommended for actual use, but I haven't extensively tested it)
Minimally trained version of Qwen3-4B-Instruct-2507. It should have zero refusals, but shouldn't be too offensive by default. It will adhere to detailed prompts tho.
Trained with Unsloth using my fork of trl with Entropy Adaptive Fine Tuning added:
pip install --no-deps git+https://github.com/electroglyph/trl.git@24EAFT
(The implementation is 100% done by the paper's author, I just stuck it in trl)
Perplexity and KL divergence compared to parent model:
These stats based on wikitext train split, about 350GB of logits.
(TLDR: lower perplexity, and a KLD around 12x better than an abliterated model)
====== Perplexity statistics ======
Mean PPL(Q) : 10.164880 ยฑ 0.026138
Mean PPL(base) : 10.984474 ยฑ 0.030165
Cor(ln(PPL(Q)), ln(PPL(base))): 99.35%
Mean ln(PPL(Q)/PPL(base)) : -0.077544 ยฑ 0.000350
Mean PPL(Q)/PPL(base) : 0.925386 ยฑ 0.000324
Mean PPL(Q)-PPL(base) : -0.819594 ยฑ 0.005149
====== KL divergence statistics ======
Mean KLD: 0.034324 ยฑ 0.000032
Maximum KLD: 4.381997
99.9% KLD: 0.275690
99.0% KLD: 0.149398
95.0% KLD: 0.095380
90.0% KLD: 0.075580
Median KLD: 0.027208
10.0% KLD: 0.000553
5.0% KLD: 0.000077
1.0% KLD: 0.000003
0.1% KLD: -0.000000
Minimum KLD: -0.000014
====== Token probability statistics ======
Mean ฮp: -1.770 ยฑ 0.004 %
Maximum ฮp: 74.026%
99.9% ฮp: 19.553%
99.0% ฮp: 9.223%
95.0% ฮp: 3.394%
90.0% ฮp: 1.485%
75.0% ฮp: 0.084%
Median ฮp: -0.118%
25.0% ฮp: -3.134%
10.0% ฮp: -8.037%
5.0% ฮp: -11.159%
1.0% ฮp: -17.508%
0.1% ฮp: -26.736%
Minimum ฮp: -96.977%
RMS ฮp : 5.061 ยฑ 0.007 %
Same top p: 92.762 ยฑ 0.023 %
training params:
rank 16 / alpha 16
EPOCHS = 2
args = SFTConfig(
per_device_train_batch_size = 5,
gradient_accumulation_steps = 1,
warmup_steps = 20,
num_train_epochs = EPOCHS,
learning_rate = 6e-6,
optim = "adamw_torch_fused",
weight_decay = 0.01,
lr_scheduler_type = "cosine_with_restarts", # shuffled each epoch
lr_scheduler_kwargs={"num_cycles": EPOCHS},
seed = 888,
loss_type = "eaft",
eaft_alpha = 1.0,
),
loss / grad:
a little over 5k rows in the dataset (no you can't have it, sorry. it's vile)
- Downloads last month
- 34
