Text Generation
Transformers
Safetensors
GGUF
hrm
Mixture of Experts
hierarchical-reasoning
custom-architecture
Instructions to use Scorched2/shader-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Scorched2/shader-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Scorched2/shader-v2")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Scorched2/shader-v2", dtype="auto") - llama-cpp-python
How to use Scorched2/shader-v2 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Scorched2/shader-v2", filename="hrm-350m-q8_0.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Scorched2/shader-v2 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Scorched2/shader-v2:Q8_0 # Run inference directly in the terminal: llama-cli -hf Scorched2/shader-v2:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Scorched2/shader-v2:Q8_0 # Run inference directly in the terminal: llama-cli -hf Scorched2/shader-v2:Q8_0
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Scorched2/shader-v2:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf Scorched2/shader-v2:Q8_0
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Scorched2/shader-v2:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf Scorched2/shader-v2:Q8_0
Use Docker
docker model run hf.co/Scorched2/shader-v2:Q8_0
- LM Studio
- Jan
- vLLM
How to use Scorched2/shader-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Scorched2/shader-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Scorched2/shader-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Scorched2/shader-v2:Q8_0
- SGLang
How to use Scorched2/shader-v2 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 "Scorched2/shader-v2" \ --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": "Scorched2/shader-v2", "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 "Scorched2/shader-v2" \ --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": "Scorched2/shader-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Ollama
How to use Scorched2/shader-v2 with Ollama:
ollama run hf.co/Scorched2/shader-v2:Q8_0
- Unsloth Studio
How to use Scorched2/shader-v2 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 Scorched2/shader-v2 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 Scorched2/shader-v2 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Scorched2/shader-v2 to start chatting
- Docker Model Runner
How to use Scorched2/shader-v2 with Docker Model Runner:
docker model run hf.co/Scorched2/shader-v2:Q8_0
- Lemonade
How to use Scorched2/shader-v2 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Scorched2/shader-v2:Q8_0
Run and chat with the model
lemonade run user.shader-v2-Q8_0
List all available models
lemonade list
Upload folder using huggingface_hub
Browse files- README.md +25 -0
- config.json +37 -0
- generation_config.json +9 -0
- model.safetensors +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +13 -0
README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
tags: [hrm, moe, hierarchical-reasoning, custom-architecture]
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
# Hierarchical Reasoning Model (HRM)
|
| 7 |
+
|
| 8 |
+
Custom MoE language model with 3-level hierarchical reasoning and DeepSeek-V3 memory strategies.
|
| 9 |
+
|
| 10 |
+
**Architecture:** 3 levels 路 16 experts (4 active) 路 MLA attention 路 Hierarchical memory
|
| 11 |
+
**Parameters:** ~350M total, ~45M active per token
|
| 12 |
+
**Trained on:** OpenHermes-2.5
|
| 13 |
+
|
| 14 |
+
## Usage
|
| 15 |
+
|
| 16 |
+
```python
|
| 17 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 18 |
+
|
| 19 |
+
model = AutoModelForCausalLM.from_pretrained("Scorched2/shader-v2", trust_remote_code=True)
|
| 20 |
+
tokenizer = AutoTokenizer.from_pretrained("Scorched2/shader-v2")
|
| 21 |
+
|
| 22 |
+
inputs = tokenizer("### Instruction:\nExplain AI.\n\n### Response:\n", return_tensors="pt")
|
| 23 |
+
out = model.generate(**inputs, max_new_tokens=200)
|
| 24 |
+
print(tokenizer.decode(out[0]))
|
| 25 |
+
```
|
config.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"HRMForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"bos_token_id": 50256,
|
| 6 |
+
"d_ff": 1536,
|
| 7 |
+
"d_model": 768,
|
| 8 |
+
"dropout": 0.0,
|
| 9 |
+
"dtype": "float32",
|
| 10 |
+
"eos_token_id": 50256,
|
| 11 |
+
"episodic_mem_slots": 64,
|
| 12 |
+
"head_dim": 64,
|
| 13 |
+
"kv_lora_rank": 192,
|
| 14 |
+
"layers_per_level": [
|
| 15 |
+
3,
|
| 16 |
+
3,
|
| 17 |
+
3
|
| 18 |
+
],
|
| 19 |
+
"max_seq_len": 256,
|
| 20 |
+
"model_type": "hrm",
|
| 21 |
+
"moe_d_ff": 512,
|
| 22 |
+
"mtp_heads": 2,
|
| 23 |
+
"n_active_experts": 4,
|
| 24 |
+
"n_experts": 16,
|
| 25 |
+
"n_heads": 12,
|
| 26 |
+
"n_levels": 3,
|
| 27 |
+
"n_shared_experts": 1,
|
| 28 |
+
"pad_token_id": 0,
|
| 29 |
+
"q_lora_rank": 256,
|
| 30 |
+
"rope_head_dim": 32,
|
| 31 |
+
"semantic_mem_dim": 768,
|
| 32 |
+
"semantic_mem_size": 512,
|
| 33 |
+
"tie_embeddings": true,
|
| 34 |
+
"transformers_version": "5.7.0",
|
| 35 |
+
"vocab_size": 50257,
|
| 36 |
+
"working_mem_slots": 16
|
| 37 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 50256,
|
| 4 |
+
"eos_token_id": 50256,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 0,
|
| 8 |
+
"transformers_version": "5.7.0"
|
| 9 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bd7854934776f17859694a4f26ae0bcf329f9c6ccf3f932ee16ae6bb45878101
|
| 3 |
+
size 1301867064
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|endoftext|>",
|
| 5 |
+
"eos_token": "<|endoftext|>",
|
| 6 |
+
"errors": "replace",
|
| 7 |
+
"is_local": false,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"model_max_length": 1024,
|
| 10 |
+
"pad_token": "<|endoftext|>",
|
| 11 |
+
"tokenizer_class": "GPT2Tokenizer",
|
| 12 |
+
"unk_token": "<|endoftext|>"
|
| 13 |
+
}
|