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 modeling_pragya.py
Browse files- modeling_pragya.py +6 -2
modeling_pragya.py
CHANGED
|
@@ -68,8 +68,12 @@ class PragyaForCausalLM(PreTrainedModel, GenerationMixin):
|
|
| 68 |
for name, buf in _non_persistent_buffers(fresh).items():
|
| 69 |
own[name].copy_(buf)
|
| 70 |
del fresh
|
| 71 |
-
# wte and lm_head are one tensor
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
def _init_weights(self, module):
|
| 75 |
# Weights come from GPT.__init__ (Engram tables, zero-init attention gate, tied
|
|
|
|
| 68 |
for name, buf in _non_persistent_buffers(fresh).items():
|
| 69 |
own[name].copy_(buf)
|
| 70 |
del fresh
|
| 71 |
+
# wte and lm_head are one tensor. Checkpoints store one of the two, so tie from the
|
| 72 |
+
# one that was actually loaded, not from whichever happens to be first.
|
| 73 |
+
if "model.lm_head.weight" in missing_keys:
|
| 74 |
+
self.model.lm_head.weight = self.model.transformer.wte.weight
|
| 75 |
+
else:
|
| 76 |
+
self.model.transformer.wte.weight = self.model.lm_head.weight
|
| 77 |
|
| 78 |
def _init_weights(self, module):
|
| 79 |
# Weights come from GPT.__init__ (Engram tables, zero-init attention gate, tied
|