Views
No views yet
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| 1.0377 | 1.18 | 20 | 1.1270 | 0.7382 |
| 0.6478 | 2.35 | 40 | 0.8764 | 0.7388 |
| - | 3.00 | 51 | 0.7984 | 0.8218 |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3# Load model and tokenizer
4model = AutoModelForCausalLM.from_pretrained(
5 "Acryl-Jonathan-01/qwen3-4b-medical-qa-merged",
6 torch_dtype="auto",
7 device_map="auto",
8 trust_remote_code=True
9)
10
11tokenizer = AutoTokenizer.from_pretrained(
12 "Acryl-Jonathan-01/qwen3-4b-medical-qa-merged",
13 trust_remote_code=True
14)
15
16# Prepare messages
17messages = [
18 {"role": "system", "content": "You are a helpful medical assistant."},
19 {"role": "user", "content": "What are the common symptoms of pneumonia?"}
20]
21
22# Generate response
23text = tokenizer.apply_chat_template(
24 messages,
25 tokenize=False,
26 add_generation_prompt=True
27)
28
29inputs = tokenizer([text], return_tensors="pt").to(model.device)
30
31outputs = model.generate(
32 **inputs,
33 max_new_tokens=512,
34 do_sample=True,
35 temperature=0.7,
36 top_p=0.8,
37 top_k=20
38)
39
40response = tokenizer.decode(outputs[0], skip_special_tokens=True)
41print(response)1from vllm import LLM, SamplingParams
2
3# Initialize vLLM
4llm = LLM(
5 model="Acryl-Jonathan-01/qwen3-4b-medical-qa-merged",
6 trust_remote_code=True,
7 dtype="bfloat16"
8)
9
10# Sampling parameters
11sampling_params = SamplingParams(
12 temperature=0.7,
13 top_p=0.8,
14 top_k=20,
15 max_tokens=512
16)
17
18# Generate
19prompts = ["What are the symptoms of diabetes?"]
20outputs = llm.generate(prompts, sampling_params)
21
22for output in outputs:
23 print(output.outputs[0].text)Modelfile is included for easy deployment with Ollama:1# Create Ollama model
2ollama create qwen3-medical -f Modelfile
3
4# Run the model
5ollama run qwen3-medical "What are the symptoms of hypertension?"1from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
2
3# 4-bit quantization
4bnb_config = BitsAndBytesConfig(
5 load_in_4bit=True,
6 bnb_4bit_compute_dtype="bfloat16",
7 bnb_4bit_use_double_quant=True,
8 bnb_4bit_quant_type="nf4"
9)
10
11model = AutoModelForCausalLM.from_pretrained(
12 "Acryl-Jonathan-01/qwen3-4b-medical-qa-merged",
13 quantization_config=bnb_config,
14 device_map="auto",
15 trust_remote_code=True
16)qwen3-4b-medical-qa-merged/
├── model-00001-of-00005.safetensors # Model weights (shard 1)
├── model-00002-of-00005.safetensors # Model weights (shard 2)
├── model-00003-of-00005.safetensors # Model weights (shard 3)
├── model-00004-of-00005.safetensors # Model weights (shard 4)
├── model-00005-of-00005.safetensors # Model weights (shard 5)
├── model.safetensors.index.json # Shard index
├── config.json # Model configuration
├── generation_config.json # Generation settings
├── tokenizer.json # Tokenizer
├── tokenizer_config.json # Tokenizer config
├── vocab.json # Vocabulary
├── merges.txt # BPE merges
├── chat_template.jinja # Chat template
├── special_tokens_map.json # Special tokens
├── added_tokens.json # Added tokens
├── Modelfile # Ollama modelfile
└── README.md # This file1@misc{qwen3-4b-medical-qa-merged,
2 author = {Your Name},
3 title = {Qwen3-4B Medical QA},
4 year = {2025},
5 publisher = {HuggingFace},
6 howpublished = {\url{https://huggingface.co/Acryl-Jonathan-01/qwen3-4b-medical-qa-merged}}
7}1@misc{qwen3-2025,
2 title={Qwen3 Technical Report},
3 author={Qwen Team},
4 year={2025},
5 publisher={Alibaba Cloud},
6 url={https://huggingface.co/Qwen}
7}