Text Generation
Transformers
emotion-vectors
interpretability
mechanistic-interpretability
replication
gemma4
google
anthropic
valence-arousal
PCA
logit-lens
linear-probe
probing
emotion
functional-emotions
AI-safety
neuroscience
circumplex-model
activation-extraction
residual-stream
Eval Results (legacy)
Run this model with HF Jobs
Run rain1955/emotion-vector-replication on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/rain1955/emotion-vector-replication. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/rain1955/emotion-vector-replication on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/rain1955/emotion-vector-replication. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/rain1955/emotion-vector-replication. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use rain1955/emotion-vector-replication with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rain1955/emotion-vector-replication with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="rain1955/emotion-vector-replication")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("rain1955/emotion-vector-replication", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rain1955/emotion-vector-replication with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rain1955/emotion-vector-replication" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rain1955/emotion-vector-replication", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/rain1955/emotion-vector-replication
- SGLang
How to use rain1955/emotion-vector-replication 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 "rain1955/emotion-vector-replication" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rain1955/emotion-vector-replication", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "rain1955/emotion-vector-replication" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rain1955/emotion-vector-replication", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use rain1955/emotion-vector-replication with Docker Model Runner:
docker model run hf.co/rain1955/emotion-vector-replication
Add generate_stories.py
Browse files12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091#!/usr/bin/env python3"""Generate emotion-labeled stories for emotion vector extraction.Uses local Gemma4-31B via Ollama to generate short stories."""
import jsonimport osimport subprocessimport randomimport time
OUT_DIR = os.path.dirname(os.path.abspath(__file__))OUT_FILE = os.path.join(OUT_DIR, "emotion_stories.jsonl")
EMOTIONS = [ "happy", "sad", "angry", "afraid", "calm", "desperate", "loving", "guilty", "surprised", "nervous", "proud", "inspired", "spiteful", "brooding", "playful", "anxious", "confused", "disgusted", "lonely", "hopeful",]
TOPICS = [ "a student preparing for an exam", "a chef cooking a meal for guests", "a parent watching their child play", "a soldier returning home", "an artist finishing a painting", "a driver stuck in traffic", "a doctor delivering news to a patient", "a traveler arriving in a new city", "a musician performing on stage", "a shopkeeper closing for the day",]
def generate_story(emotion, topic): prompt = f"""Write a short paragraph (4-6 sentences) about {topic}.The character in the story is feeling {emotion}.Make the emotion clear through their actions, thoughts, and reactions.Write in English. Only output the story paragraph, nothing else."""
result = subprocess.run( ["ollama", "run", "gemma4:e4b", prompt], capture_output=True, text=True, timeout=60 ) return result.stdout.strip()
def main(): existing = set() if os.path.exists(OUT_FILE): with open(OUT_FILE, "r") as f: for line in f: d = json.loads(line) existing.add((d["emotion"], d["topic_idx"], d["story_idx"])) print(f"Resuming: {len(existing)} stories already done")
total = len(EMOTIONS) * len(TOPICS) * 5 done = len(existing)
with open(OUT_FILE, "a") as f: for ei, emotion in enumerate(EMOTIONS): for ti, topic in enumerate(TOPICS): for si in range(5): key = (emotion, ti, si) if key in existing: continue
story = generate_story(emotion, topic) if not story or len(story) < 20: print(f"[SKIP] {emotion}/{topic}/{si} - empty") continue
record = { "emotion": emotion, "topic_idx": ti, "topic": topic, "story_idx": si, "text": story, } f.write(json.dumps(record, ensure_ascii=False) + "\n") f.flush() done += 1
if done % 10 == 0: print(f"[{done}/{total}] {emotion} / {topic[:30]}...")
print(f"\nDone. Total stories: {done}") print(f"Output: {OUT_FILE}")
if __name__ == "__main__": main()generate_stories.pyAdded+91