Text Generation
Transformers
PyTorch
English
shram
research
sparse-attention
mixture-of-experts
custom_code
Instructions to use smithblack-0/SHRAM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use smithblack-0/SHRAM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="smithblack-0/SHRAM", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("smithblack-0/SHRAM", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use smithblack-0/SHRAM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "smithblack-0/SHRAM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "smithblack-0/SHRAM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/smithblack-0/SHRAM
- SGLang
How to use smithblack-0/SHRAM 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 "smithblack-0/SHRAM" \ --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": "smithblack-0/SHRAM", "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 "smithblack-0/SHRAM" \ --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": "smithblack-0/SHRAM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use smithblack-0/SHRAM with Docker Model Runner:
docker model run hf.co/smithblack-0/SHRAM
Update architecture and tokenizer
Browse files- architecture_core/README.md +16 -6
architecture_core/README.md
CHANGED
|
@@ -34,10 +34,16 @@ All other components follow the Llama 3 baseline (RMSNorm, SwiGLU FFN, RoPE).
|
|
| 34 |
|
| 35 |
## Usage
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
```python
|
| 38 |
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
|
| 39 |
|
| 40 |
-
#
|
|
|
|
|
|
|
| 41 |
config = AutoConfig.from_pretrained(
|
| 42 |
"smithblack-0/SHRAM",
|
| 43 |
trust_remote_code=True,
|
|
@@ -45,15 +51,19 @@ config = AutoConfig.from_pretrained(
|
|
| 45 |
num_mosrah_heads=32, # example override
|
| 46 |
)
|
| 47 |
|
| 48 |
-
#
|
|
|
|
| 49 |
model = AutoModelForCausalLM.from_config(config, trust_remote_code=True)
|
| 50 |
|
| 51 |
-
#
|
| 52 |
tokenizer = AutoTokenizer.from_pretrained("smithblack-0/SHRAM")
|
|
|
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
| 57 |
```
|
| 58 |
|
| 59 |
## Constructor Defaults
|
|
|
|
| 34 |
|
| 35 |
## Usage
|
| 36 |
|
| 37 |
+
This repository contains no pretrained weights. The intended workflow is: pull the
|
| 38 |
+
architecture config from the Hub, instantiate a model with fresh random weights, then
|
| 39 |
+
train it yourself.
|
| 40 |
+
|
| 41 |
```python
|
| 42 |
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
|
| 43 |
|
| 44 |
+
# Step 1: pull the architecture config from the Hub.
|
| 45 |
+
# AutoConfig.from_pretrained downloads config.json only — no weights are loaded.
|
| 46 |
+
# Override any parameter via kwargs.
|
| 47 |
config = AutoConfig.from_pretrained(
|
| 48 |
"smithblack-0/SHRAM",
|
| 49 |
trust_remote_code=True,
|
|
|
|
| 51 |
num_mosrah_heads=32, # example override
|
| 52 |
)
|
| 53 |
|
| 54 |
+
# Step 2: instantiate with fresh random weights.
|
| 55 |
+
# from_config never loads a checkpoint — it always produces a randomly initialised model.
|
| 56 |
model = AutoModelForCausalLM.from_config(config, trust_remote_code=True)
|
| 57 |
|
| 58 |
+
# Step 3: load the tokenizer.
|
| 59 |
tokenizer = AutoTokenizer.from_pretrained("smithblack-0/SHRAM")
|
| 60 |
+
```
|
| 61 |
|
| 62 |
+
After training your own checkpoint, save and reload it in the standard way:
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
model.save_pretrained("./my-checkpoint")
|
| 66 |
+
model = AutoModelForCausalLM.from_pretrained("./my-checkpoint", trust_remote_code=True)
|
| 67 |
```
|
| 68 |
|
| 69 |
## Constructor Defaults
|