Downloads · 30 days
23
11% of all-time downloads
AymanElFou/qwen2.5-1.5b-java-expert
qwen2.5-1.5b-java-expert is a text generation model from AymanElFou. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
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.
Downloads · 30 days
23
11% of all-time downloads
All-time downloads
208
Public
Parameters
1.5B
3.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors3.1 GB · 100%
From the Hugging Face model README
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.
"Question out of concept, just Java Questions".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))