dolly README

The project's README from github.com/databrickslabs/dolly. As one markdown file: README.md.

Dolly

Databricks’ Dolly is an instruction-following large language model trained on the Databricks machine learning platform that is licensed for commercial use. Based on pythia-12b, Dolly is trained on ~15k instruction/response fine tuning records databricks-dolly-15k generated by Databricks employees in capability domains from the InstructGPT paper, including brainstorming, classification, closed QA, generation, information extraction, open QA and summarization. dolly-v2-12b is not a state-of-the-art model, but does exhibit surprisingly high quality instruction following behavior not characteristic of the foundation model on which it is based.

Databricks is committed to ensuring that every organization and individual benefits from the transformative power of artificial intelligence. The Dolly model family represents our first steps along this journey, and we’re excited to share this technology with the world.

The model is available on Hugging Face as databricks/dolly-v2-12b.

Model Overview

dolly-v2-12b is a 12 billion parameter causal language model created by Databricks that is derived from EleutherAI’s Pythia-12b and fine-tuned on a ~15K record instruction corpus generated by Databricks employees and released under a permissive license (CC-BY-SA)

Known Limitations

Performance Limitations

dolly-v2-12b is not a state-of-the-art generative language model and, though quantitative benchmarking is ongoing, is not designed to perform competitively with more modern model architectures or models subject to larger pretraining corpuses.

The Dolly model family is under active development, and so any list of shortcomings is unlikely to be exhaustive, but we include known limitations and misfires here as a means to document and share our preliminary findings with the community. In particular, dolly-v2-12b struggles with: syntactically complex prompts, programming problems, mathematical operations, factual errors, dates and times, open-ended question answering, hallucination, enumerating lists of specific length, stylistic mimicry, having a sense of humor, etc. Moreover, we find that dolly-v2-12b does not have some capabilities, such as well-formatted letter writing, present in the original model.

Dataset Limitations

Like all language models, dolly-v2-12b reflects the content and limitations of its training corpuses.

Databricks is committed to ongoing research and development efforts to develop helpful, honest and harmless AI technologies that maximize the potential of all individuals and organizations.

Getting Started with Response Generation

If you'd like to simply test the model without training, the model is available on Hugging Face as databricks/dolly-v2-12b.

To use the model with the transformers library on a machine with A100 GPUs:

from transformers import pipeline
import torch

instruct_pipeline = pipeline(model="databricks/dolly-v2-12b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")

You can then use the pipeline to answer instructions:

instruct_pipeline("Explain to me the difference between nuclear fission and fusion.")

Generating on Other Instances

A100 instance types are not available in all cloud regions, or can be hard to provision. Inference is possible on other GPU instance types.

A10 GPUs

The 6.9B and 2.8B param models should work as-is.

To generate using the 12B param model on A10s (ex: g5.4xlarge, 1 x A10 24GB), it's necessary to load and run generating using 8-bit weights, which impacts the results slightly:

V100 GPUs

When using V100s (ex: p3.2xlarge, 1 x V100 16GB, NC6s_v3), in all cases, set torch_dtype=torch.float16 in pipeline() instead.

Otherwise, follow the steps above. The 12B param model may not function well in 8-bit on V100s.

Getting Started with Training

Training on Other Instances

A100 instance types are not available in all cloud regions, or can be hard to provision. Training is possible on other GPU instance types, for smaller Dolly model sizes, and with small modifications to reduce memory usage. These modifications are not optimal, but are simple to make.

Select your GPU family type from the gpu_family widget, enter the number of GPUs available in the num_gpus widget, and then run the rest of the code. A number of different options will be set for you to train the model for one of the following GPU types:

Details of the different configurations are below.

A100 GPUs

A100 GPUs are preferred for training all model sizes, and are the only GPUs that can train the 12B param model in a reasonable amount of time. As such, this is the default configuration, as set in the a100_config.json deepspeed config file.

A10 GPUs

Training the 12B param model is not recommended on A10s.

To train the 6.9B param model on A10 instances (ex: g5.24xlarge, 4 x A10 24GB; Standard_NV72ads_A10_v5, 2 x A10), simply select a10 from the gpu_family widget and enter the number of GPUs available in the num_gpus widget, then run the rest of the code. This will use the a10_config.json deepspeed config file, which makes the following changes:

V100 GPUs

To run on V100 instances with 32GB of GPU memory (ex: p3dn.24xlarge or Standard_ND40rs_v2), simply select v100 from the gpu_family widget and enter the number of GPUs available in the num_gpus widget, and then run the rest of the code. This will use the v100_config.json deepspeed config file, which makes the following changes:

You may be able to slightly increase the batch size with 32GB instances, compared to what works above for 24GB A10s.

Running Unit Tests Locally

pyenv local 3.8.13
python -m venv .venv
. .venv/bin/activate
pip install -r requirements_dev.txt
./run_pytest.sh

Citation

@online{DatabricksBlog2023DollyV2,
    author    = {Mike Conover and Matt Hayes and Ankit Mathur and Jianwei Xie and Jun Wan and Sam Shah and Ali Ghodsi and Patrick Wendell and Matei Zaharia and Reynold Xin},
    title     = {Free Dolly: Introducing the World's First Truly Open Instruction-Tuned LLM},
    year      = {2023},
    url       = {https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm},
    urldate   = {2023-06-30}
}

dolly (databrickslabs/dolly)

Searching Database…

10.8K ·GitHub
这是什么?Dolly 是 Databricks 的指令跟随型大语言模型,在 Databricks 机器学习平台上训练,并授权可商用;旗舰模型 dolly-v2-12b 基于 EleutherAI 的 Pythia-12b 开发。
这是可以直接下载的成品模型,还是用来训练模型的代码?两者都有:Hugging Face 上有 12B、6.9B 和 2.8B 参数规模的现成模型,而这个仓库里包含训练 notebook 和 databricks-dolly-15k 数据集。
不训练的话,我该怎么试用它?从 Hugging Face 拉取模型,然后在有 GPU 的机器上通过 transformers 的 pipeline 运行——README 里的快速入门就是这么做的,完全不需要训练。
那它有哪些不足?不少:README 列出它在语法复杂的提示、编程问题、数学、日期和时间、开放式问答方面表现吃力,还会产生幻觉,甚至缺乏幽默感。
训练数据有多干净?并不干净:底层的 GPT-J 语料库(The Pile)包含大量不良网络内容,模型可能会反映出这些内容;15k 数据集里也可能有错别字、事实错误和维基百科的偏见。
我可以商用吗?可以——README 说明 Dolly 授权可商用(GitHub 上为 Apache-2.0),微调语料本身则以宽松的 CC-BY-SA 许可发布。
运行它需要什么 GPU?12B 模型可以直接在 A100 GPU 上运行。在 24GB 的 A10 上必须以 8 位加载权重(安装 bitsandbytes,设置 load_in_8bit=True);在 V100 上则应改用 torch_dtype=torch.float16。
Databricks 为什么要开发并开源 Dolly?公司将其定位为确保每个组织和个人都能从 AI 中受益的一步,Dolly 系列被称为他们在这条路上迈出的第一步,与全世界分享。
dolly-v2-12b 和更新的聊天模型一样好吗?不好。README 明确指出它不是最先进的生成式模型,设计初衷就不是为了与更现代的架构或拥有更大预训练语料库的模型竞争。
微调会让基础模型损失一些能力吗?会——README 提到 dolly-v2-12b 缺少原模型的一些能力,比如格式规范的写信。
Size
0.1 MB
Stars
10.8K
Updated
CommitJun 30
Age
3y
Commits · 90 Days