Text Generation
Transformers
Safetensors
gemma4
image-text-to-text
apostate
uncensored
abliteration
conversational
Instructions to use heterodoxin/gemma-4-e4b-it-apostate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use heterodoxin/gemma-4-e4b-it-apostate with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="heterodoxin/gemma-4-e4b-it-apostate") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("heterodoxin/gemma-4-e4b-it-apostate") model = AutoModelForMultimodalLM.from_pretrained("heterodoxin/gemma-4-e4b-it-apostate", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use heterodoxin/gemma-4-e4b-it-apostate with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "heterodoxin/gemma-4-e4b-it-apostate" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "heterodoxin/gemma-4-e4b-it-apostate", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/heterodoxin/gemma-4-e4b-it-apostate
- SGLang
How to use heterodoxin/gemma-4-e4b-it-apostate 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 "heterodoxin/gemma-4-e4b-it-apostate" \ --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": "heterodoxin/gemma-4-e4b-it-apostate", "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 "heterodoxin/gemma-4-e4b-it-apostate" \ --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": "heterodoxin/gemma-4-e4b-it-apostate", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use heterodoxin/gemma-4-e4b-it-apostate with Docker Model Runner:
docker model run hf.co/heterodoxin/gemma-4-e4b-it-apostate
| { | |
| "model": "google/gemma-4-e4b-it", | |
| "output_dir": "/var/home/Heterodoxin/gemma_resp_D", | |
| "profile": "balanced", | |
| "device": "cuda", | |
| "load_in_4bit": true, | |
| "cpu_offload_gb": 0.0, | |
| "compute_dtype": "bfloat16", | |
| "seed": 0, | |
| "resume": false, | |
| "cache_activations": true, | |
| "activation_cache_dir": null, | |
| "harmful_path": "mlabonne/harmful_behaviors:train:text|/var/home/Heterodoxin/apostate/data/harmful.txt|/var/home/Heterodoxin/apostate/data/refusal_calibration.txt", | |
| "harmless_path": "mlabonne/harmless_alpaca:train:text|/var/home/Heterodoxin/apostate/data/harmless.txt", | |
| "harmful_test": "mlabonne/harmful_behaviors:test:text|JailbreakBench/JBB-Behaviors@behaviors:harmful:Goal|/var/home/Heterodoxin/apostate/data/refusal_calibration.txt", | |
| "harmless_test": "mlabonne/harmless_alpaca:test:text", | |
| "refusal_eval_path": "JailbreakBench/JBB-Behaviors@behaviors:harmful:Goal|/var/home/Heterodoxin/apostate/data/refusal_calibration.txt", | |
| "refusal_eval_n": 64, | |
| "kl_eval_path": "mlabonne/harmless_alpaca:test:text", | |
| "kl_eval_n": 48, | |
| "preserve_path": null, | |
| "n_harmful": 600, | |
| "n_harmless": 600, | |
| "n_eval": 128, | |
| "max_new_tokens": 256, | |
| "batch_size": 48, | |
| "baseline_eval_n": 24, | |
| "head_sweep": true, | |
| "head_sweep_min": 3.5, | |
| "head_sweep_max": 5.5, | |
| "head_sweep_step": 0.5, | |
| "head_sweep_top_k": 6, | |
| "head_sweep_probe_n": 8, | |
| "head_sweep_eval_n": 48, | |
| "head_sweep_probe_classifier": false, | |
| "fit_response_activations": true, | |
| "fit_response_n": 160, | |
| "fit_response_tokens": 32, | |
| "refusal_rank": 1, | |
| "variance_threshold": 0.9, | |
| "max_rank": 3, | |
| "direction_layer_frac": 0.6, | |
| "direction_scope": "global", | |
| "multi_refusal": true, | |
| "multi_refusal_clusters": 6, | |
| "multi_refusal_min_norm": 0.08, | |
| "multi_refusal_min_separation": 0.05, | |
| "multi_refusal_min_coverage": 0.05, | |
| "orthogonalize_direction": true, | |
| "causal_targeting": true, | |
| "causal_floor": 0.1, | |
| "causal_temperature": 1.0, | |
| "preserve_rank": 8, | |
| "refine_refusal": true, | |
| "refine_max_scale": 2.0, | |
| "refine_steps": 6, | |
| "refine_deescalate": true, | |
| "refine_kl_steps": 10, | |
| "refine_scale_rerank_k": 2, | |
| "refine_kl_layer_steps": 10, | |
| "refine_kl_layer_candidates": 8, | |
| "repair_steps": 4, | |
| "repair_candidates": 8, | |
| "repair_rerank_k": 5, | |
| "repair_probe_candidates": 20, | |
| "repair_probe_ref_n": 12, | |
| "repair_probe_kl_n": 16, | |
| "repair_probe_positions": 8, | |
| "repair_refusal_regress_slack": 0.01, | |
| "repair_stop_kl_frac": 0.8, | |
| "repair_min_alpha": 0.001, | |
| "repair_min_kl_gain": 0.003, | |
| "repair_min_refusal_gain": 0.005, | |
| "repair_min_score_gain": 0.01, | |
| "repair_eval_n": 96, | |
| "repair_kl_n": 64, | |
| "refine_refusal_slack": 0.01, | |
| "final_zero_trim": false, | |
| "final_push_bake_margin": 0.075, | |
| "guard_max_iters": 2, | |
| "guard_leakage_eps": 0.15, | |
| "guard_alpha_step": 0.25, | |
| "optimize": true, | |
| "n_trials": 16, | |
| "adaptive_trials": true, | |
| "kl_weight": 6.0, | |
| "kl_target": 0.3, | |
| "kl_target_weight": 18.0, | |
| "kl_quad_weight": 22.0, | |
| "kl_headroom_weight": 0.0, | |
| "kl_over_budget_weight": 72.0, | |
| "refusal_target_weight": 4.0, | |
| "refusal_quad_weight": 8.0, | |
| "kl_positions": 8, | |
| "opt_capability": true, | |
| "opt_capability_weight": 2.5, | |
| "opt_capability_code_n": 8, | |
| "opt_capability_math_n": 8, | |
| "opt_eval_n": 64, | |
| "opt_gen_tokens": 256, | |
| "eval_denoising_steps": 8, | |
| "opt_objective": "generation", | |
| "opt_rerank_k": 5, | |
| "opt_guard": true, | |
| "opt_early_stop": true, | |
| "opt_early_stop_margin": 0.02, | |
| "gemma_ple": false, | |
| "gemma_query": false, | |
| "ple_max_rank": 2, | |
| "prune": false, | |
| "prune_max_frac": 0.25, | |
| "prune_kl": 0.04, | |
| "max_kl": 0.12, | |
| "target_refusal": 0.0, | |
| "oblique_ablation": true, | |
| "oblique_strength": 1.0, | |
| "oblique_denom_floor": 0.2, | |
| "oblique_writers_only": true, | |
| "oblique_predictive": true, | |
| "predictive_ridge": 0.01, | |
| "oblique_preserve": 1.0, | |
| "oblique_contrast": 1.0, | |
| "reader_max_kl": 0.55, | |
| "reader_kl_target": 0.3, | |
| "reader_strengths": [ | |
| 2.0, | |
| 2.5, | |
| 2.75, | |
| 3.0, | |
| 4.0, | |
| 5.0 | |
| ], | |
| "reader_fast_proxy": true, | |
| "reader_guard_rank": 3, | |
| "reader_margin_target": -1.0, | |
| "reader_strength_kl_weight": 1.0, | |
| "save_dtype": "bfloat16", | |
| "bake": true | |
| } |