$ show SCIR-HI/Huatuo-Llama-Med-Chinese
This is a research repository from the SCIR-HI lab at Harbin Institute of Technology, focused on instruction-tuning large language models (LLaMA, Alpaca, Bloom, Huozi) with Chinese medical knowledge. The core contribution is the construction of Chinese medical instruction datasets using structured knowledge bases (cMeKG) and medical literature via GPT3.5, followed by LoRA-based fine-tuning. The repository provides scripts for fine-tuning, inference, and model export, along with pre-trained LoRA weights. While it demonstrates a complete research pipeline (data generation, training, evaluation), it is primarily a research artifact rather than a production application. The code is functional and includes a clean, reusable Prompter class for template management, but lacks software engineering rigor (no tests, no CI). Reproducibility is moderate: dependencies are pinned, but the data generation process is not fully automated, and external base models and LoRA weights must be obtained separately.
The LLM identified 2 files worth highlighting for reuse:
A self-contained Prompter class for loading and applying JSON-defined prompt templates. It supports generating prompts with or without input, and extracting model responses. The class is isolated (only imports json and os.path), parameterizable, and can be extracted into any instruction-tuning project with minimal changes. It demonstrates a clean separation of prompt formatting logic from model inference.
A full LoRA fine-tuning script using Hugging Face Trainer and PEFT. It supports resuming from checkpoints, Weights & Biases logging, flexible prompt templates, and custom save callback. While the pattern is common, the script is well-structured and can serve as a reusable template for LoRA-based instruction tuning of causal LMs, especially for medical or domain-specific tasks.