Instructions to use pszemraj/rnj-1.5-instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pszemraj/rnj-1.5-instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pszemraj/rnj-1.5-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("pszemraj/rnj-1.5-instruct") model = AutoModelForMultimodalLM.from_pretrained("pszemraj/rnj-1.5-instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use pszemraj/rnj-1.5-instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pszemraj/rnj-1.5-instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pszemraj/rnj-1.5-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/pszemraj/rnj-1.5-instruct
- SGLang
How to use pszemraj/rnj-1.5-instruct 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 "pszemraj/rnj-1.5-instruct" \ --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": "pszemraj/rnj-1.5-instruct", "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 "pszemraj/rnj-1.5-instruct" \ --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": "pszemraj/rnj-1.5-instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use pszemraj/rnj-1.5-instruct with Docker Model Runner:
docker model run hf.co/pszemraj/rnj-1.5-instruct
rnj-1.5-instruct (sliding-window patched)
Drop-in transformers repack of EssentialAI/rnj-1.5-instruct intended for quick inference tests, downstream software compatiblity (transformers/torch itself, llama.cpp, etc):
- Upstream declares
layer_types: chunked_attention, whichmodeling_gemma3.pydoesn't implement - inference crashes withKeyError: 'chunked_attention'. This repo swaps those entries tosliding_attentionso the model loads under stocktransformers. Weights unchanged, resaved in bf16.
Sliding window (8192) is not identical to the original block-local attention - equivalent for prompts ~< 8192 tokens, divergent beyond that. For faithful long-context inference, use vLLM 0.20.0 against the upstream repo.
Changes vs upstream
| Field | Upstream | Here |
|---|---|---|
| Local layer type | chunked_attention | sliding_attention |
| RoPE params for locals | under chunked_attention key | moved to sliding_attention key |
| Dtype | float32 | bfloat16 |
| Architecture string | Rnj1ForCausalLM | Gemma3ForCausalLM |
Local/global layer pattern (LLLGLLLGLLLGLGGGGGLGLLLGLLLGLLLL) preserved.
Usage
import torch
from transformers import pipeline
pipe = pipeline(
"text-generation",
model="pszemraj/rnj-1.5-instruct",
dtype=torch.bfloat16,
device_map="auto",
)
res = pipe([{"role": "user", "content": "Who are you?"}])
print(res)
License
Apache 2.0, inherited from upstream. See the original model card for architecture, benchmarks, and citation.
- Downloads last month
- 2