模型:

GeorgiaTechResearchInstitute/galpaca-6.7b

英文

GALPACA 6.7B(标准版)

在Alpaca数据集上对GALACTICA 6.7B进行了微调。

GALACTICA仓库的模型卡可以在此处找到 here ,原始论文可以在此处找到 here

Alpaca数据集的数据卡可以在此处找到 here ,并且项目主页可以在此处找到 here 。Alpaca数据集是使用修改过的OpenAI text-davinci-003模型收集的,并且受OpenAI的服务条款约束。

模型细节

GALACTICA模型是在大规模科学语料库上进行训练的,旨在执行科学任务。 Alpaca数据集是一组5.2万个指令-响应对,旨在增强预训练语言模型的指令跟随能力。

模型用途

GALACTICA模型卡指定GALACTICA模型的主要用户是研究在科学领域应用语言模型的研究人员,并且由于模型可能产生不准确信息,它建议谨慎使用GALACTICA模型进行生产。原始GALACTICA模型在非商业CC BY-NC 4.0许可下可用,并且GALPACA模型还受到 OpenAI Terms of Service 的约束。

训练数据

GALPACA模型是通过在Alpaca数据集上对预训练的GALACTICA模型进行微调来训练的。GALACTICA模型在1060亿个开放获取的科学文本和数据上进行了训练,包括论文,教科书,科学网站,百科全书等。将基础的GALACTICA模型在Alpaca数据集中的5.2万个指令-响应对上进行微调,使用户可以以指令-响应的方式查询GALPACA模型。

如何使用

GALPACA权重可用于transformers库的使用。

点击展开
# pip install accelerate
from transformers import AutoTokenizer, OPTForCausalLM

tokenizer = AutoTokenizer.from_pretrained("GeorgiaTechResearchInstitute/galpaca-6.7b")
model = OPTForCausalLM.from_pretrained("GeorgiaTechResearchInstitute/galpaca-6.7b", device_map="auto", torch_dtype=torch.float16)

# see the original Alpaca repo for more information about the prompt templates
no_input_prompt_template = ("Below is an instruction that describes a task. "
                            "Write a response that appropriately completes the request.\n\n"
                            "### Instruction:\n{instruction}\n\n### Response:")
prompt = "Write out Maxwell's equations and explain the meaning of each one."
formatted_prompt = no_input_prompt_template.format_map({'instruction': prompt})

tokenized_prompt = tokenizer(formatted_prompt, return_tensors="pt").input_ids.to(model.device)
out_tokens = model.generate(tokenized_prompt)

print(tokenizer.batch_decode(out_tokens, skip_special_tokens=False, clean_up_tokenization_spaces=False))

培训资源

使用4个A100 80GB GPU、16位混合精度、128的有效批量大小和512个令牌的最大上下文窗口,以及全分片数据并行方式,对GALPACA 6.7B进行了大约2个小时的微调训练。

性能和限制

定性评估表明,相对于基于LLaMA的Alpaca模型,Galpaca在与技术知识和编程相关的任务上经常表现优越,而在生成散文等自然语言任务上则表现不足。有关GALACTICA系列模型的性能和限制的更多信息,请参见原始GALACTICA模型卡。

引用文献

@inproceedings{GALACTICA,
    title={GALACTICA: A Large Language Model for Science},
    author={Ross Taylor and Marcin Kardas and Guillem Cucurull and Thomas Scialom and Anthony Hartshorn and Elvis Saravia and Andrew Poulton and Viktor Kerkez and Robert Stojnic},
    year={2022}
}
@misc{alpaca,
  author = {Rohan Taori and Ishaan Gulrajani and Tianyi Zhang and Yann Dubois and Xuechen Li and Carlos Guestrin and Percy Liang and Tatsunori B. Hashimoto },
  title = {Stanford Alpaca: An Instruction-following LLaMA model},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/tatsu-lab/stanford_alpaca}},
}