Instructions to use prithivMLmods/Castula-U2-QwenRe-1.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/Castula-U2-QwenRe-1.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="prithivMLmods/Castula-U2-QwenRe-1.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/Castula-U2-QwenRe-1.5B") model = AutoModelForCausalLM.from_pretrained("prithivMLmods/Castula-U2-QwenRe-1.5B") 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
- vLLM
How to use prithivMLmods/Castula-U2-QwenRe-1.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/Castula-U2-QwenRe-1.5B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/Castula-U2-QwenRe-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prithivMLmods/Castula-U2-QwenRe-1.5B
- SGLang
How to use prithivMLmods/Castula-U2-QwenRe-1.5B 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 "prithivMLmods/Castula-U2-QwenRe-1.5B" \ --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": "prithivMLmods/Castula-U2-QwenRe-1.5B", "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 "prithivMLmods/Castula-U2-QwenRe-1.5B" \ --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": "prithivMLmods/Castula-U2-QwenRe-1.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use prithivMLmods/Castula-U2-QwenRe-1.5B with Docker Model Runner:
docker model run hf.co/prithivMLmods/Castula-U2-QwenRe-1.5B
Castula-U2-QwenRe-1.5B
Castula-U2-QwenRe-1.5B is a compact, multilingual reasoning model fine-tuned from Qwen-1.5B, excelling in mathematical problem solving, logical reasoning, code generation, and general-purpose tasks. Its step-by-step reasoning and bilingual fluency make it ideal for educational systems, coding assistants, and lightweight reasoning applications.
Key Features
Advanced Step-by-Step Reasoning
Fine-tuned to produce intermediate steps for math, logic, and code problems, offering transparency and interpretability crucial for education, coding help, and diagnostics.Multilingual Proficiency (English + Chinese)
Understands and solves problems in both English and Simplified Chinese, making it accessible in diverse learning and working environments.Compact Yet Versatile (1.5B Parameters)
Small enough for low-resource environments, yet capable of math, logical puzzles, basic coding tasks, and general comprehension, balancing performance and efficiency.Structured Computation & Problem Solving
Mirrors human-like multi-step problem-solving, making solutions easy to follow, debug, or verify.
Quickstart with Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "prithivMLmods/Castula-U2-QwenRe-1.5B"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Solve: A train travels 180 km in 3 hours. What is its average speed?"
messages = [
{"role": "system", "content": "You are a helpful tutor skilled in solving math, logic, and code problems with step-by-step explanations."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
Intended Use
- Math & Logic Tutoring: Solves problems with explanations ideal for students and educators.
- Code Assistant: Helps with beginner-to-intermediate code generation and understanding.
- Bilingual Apps: Educational tools in English and Chinese for a global audience.
- Lightweight Reasoning Systems: Deployable in mobile apps, browser extensions, and edge devices.
Limitations
Domain Specialization:
Best in math, logic, and code. Performance may degrade in highly creative or abstract language tasks.Compact Scale:
While efficient, may underperform larger models in deeply complex reasoning or long-context tasks.Inherited Bias:
May reflect biases from the base model (Qwen-1.5B); outputs should be verified for sensitive or critical uses.Prompt Sensitivity:
Structured, clearly stated inputs produce significantly better outputs.
- Downloads last month
- 3
