Views
No views yet
“让知识开口说话” —— 中国科学院大学 星语调校局 出品
1conda create -n TQL_lab python=3.10
2conda activate TQL_lab 1pip install -r requirements.txt
2pip install -U torch torchvision torchaudio transformers accelerate protobuf==3.19.0python chat.py --model-path ./bayling-2-7b --style rich --load-8bit
1{
2 "instruction": "假设你是一位天文学家。以下是一道【天文技术与方法】方向的简答题,请简要回答问题,突出重点。",
3 "input": "有人说“偏振光有什么应用场景?”,你怎么看?",
4 "output": "解释如下:偏光式3D技术普遍用于商业影院和其它高端应用,它是偏振光的典型应用。在技术方式上和快门式是一样的,其不同的是被动接收所以也被称为属于被动式3D技术,辅助设备方面的成本较低,但对输出设备的要求较高,所以非常适合商业影院等需要众多观众的场所使用。"
5}.json 文件用于训练;

1git clone https://github.com/tloen/alpaca-lora.git
2cd alpaca-lorarequirements.txt,删除:- git+https://github.com/huggingface/peft.git1pip install -r requirements.txt
2pip install scipy peft pytest pyyaml
3pip install datasets==2.10.1 fsspec==2023.9.2 transformers==4.44.2alpaca-lora 仓库中的文件夹中新建文件 templates/bayling.json,内容如下:1{
2 "description": "Template used by 星语者(StellarSpeak).",
3 "prompt_input": "I am an intelligent language assistant developed by 星语调校局。\nBelow is a dialog consisting of instructions and responses. Write a response that completes the request.\n\n### Instruction:\n{instruction} {input}\n### Response:\n",
4 "prompt_no_input": "I am an intelligent language assistant developed by 星语调校局。\nBelow is a dialog consisting of instructions and responses. Write a response that completes the request.\n\n### Instruction:\n{instruction}\n### Response:\n",
5 "response_split": "### Response:"
6}1# 设置使用的 GPU
2export CUDA_VISIBLE_DEVICES=0
3
4# 启动微调脚本
5python /home/jovyan/data/alpaca-lora-main/finetune.py \
6 --base_model '/home/jovyan/data/bayling_model/bayling-13b' \
7 --data_path '/home/jovyan/data/train_js/train_dataset.json' \
8 --output_dir '/home/jovyan/data/fine_model/v1' \
9 --batch_size 256 \
10 --micro_batch_size 2 \
11 --num_epochs 3 \
12 --learning_rate 1e-4 \
13 --cutoff_len 256 \
14 --lora_r 8 \
15 --lora_alpha 16 \
16 --lora_dropout 0.05 \
17 --lora_target_modules '[q_proj,k_proj,v_proj,o_proj]' \
18 --train_on_inputs False \
19 --prompt_template_name '/home/jovyan/data/alpaca-lora-main/templates/bayling' \
20 --group_by_length| 模型版本 | cutoff_len | micro_batch_size | 显存需求 |
|---|---|---|---|
| 7B | 512 | 4 | ≈ 50 GB |
| 13B | 256 | 2 | ≈ 80 GB |
1python /home/jovyan/data/alpaca-lora-main/export_hf_checkpoint.py \
2 --base-model /home/jovyan/data/bayling_model/bayling-13b \
3 --lora-model /home/jovyan/data/fine_model/v1/checkpoint-4068 \
4 --output-model /home/jovyan/data/StellarSpeak/v1
5

person_output.json

vicuna_80_zh(1–10题)与 vicuna_80_en(11–20题)
score.json(包含 output1 = BayLing,output2 = StellarSpeak,win 标签)

1{
2 "instruction": "从天文学角度出发,请处理以下内容。假设你是一个天文学家,下面我给你一个天文技术与方法方向的问题,请你判断以下陈述是否正确,并给出一个明确的结论与简要解释。",
3 "input": "下面这句话你怎么看?在月球上可以观测到人造卫星现象",
4 "output": "在月球上可以观测到人造卫星现象,这是一种新的观测手段。\n结论:这句话是正确的。\n简要解释:这句话表明,人造卫星在月球上可以被观测到,这是一种新的观测手段。"
5}1{
2 "instruction": "Analyze the user's mathematical question and their attempted solution. Identify any errors or points of confusion, and provide a clear, correct answer with a detailed explanation.",
3 "input": "Why is the volume of a sphere $\\frac{4}{3}\\pi r^3$? I learned that the volume of a sphere is $\\frac{4}{3}\\pi r^3$, but why? The $\\pi$ kind of makes sense because it's round like a circle, and the $r^3$ because it's 3-D, but $\\frac{4}{3}$ is so random! How could somebody guess something like this for the formula?",
4 "output": "The volume of a sphere is given by the formula $\\frac{4}{3}\\pi r^3$, where $r$ is the radius of the sphere.\nThis formula is not guessed but derived mathematically. One common derivation involves integral calculus. Imagine slicing the sphere into infinitesimally thin circular disks along its diameter. The area of each disk is $\\pi r^2$, and the radius of the disk depends on its position along the vertical axis. Integrating these areas over the entire sphere yields the $\\frac{4}{3}\\pi r^3$ volume. The $\\frac{4}{3}$ emerges naturally from the geometry during integration."
5}

| 模型名称 | Perplexity(困惑度) | BLEU 分数 |
|---|---|---|
| StellarSpeak-13B | 21.85 | 24.83 |
| BayLing-13B | 54.64 | 35.92 |
🔍 结论分析:StellarSpeak 的困惑度显著低于 BayLing,说明其语言理解更稳定、生成更聚焦;尽管 BayLing 的 BLEU 得分略高,但主要体现在表面语言相似度,缺乏专业术语的精确性和推理结构的完整性。综合而言,StellarSpeak 更胜一筹,尤其适用于科研问答与教学场景。
| 模型版本 | 部署显存 | 推荐显卡 |
|---|---|---|
| 7B | ≥ 8GiB | RTX 3060 (12G)、RTX A2000 (12G)、A10 |
| 13B | ≥ 16GiB | RTX 4080 (16G)、RTX 4090 (24G)、A6000、L40 |
| 姓名 | 分工说明 |
|---|---|
| 王祺森 | 负责天文领域知识、数学基础计算方面的模型评估;构建与优化自我认知语料库 |
| 刘擎天 | 从 Astro-QA 数据集中挖掘 10 万条中文天文知识;整合所有训练语料并训练星语者-7B 与 13B 模型 |
| 高楚皓 | 收集 10 万条数学推理训练语料;协助完成星语者-13B 模型的训练流程 |
| 周琝轩 | 在 Vicuna-80 中文/英文测试集中完成 20 条通用任务的人工评估;测试小组模型自我认知能力 |
| 高秋阳 | 构建自我认知三元语料集合;整合团队报告与文档撰写内容 |