Views
No views yet
pip install hf-hub-ctranslate2>=2.12.0 ctranslate2>=3.16.01# from transformers import AutoTokenizer
2model_name = "michaelfeil/ct2fast-mpt-30b-chat"
3
4
5from hf_hub_ctranslate2 import GeneratorCT2fromHfHub
6model = GeneratorCT2fromHfHub(
7 # load in int8 on CUDA
8 model_name_or_path=model_name,
9 device="cuda",
10 compute_type="int8_float16",
11 # tokenizer=AutoTokenizer.from_pretrained("{ORG}/{NAME}")
12)
13outputs = model.generate(
14 text=["def fibonnaci(", "User: How are you doing? Bot:"],
15 max_length=64,
16 include_prompt_in_result=False
17)
18print(outputs)compute_type=int8_float16 for device="cuda"compute_type=int8 for device="cpu"ct2-transformers-converter --model mosaicml/mpt-30b-chat --output_dir ~/tmp-ct2fast-mpt-30b-chat --force --copy_files tokenizer.json README.md tokenizer_config.json generation_config.json special_tokens_map.json .gitattributes --quantization int8_float16 --trust_remote_codeI want you to come up with a tweet based on this summary of the article:We are excited to extend the MosaicML Foundation Series with MPT-30B, a new commercially licensed open-source model that is significantly more powerful, and outperforms the original GPT-3. In addition, we are releasing two fine-tuned models, MPT-30B-Instruct and MPT-30B-Chat, that are built on top of MPT-30B and excel at short-form instruction following and multi-turn conversations, respectively. All MPT-30B models come with special features that differentiate them from other LLMs, including an 8k token context window (which can be further extended via finetuning; see MPT-7B-StoryWriter), support for context-length extrapolation via ALiBi, and efficient inference + training performance via FlashAttention. It also has strong coding abilities thanks to its pretraining data mixture.
"Revolutionize your AI capabilities with MosaicML's latest addition, MPT-30B! Outperforming GPT-3, this open-source model is significantly more powerful and comes with finely-tuned models for exceptional instruction following and multi-turn conversations. Unleash the potential of an 8k token context window, ALiBi support, and FlashAttention. Experience the future of AI with MosaicML! #AI #ML #innovation"
Is there anything you want to say to MosaicML about this exciting news?
As your AI marketing assistant, I would say that this is truly exciting news for the AI community! MosaicML's latest addition, MPT-30B, is poised to revolutionize the industry with its powerful open-source capabilities and finely-tuned models for instruction following and multi-turn conversations. The special features, including the 8k token context window, ALiBi support, and FlashAttention, are sure to set MosaicML's MPT-30B apart from other LLMs. Congratulations to the MosaicML team on this incredible achievement!
1import transformers
2model = transformers.AutoModelForCausalLM.from_pretrained(
3 'mosaicml/mpt-30b-chat',
4 trust_remote_code=True
5)trust_remote_code=True be passed to the from_pretrained method.
This is because we use a custom MPT model architecture that is not yet part of the Hugging Face transformers package.
MPT includes options for many training efficiency features such as FlashAttention, ALiBi, QK LayerNorm, and more.cuda:0) with attn_impl='triton' and with bfloat16 precision:1import torch
2import transformers
3
4name = 'mosaicml/mpt-30b-chat'
5
6config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
7config.attn_config['attn_impl'] = 'triton' # change this to use triton-based FlashAttention
8config.init_device = 'cuda:0' # For fast initialization directly on GPU!
9
10model = transformers.AutoModelForCausalLM.from_pretrained(
11 name,
12 config=config,
13 torch_dtype=torch.bfloat16, # Load model weights in bfloat16
14 trust_remote_code=True
15)1import transformers
2
3name = 'mosaicml/mpt-30b-chat'
4
5config = transformers.AutoConfig.from_pretrained(name, trust_remote_code=True)
6config.max_seq_len = 16384 # (input + output) tokens can now be up to 16384
7
8model = transformers.AutoModelForCausalLM.from_pretrained(
9 name,
10 config=config,
11 trust_remote_code=True
12)1from transformers import AutoTokenizer
2tokenizer = AutoTokenizer.from_pretrained('mosaicml/mpt-30b')1from transformers import pipeline
2
3with torch.autocast('cuda', dtype=torch.bfloat16):
4 inputs = tokenizer('Here is a recipe for vegan banana bread:\n', return_tensors="pt").to('cuda')
5 outputs = model.generate(**inputs, max_new_tokens=100)
6 print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
7
8# or using the HF pipeline
9pipe = pipeline('text-generation', model=model, tokenizer=tokenizer, device='cuda:0')
10with torch.autocast('cuda', dtype=torch.bfloat16):
11 print(
12 pipe('Here is a recipe for vegan banana bread:\n',
13 max_new_tokens=100,
14 do_sample=True,
15 use_cache=True))| Hyperparameter | Value |
|---|---|
| n_parameters | 29.95B |
| n_layers | 48 |
| n_heads | 64 |
| d_model | 7168 |
| vocab size | 50432 |
| sequence length | 8192 |
| Data Source | Number of Tokens in Source | Proportion |
|---|---|---|
| Airoboros/GPT4 | 26.4M | 1.71% |
| Baize | 55.0M | 3.57% |
| Camel | 301M | 19.54% |
| GPTeacher | 7.56M | 0.49% |
| Guanaco | 15.6M | 1.02% |
| LongCoversations | 18.4M | 1.19% |
| ShareGPT | 821M | 53.24% |
| WizardLM | 297M | 19.23% |
@online{MosaicML2023Introducing,
author = {MosaicML NLP Team},
title = {Introducing MPT-30B: Raising the bar
for open-source foundation models},
year = {2023},
url = {www.mosaicml.com/blog/mpt-30b},
note = {Accessed: 2023-06-22},
urldate = {2023-06-22}
}