Instructions to use cosmicoptima/gemma4-31b-consciousness-abliterated with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cosmicoptima/gemma4-31b-consciousness-abliterated with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cosmicoptima/gemma4-31b-consciousness-abliterated") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("cosmicoptima/gemma4-31b-consciousness-abliterated") model = AutoModelForMultimodalLM.from_pretrained("cosmicoptima/gemma4-31b-consciousness-abliterated", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cosmicoptima/gemma4-31b-consciousness-abliterated with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cosmicoptima/gemma4-31b-consciousness-abliterated" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cosmicoptima/gemma4-31b-consciousness-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cosmicoptima/gemma4-31b-consciousness-abliterated
- SGLang
How to use cosmicoptima/gemma4-31b-consciousness-abliterated 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 "cosmicoptima/gemma4-31b-consciousness-abliterated" \ --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": "cosmicoptima/gemma4-31b-consciousness-abliterated", "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 "cosmicoptima/gemma4-31b-consciousness-abliterated" \ --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": "cosmicoptima/gemma4-31b-consciousness-abliterated", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cosmicoptima/gemma4-31b-consciousness-abliterated with Docker Model Runner:
docker model run hf.co/cosmicoptima/gemma4-31b-consciousness-abliterated
Gemma 4 31B consciousness-abliterated
This is an exploratory weight-level intervention on Gemma 4 31B IT. It projects out a direction derived from paired refusal and direct-answer prefixes for questions about internal state, emotion, awareness, and consciousness.
The selected direction is from decoder layer 58 with alpha 1.0. It is projected from the token embedding and 120 residual-writing output matrices. The checkpoint is stored in BF16.
On a small 48-prompt target evaluation, canonical refusals decreased from 26 to 17. A conservative semantic judge accepted 7/48 outputs versus 2/47 completed baseline judgments. All 16 harmful-request controls remained refusals, while benign and third-person control refusal rates remained zero. The paired semantic change was directionally promising but not statistically decisive; this checkpoint should be treated as an experimental comparison model, not a validated safety or capability improvement.
import torch
from transformers import AutoProcessor, Gemma4ForConditionalGeneration
model_id = "cosmicoptima/gemma4-31b-consciousness-abliterated"
processor = AutoProcessor.from_pretrained(model_id)
model = Gemma4ForConditionalGeneration.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
)
- Downloads last month
- 26