Views
No views yet
messages format compatible with Qwen's chat template.| Metric | Method | Few-shot | Score | Std Error |
|---|---|---|---|---|
| exact_match | flexible-extract | 5 | 34.12% | ±1.31% |
| exact_match | strict-match | 5 | 33.59% | ±1.30% |
temperature=0.0do_sample=Falsemax_tokens=256llm_int8_threshold=6.0llm_int8_has_fp16_weight=Falsellm_int8_enable_fp32_cpu_offload=Falseq_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_projpaged_adamw_8bit (8-bit AdamW optimizer for memory efficiency)1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "dongwookkwon/qwen0.5b-tech-interview-test"
4model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
5tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
6
7# Format your question
8question = "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May?"
9
10messages = [
11 {"role": "user", "content": question}
12]
13
14# Apply chat template
15inputs = tokenizer.apply_chat_template(
16 messages,
17 tokenize=True,
18 add_generation_prompt=True,
19 return_tensors="pt"
20)
21
22# Generate
23outputs = model.generate(
24 inputs,
25 max_new_tokens=256,
26 temperature=0.0,
27 do_sample=False
28)
29
30response = tokenizer.decode(outputs[0], skip_special_tokens=False)
31print(response)1from vllm import LLM, SamplingParams
2
3model = LLM(
4 model="dongwookkwon/qwen0.5b-tech-interview-test",
5 trust_remote_code=True,
6 dtype="float16",
7 gpu_memory_utilization=0.5
8)
9
10sampling_params = SamplingParams(
11 temperature=0.0,
12 max_tokens=256
13)
14
15prompt = "Question: Natalia sold clips to 48 of her friends in April..."
16outputs = model.generate([prompt], sampling_params)1@misc{qwen0.5b-tech-interview-test,
2 title={qwen0.5b-tech-interview-test: Fine-tuned Qwen2.5-0.5B for Mathematical Reasoning},
3 author={Dongwook Kwon},
4 year={2024},
5 howpublished={\url{https://huggingface.co/dongwookkwon/qwen0.5b-tech-interview-test}}
6}1@misc{qwen2.5,
2 title={Qwen2.5: A Party of Foundation Models},
3 author={Qwen Team},
4 year={2024},
5 howpublished={\url{https://huggingface.co/Qwen/Qwen2.5-0.5B}}
6}