Instructions to use pharo-llm/Qwen2.5-Coder-1.5B-PT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use pharo-llm/Qwen2.5-Coder-1.5B-PT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="pharo-llm/Qwen2.5-Coder-1.5B-PT")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("pharo-llm/Qwen2.5-Coder-1.5B-PT", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use pharo-llm/Qwen2.5-Coder-1.5B-PT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "pharo-llm/Qwen2.5-Coder-1.5B-PT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "pharo-llm/Qwen2.5-Coder-1.5B-PT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/pharo-llm/Qwen2.5-Coder-1.5B-PT
- SGLang
How to use pharo-llm/Qwen2.5-Coder-1.5B-PT 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 "pharo-llm/Qwen2.5-Coder-1.5B-PT" \ --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": "pharo-llm/Qwen2.5-Coder-1.5B-PT", "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 "pharo-llm/Qwen2.5-Coder-1.5B-PT" \ --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": "pharo-llm/Qwen2.5-Coder-1.5B-PT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use pharo-llm/Qwen2.5-Coder-1.5B-PT with Docker Model Runner:
docker model run hf.co/pharo-llm/Qwen2.5-Coder-1.5B-PT
Qwen2.5-Coder for Pharo Code Completion
This repository provides a Pharo-specialized variant of Qwen2.5-Coder, fine-tuned for fill-in-the-middle (FIM) code completion in Pharo, a Smalltalk-inspired, low-resource programming language.
The model is designed to complete partially written Pharo methods by predicting the missing code between a given prefix and suffix, making it suitable for IDE-assisted code completion.
Model Details
- Base model: Qwen2.5-Coder
- Model type: Decoder-only causal language model
- Programming language: Pharo / Smalltalk
- Primary task: Fill-in-the-middle (FIM) code completion
- Training pipeline: Continued pre-training followed by supervised fine-tuning
- Maximum context length: 32,768 tokens
Motivation
Large language models perform remarkably well on widely used programming languages such as Python, Java, and JavaScript, but their performance remains limited for low-resource languages such as Pharo.
Pharo inherits several unique characteristics from Smalltalk, including keyword-based message syntax, message-oriented control flow, and concise methods. These models are specifically adapted to these characteristics to provide more accurate and practical code completion while remaining compact enough for efficient local inference and IDE integration.
Training Overview
The model is trained using a two-stage specialization pipeline.
Continued Pre-Training
The base Qwen2.5-Coder model is first adapted to Pharo source code through continued pre-training on a curated corpus of Pharo methods. This stage teaches the model Pharo syntax, APIs, and coding conventions.
Supervised Fine-Tuning
The adapted checkpoint is then fine-tuned on realistic fill-in-the-middle completion examples generated from Pharo methods. Completion targets begin at arbitrary cursor positions, better reflecting real-world code editing scenarios.
Usage
Install the required libraries:
pip install -U "transformers>=4.37.0" accelerate torch
Load the model:
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_name = "pharo-llm/Qwen2.5-Coder-7B-SFT"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto",
).eval()
Example
The model is trained for fill-in-the-middle (FIM) code completion using the Qwen FIM prompt format.
prefix = """Collection >> selectEven
^ self select: [ :each |
"""
suffix = """
]
"""
prompt = (
"<|fim_prefix|>"
+ prefix +
"<|fim_suffix|>"
+ suffix +
"<|fim_middle|>"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=16,
do_sample=False,
)
completion = tokenizer.decode(
outputs[0][inputs.input_ids.shape[1]:],
skip_special_tokens=True,
)
print(completion)
Expected completion:
each even
Paper
For additional details about the training methodology, datasets, and evaluation, see:
Teaching LLMs a Low-Resource Language: Enhancing Code Completion in Pharo
https://huggingface.co/papers/2607.04939
Citation
If you use this model in your research or applications, please cite our paper:
@article{teachingllmslowresourcelanguage,
title={Teaching LLMs a Low-Resource Language: Enhancing Code Completion in Pharo},
author={Kilian Kier and Alessandro Giagnorio and Omar AbedelKader and Oleksandr Zaitsev and Robert Peharz and Romain Robbes and Gabriele Bavota and Stéphane Ducasse},
journal={arXiv},
year={2026},
doi={10.48550/arXiv.2607.04939}
}