Text Generation
Transformers
Safetensors
English
pragya_e2
small-language-model
from-scratch
causal-lm
decoder-only
gqa
rope
swiglu
exclusive-gated-attention
engram
custom_code
Instructions to use RuVI-AI/Pragya-EXP2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RuVI-AI/Pragya-EXP2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RuVI-AI/Pragya-EXP2", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("RuVI-AI/Pragya-EXP2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RuVI-AI/Pragya-EXP2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RuVI-AI/Pragya-EXP2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RuVI-AI/Pragya-EXP2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/RuVI-AI/Pragya-EXP2
- SGLang
How to use RuVI-AI/Pragya-EXP2 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 "RuVI-AI/Pragya-EXP2" \ --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": "RuVI-AI/Pragya-EXP2", "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 "RuVI-AI/Pragya-EXP2" \ --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": "RuVI-AI/Pragya-EXP2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use RuVI-AI/Pragya-EXP2 with Docker Model Runner:
docker model run hf.co/RuVI-AI/Pragya-EXP2
Update README.md
Browse files
README.md
CHANGED
|
@@ -134,14 +134,16 @@ Engram adds a hashed n-gram lookup at layers 1 and 8. Token sequences are compre
|
|
| 134 |
|
| 135 |
## Quick start
|
| 136 |
|
|
|
|
|
|
|
| 137 |
The model and tokenizer load through `transformers` with remote code. Batched generation with padding is not supported yet, so generate one prompt at a time.
|
| 138 |
|
| 139 |
```python
|
| 140 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 141 |
|
| 142 |
-
repo = "RuVI-AI/Pragya-EXP2"
|
| 143 |
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
|
| 144 |
-
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True).eval()
|
| 145 |
|
| 146 |
inputs = tok("The Internet is", return_tensors="pt")
|
| 147 |
out = model.generate(
|
|
@@ -151,6 +153,8 @@ out = model.generate(
|
|
| 151 |
do_sample=True,
|
| 152 |
temperature=0.7,
|
| 153 |
top_k=20,
|
|
|
|
|
|
|
| 154 |
use_cache=False,
|
| 155 |
pad_token_id=tok.pad_token_id,
|
| 156 |
)
|
|
@@ -159,19 +163,34 @@ print(tok.decode(out[0], skip_special_tokens=True))
|
|
| 159 |
|
| 160 |
The tokenizer prepends `<|bos|>` by default. The string `<|bos|>` inside a prompt is treated as ordinary text.
|
| 161 |
|
| 162 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 163 |
|
| 164 |
## Sampling
|
| 165 |
|
| 166 |
-
|
| 167 |
|
| 168 |
```text
|
| 169 |
-
temperature 0.
|
| 170 |
-
top_k 20
|
| 171 |
-
repetition_penalty 1.
|
|
|
|
| 172 |
```
|
| 173 |
|
| 174 |
-
|
|
|
|
|
|
|
| 175 |
|
| 176 |
## Capabilities
|
| 177 |
|
|
|
|
| 134 |
|
| 135 |
## Quick start
|
| 136 |
|
| 137 |
+
Install: `pip install torch transformers safetensors`
|
| 138 |
+
|
| 139 |
The model and tokenizer load through `transformers` with remote code. Batched generation with padding is not supported yet, so generate one prompt at a time.
|
| 140 |
|
| 141 |
```python
|
| 142 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 143 |
|
| 144 |
+
repo = "RuVI-AI/Pragya-EXP2" # or a local folder
|
| 145 |
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
|
| 146 |
+
model = AutoModelForCausalLM.from_pretrained(repo, trust_remote_code=True).to("cpu").eval()
|
| 147 |
|
| 148 |
inputs = tok("The Internet is", return_tensors="pt")
|
| 149 |
out = model.generate(
|
|
|
|
| 153 |
do_sample=True,
|
| 154 |
temperature=0.7,
|
| 155 |
top_k=20,
|
| 156 |
+
repetition_penalty=1.3,
|
| 157 |
+
no_repeat_ngram_size=3,
|
| 158 |
use_cache=False,
|
| 159 |
pad_token_id=tok.pad_token_id,
|
| 160 |
)
|
|
|
|
| 163 |
|
| 164 |
The tokenizer prepends `<|bos|>` by default. The string `<|bos|>` inside a prompt is treated as ordinary text.
|
| 165 |
|
| 166 |
+
### Expected load output
|
| 167 |
+
|
| 168 |
+
Loading prints a `LOAD REPORT` listing `model.lm_head.weight` as `MISSING`. This is expected. The checkpoint stores the embedding once, and the head is tied to it when the model loads. Check it with:
|
| 169 |
+
|
| 170 |
+
```python
|
| 171 |
+
print("tied:", model.model.transformer.wte.weight is model.model.lm_head.weight)
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
It should print `True`.
|
| 175 |
+
|
| 176 |
+
### Hub download messages
|
| 177 |
+
|
| 178 |
+
On first load, Transformers prints "A new version of the following files was downloaded". This is the remote code being fetched, not an error. Pin a `revision=` to avoid the message once you have a version you trust.
|
| 179 |
|
| 180 |
## Sampling
|
| 181 |
|
| 182 |
+
These settings produced fluent, on-topic output in testing:
|
| 183 |
|
| 184 |
```text
|
| 185 |
+
temperature 0.7
|
| 186 |
+
top_k 20
|
| 187 |
+
repetition_penalty 1.3
|
| 188 |
+
no_repeat_ngram 3
|
| 189 |
```
|
| 190 |
|
| 191 |
+
Greedy decoding (`do_sample=False`) repeats phrases after a few sentences. Use sampling.
|
| 192 |
+
|
| 193 |
+
The model writes in a simple, children's-book register. This reflects the TinyStories-heavy data mix rather than a bug.
|
| 194 |
|
| 195 |
## Capabilities
|
| 196 |
|