Hello! Welcome to the huggingface repository for Diabetica.
Recent advancements, such as o1, have demonstrated that inference-time scaling is an effective approach to enhance LLMs’ reasoning capabilities via Chain-of-Thought (CoT). Encouragingly, several open-source o1-like LLMs with long-form reasoning exhibit strong performances, such as QwQ-32B and Deepseek-R1.
To leverage these capabilities, we conduct an initial experiment utilizing strong o1-like LLMs for model distillation. Specifically, we use Deepseek-R1-Distilled-Qwen-32B as our teacher model.
Our data augmentation strategy follows a two-step approach:
(1) We prompt Qwen2.5-72B-Instruct to generate diverse synthetic questions based on existing datasets.
(2) We then use Deepseek-R1-Distilled-Qwen-32B to generate responses for both the collected and synthetic instructions, resulting in an enriched dataset of 70K samples with extensive CoT reasoning steps.
After that, we use the 70K dataset Diabetica-o1-SFT to fine-tune Qwen2.5-7B-Instruct and get Diabetica-o1-7B.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
34device ="cuda"# the device to load the model onto5model_path ='WaltonFuture/Diabetica-o1'67model = AutoModelForCausalLM.from_pretrained(8 model_path,
9torch_dtype="auto",
10device_map="auto"11)12tokenizer = AutoTokenizer.from_pretrained(model_path)1314def model_output(content):
15 messages =[16{"role":"system", "content":"You are a helpful assistant."},
17{"role":"user", "content": content}18]19 text = tokenizer.apply_chat_template(20 messages,
21tokenize=False,
22add_generation_prompt=True
23)24 model_inputs = tokenizer([text], return_tensors="pt").to(device)25 generated_ids = model.generate(26 model_inputs.input_ids,
27max_new_tokens=16384,
28do_sample=True,
29)30 generated_ids =[31 output_ids[len(input_ids):]for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)32]33 response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]34return response
3536prompt ="Hello! Please tell me something about diabetes."3738response = model_output(prompt)39print(response)
Citation
@article{wei2024adapted,
title={An adapted large language model facilitates multiple medical tasks in diabetes care},
author={Wei, Lai and Ying, Zhen and He, Muyang and Chen, Yutong and Yang, Qian and Hong, Yanzhe and Lu, Jiaping and Li, Xiaoying and Huang, Weiran and Chen, Ying},
journal={arXiv preprint arXiv:2409.13191},
year={2024}
}