☕ Qwen2.5-1.5B Java Expert

This model is a fine-tuned version of Qwen2.5-1.5B-Instruct on a specialized dataset of 500 theoretical Java programming questions and answers.

🚀 Model Features

  • Specialization: Java OOP, JVM Internals, Multithreading, Collections, Generics, Design Patterns, Java 8+ features.
  • Out-of-Scope Guardrail: Rejects non-Java queries with "Question out of concept, just Java Questions".
  • Lightweight & Fast: Ideal for fast CPU/GPU inference.

💻 Usage Example

from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "AymanElFou/qwen2.5-1.5b-java-expert"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")

messages = [
    {"role": "system", "content": "You are an expert Java programming assistant. Strict rule: If the question is NOT related to Java or programming, answer ONLY with: 'Question out of concept, just Java Questions'."},
    {"role": "user", "content": "What is the difference between HashMap and ConcurrentHashMap?"}
]

prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Downloads last month
-
Safetensors
Model size
2B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for AymanElFou/qwen2.5-1.5b-java-expert

Adapter
(1342)
this model