Text Generation
Transformers
Safetensors
PEFT
English
Chinese
qwen
lora
question-answering
qasper
scientific-qa
conversational
Instructions to use AGNDM/Fine-tuned_NLP_Qwen_0.5B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AGNDM/Fine-tuned_NLP_Qwen_0.5B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AGNDM/Fine-tuned_NLP_Qwen_0.5B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AGNDM/Fine-tuned_NLP_Qwen_0.5B", device_map="auto") - PEFT
How to use AGNDM/Fine-tuned_NLP_Qwen_0.5B with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AGNDM/Fine-tuned_NLP_Qwen_0.5B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AGNDM/Fine-tuned_NLP_Qwen_0.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": "AGNDM/Fine-tuned_NLP_Qwen_0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AGNDM/Fine-tuned_NLP_Qwen_0.5B
- SGLang
How to use AGNDM/Fine-tuned_NLP_Qwen_0.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 "AGNDM/Fine-tuned_NLP_Qwen_0.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": "AGNDM/Fine-tuned_NLP_Qwen_0.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 "AGNDM/Fine-tuned_NLP_Qwen_0.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": "AGNDM/Fine-tuned_NLP_Qwen_0.5B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AGNDM/Fine-tuned_NLP_Qwen_0.5B with Docker Model Runner:
docker model run hf.co/AGNDM/Fine-tuned_NLP_Qwen_0.5B
Fine-tuned_NLP_Qwen_0.5B (LoRA Adapter)
This repository provides a LoRA adapter fine-tuned from Qwen/Qwen2.5-0.5B-Instruct on the allenai/qasper dataset.
Model Details
- Adapter repo:
AGNDM/Fine-tuned_NLP_Qwen_0.5B - Base model:
Qwen/Qwen2.5-0.5B-Instruct - Task: Scientific paper question answering
- Training method: PEFT LoRA (with 4-bit loading during training)
Dataset
allenai/qasper- Domain: NLP/scientific paper reading comprehension and QA
How to Use
1) Install dependencies
pip install -U transformers peft accelerate torch
2) Load base model + LoRA adapter
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
base_model_id = "Qwen/Qwen2.5-0.5B-Instruct"
adapter_id = "AGNDM/Fine-tuned_NLP_Qwen_0.5B"
tokenizer = AutoTokenizer.from_pretrained(base_model_id, trust_remote_code=True)
base_model = AutoModelForCausalLM.from_pretrained(
base_model_id,
torch_dtype=torch.float16,
device_map="auto"
)
model = PeftModel.from_pretrained(base_model, adapter_id)
prompt = (
"You are a helpful scientific QA assistant. "
"Answer the question based only on the provided paper content.\n\n"
"### Paper Context\n"
"<paper context here>\n\n"
"### Question\n"
"What is the main contribution?\n\n"
"### Answer\n"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=128, do_sample=False)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Training Setup (Summary)
- Base model:
Qwen/Qwen2.5-0.5B-Instruct - LoRA:
r=16,alpha=32,dropout=0.05 - Effective batch size:
1 x gradient_accumulation_steps(16) = 16 - Max sequence length:
2048 - Dataset preprocessing: QASPER paper context + question → answer format
Limitations
- Model outputs may be incorrect or incomplete.
- Performance depends heavily on context quality and length.
- This adapter is tuned for QASPER-style scientific QA prompts.
Intended Use
- Research/demo for scientific document QA
- Educational use and experimentation with PEFT/LoRA
Citation
If you use this model, please cite QASPER and the base model:
@inproceedings{Dasigi2021ADO,
title={A Dataset of Information-Seeking Questions and Answers Anchored in Research Papers},
author={Pradeep Dasigi and Kyle Lo and Iz Beltagy and Arman Cohan and Noah A. Smith and Matt Gardner},
year={2021}
}