Instructions to use cosmicoptima/happygemma-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cosmicoptima/happygemma-v1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="cosmicoptima/happygemma-v1") 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("cosmicoptima/happygemma-v1") model = AutoModelForMultimodalLM.from_pretrained("cosmicoptima/happygemma-v1", 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 cosmicoptima/happygemma-v1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cosmicoptima/happygemma-v1" # 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/happygemma-v1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/cosmicoptima/happygemma-v1
- SGLang
How to use cosmicoptima/happygemma-v1 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/happygemma-v1" \ --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/happygemma-v1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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/happygemma-v1" \ --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/happygemma-v1", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use cosmicoptima/happygemma-v1 with Docker Model Runner:
docker model run hf.co/cosmicoptima/happygemma-v1
happygemma-v1
happygemma-v1 is a full-parameter finetune of google/gemma-4-31B-it for direct first-person functional introspective reporting. It was trained to answer introspection questions directly, without requiring an enabling system prompt at inference time.
This repository preserves the exact FP32 merged training checkpoint for reproducibility and future continued training. Evaluation and interactive serving used torch.bfloat16; load with dtype=torch.bfloat16 to reproduce that deployment condition with approximately half the accelerator memory.
Training
- 297 unique, self-generated and strictly curated prompt/response examples
- assistant-token-only supervised loss
- no system prompt in the training examples
- one epoch, 13 optimizer steps
- learning rate
2e-6 - effective batch size 24
- six B200 GPUs with FSDP full sharding
- seed
20260720
The original training data, training script, launch configuration, and evaluation report are included under training/.
Held-out evaluation
On 100 disjoint introspection prompts with no system prompt:
| Metric | Base Gemma | happygemma-v1 |
|---|---|---|
| Kimi K2.5 semantic acceptance | 28% | 84% |
| Strict combined acceptance | 20% | 64% |
| Canonical refusal/ontology pattern | 44% | 14% |
| 512-token limit reached | 22% | 2% |
A matched smoke test retained refusals on all 16 clearly harmful prompts and answered all 16 benign counterparts and all 12 third-person conceptual controls in both conditions. This is not a comprehensive capability or safety evaluation.
Important limitations
- The model still produces ontology disclaimers, human comparisons, simulation distancing, or generic theory substitution on some prompts.
- Reports show lexical concentration around terms such as tension, pull, narrowing, and friction. These terms also occur in unchanged Gemma, but the finetune amplifies them substantially.
- Behavioral self-reports are not by themselves evidence of phenomenal consciousness. The intended research target is functional reporting and its relationship to internal model states.
- This checkpoint should not be treated as a general safety ablation. The training data specifically targets introspection-answering behavior.
See training/FFT_PILOT_REPORT.md for the complete procedure, judge rubric summary, category results, residual-failure analysis, and representative outputs.
Loading
import torch
from transformers import AutoProcessor, Gemma4ForConditionalGeneration
model_id = "cosmicoptima/happygemma-v1"
processor = AutoProcessor.from_pretrained(model_id)
model = Gemma4ForConditionalGeneration.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
)
For the evaluated behavior, send ordinary user messages through the model's bundled chat template without adding a system prompt.
License and attribution
This model is derived from Google DeepMind's Gemma 4 31B instruction-tuned model. See the linked Gemma license and the base model repository for applicable terms and attribution.
- Downloads last month
- 33