Text Generation
Transformers
Safetensors
English
gemma4
image-text-to-text
gemma-4-31b
cipher
kin
creative-coding
web-design
html
css
javascript
three.js
gsap
unsloth
qlora
lora
sft
single-file-html
conversational
Instructions to use Auroraventures/cipher-sft-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Auroraventures/cipher-sft-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Auroraventures/cipher-sft-merged") 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("Auroraventures/cipher-sft-merged") model = AutoModelForMultimodalLM.from_pretrained("Auroraventures/cipher-sft-merged") 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 Auroraventures/cipher-sft-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Auroraventures/cipher-sft-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Auroraventures/cipher-sft-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Auroraventures/cipher-sft-merged
- SGLang
How to use Auroraventures/cipher-sft-merged 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 "Auroraventures/cipher-sft-merged" \ --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": "Auroraventures/cipher-sft-merged", "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 "Auroraventures/cipher-sft-merged" \ --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": "Auroraventures/cipher-sft-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use Auroraventures/cipher-sft-merged with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Auroraventures/cipher-sft-merged to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Auroraventures/cipher-sft-merged to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Auroraventures/cipher-sft-merged to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Auroraventures/cipher-sft-merged", max_seq_length=2048, ) - Docker Model Runner
How to use Auroraventures/cipher-sft-merged with Docker Model Runner:
docker model run hf.co/Auroraventures/cipher-sft-merged
Upload cipher-simpo-train.ipynb with huggingface_hub
Browse files- cipher-simpo-train.ipynb +1 -42
cipher-simpo-train.ipynb
CHANGED
|
@@ -82,48 +82,7 @@
|
|
| 82 |
"metadata": {},
|
| 83 |
"execution_count": null,
|
| 84 |
"outputs": [],
|
| 85 |
-
"source": [
|
| 86 |
-
"# Cell 5 — Generate SimPO preference pairs from existing SFT data\n",
|
| 87 |
-
"import json\n",
|
| 88 |
-
"from pathlib import Path\n",
|
| 89 |
-
"\n",
|
| 90 |
-
"SFT_DATA = '/content/kr8tiv-training/data/prompts/awwwards-sft.jsonl'\n",
|
| 91 |
-
"PAIRS_OUT = '/content/simpo_pairs.jsonl'\n",
|
| 92 |
-
"\n",
|
| 93 |
-
"examples = []\n",
|
| 94 |
-
"with open(SFT_DATA) as f:\n",
|
| 95 |
-
" for line in f:\n",
|
| 96 |
-
" if line.strip():\n",
|
| 97 |
-
" try: examples.append(json.loads(line))\n",
|
| 98 |
-
" except: pass\n",
|
| 99 |
-
"\n",
|
| 100 |
-
"print(f'Loaded {len(examples)} SFT examples')\n",
|
| 101 |
-
"\n",
|
| 102 |
-
"# Build preference pairs\n",
|
| 103 |
-
"pairs = []\n",
|
| 104 |
-
"skipped = 0\n",
|
| 105 |
-
"for ex in examples:\n",
|
| 106 |
-
" msgs = ex.get('messages', [])\n",
|
| 107 |
-
" user_msg = next((m['content'] for m in msgs if m['role']=='user'), '')\n",
|
| 108 |
-
" chosen = next((m['content'] for m in msgs if m['role']=='assistant'), '')\n",
|
| 109 |
-
" if not user_msg or not chosen or len(chosen) < 200:\n",
|
| 110 |
-
" skipped += 1; continue\n",
|
| 111 |
-
" try:\n",
|
| 112 |
-
" rejected = generate_rejected(chosen)\n",
|
| 113 |
-
" if not rejected or rejected == chosen or len(rejected) < 100:\n",
|
| 114 |
-
" skipped += 1; continue\n",
|
| 115 |
-
" pairs.append({'prompt': user_msg, 'chosen': chosen, 'rejected': rejected})\n",
|
| 116 |
-
" except Exception as e:\n",
|
| 117 |
-
" skipped += 1\n",
|
| 118 |
-
"\n",
|
| 119 |
-
"with open(PAIRS_OUT, 'w') as f:\n",
|
| 120 |
-
" for p in pairs: f.write(json.dumps(p) + '\\n')\n",
|
| 121 |
-
"\n",
|
| 122 |
-
"print(f'Generated {len(pairs)} pairs, skipped {skipped}')\n",
|
| 123 |
-
"if pairs:\n",
|
| 124 |
-
" s = pairs[0]\n",
|
| 125 |
-
" print(f'\\nSample chosen: {len(s[\"chosen\"])} chars, rejected: {len(s[\"rejected\"])} chars')"
|
| 126 |
-
]
|
| 127 |
},
|
| 128 |
{
|
| 129 |
"cell_type": "code",
|
|
|
|
| 82 |
"metadata": {},
|
| 83 |
"execution_count": null,
|
| 84 |
"outputs": [],
|
| 85 |
+
"source": "# Cell 5 — Generate SimPO preference pairs from existing SFT data\nimport json, traceback\nfrom pathlib import Path\n\nSFT_DATA = '/content/kr8tiv-training/data/prompts/awwwards-sft.jsonl'\nPAIRS_OUT = '/content/simpo_pairs.jsonl'\n\nexamples = []\nwith open(SFT_DATA) as f:\n for line in f:\n if line.strip():\n try: examples.append(json.loads(line))\n except: pass\n\nprint(f'Loaded {len(examples)} SFT examples')\n\n# Build preference pairs\npairs = []\nskipped = 0\nfirst_error = None\n\nfor ex in examples:\n msgs = ex.get('messages', [])\n user_msg = next((m['content'] for m in msgs if m['role']=='user'), '')\n chosen = next((m['content'] for m in msgs if m['role']=='assistant'), '')\n if not user_msg or not chosen or len(chosen) < 200:\n skipped += 1\n continue\n try:\n # Correct signature: (prompt, chosen_code)\n rejected = generate_rejected(user_msg, chosen)\n if not rejected or rejected == chosen or len(rejected) < 100:\n skipped += 1\n continue\n pairs.append({'prompt': user_msg, 'chosen': chosen, 'rejected': rejected})\n except Exception as e:\n if first_error is None:\n first_error = f'{type(e).__name__}: {e}'\n traceback.print_exc()\n skipped += 1\n\nwith open(PAIRS_OUT, 'w') as f:\n for p in pairs: f.write(json.dumps(p) + '\\n')\n\nprint(f'Generated {len(pairs)} pairs, skipped {skipped}')\nif first_error:\n print(f'First error encountered: {first_error}')\nif pairs:\n s = pairs[0]\n print(f'\\nSample chosen: {len(s[\"chosen\"])} chars, rejected: {len(s[\"rejected\"])} chars')\nelse:\n raise RuntimeError('Zero pairs generated — aborting.')"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
},
|
| 87 |
{
|
| 88 |
"cell_type": "code",
|