Downloads · 30 days
15
3% of all-time downloads
Saikrishna2511/qwen-multitask
qwen-multitask is a text generation model from Saikrishna2511. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Multi-task fine-tuned Qwen2.5-Coder-0.5B-Instruct checkpoint for code generation and documentation.
Downloads · 30 days
15
3% of all-time downloads
All-time downloads
508
Public
Parameters
494M
2 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors988 MB · 99%
From the Hugging Face model README
Multi-task fine-tuned Qwen2.5-Coder-0.5B-Instruct checkpoint for code generation and documentation.
Try the model in the browser: https://huggingface.co/spaces/Saikrishna2511/qwen-multitask-demo
This single checkpoint handles three tasks via different prompt prefixes:
nl2py)### Instruction: Write Python for: {natural language description}
### Response:
java2py)### Translate Java to Python:
```java
{java code}
code2doc)### Generate documentation for this Python code:
```python
{python code}
## Training
- **Base model:** [Qwen/Qwen2.5-Coder-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-0.5B-Instruct)
- **Stage 1:** Java→Python LoRA fine-tune on AVATAR-TC
- **Stage 2:** Multi-task LoRA on NL2Py, Code2Doc, code comments, and Java2Py replay
- **Method:** LoRA (r=16, alpha=32), merged weights for inference
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Saikrishna2511/qwen-multitask"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
torch_dtype=torch.float16,
device_map="auto",
)
prompt = "### Instruction: Write Python for: return the factorial of n\n### Response:\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.2, top_p=0.95)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
For post-processing and all three task templates, see the project repo or the linked Gradio Space.