Views
No views yet
I need to convince my friend, Phyllis, that she should train a custom LLM for her Fortune 500 company using the MosaicML Platform. Please write an email that explains why MosaicML's emphasis on cutting edge methodology, data privacy, and efficiency are so important. End the email with a friendly inquiry about Phyllis's family.
Phyllis - I know you're always looking for ways to improve efficiency at work and I think I've found a solution that you'll be very interested in. LLMs are only as good as the data they're trained on and the training process can be very time consuming and resource intensive. MosaicML uses cutting edge methodology to efficiently train high quality models without compromising data privacy. They also provide tools to easily connect to and use the model in your daily workflow. I think you'd really enjoy speaking with their founder, we can set up a call if you're interested. Also, I know it's been a tough year for your family, how are things?
Best, Your Friend
trust_remote_code=True be passed to the from_pretrained method. This is because we use a custom model architecture that is not yet part of the transformers package.1import transformers
2model = transformers.AutoModelForCausalLM.from_pretrained(
3 'mosaicml/mpt-30b-instruct',
4 trust_remote_code=True
5)cuda:0) with attn_impl='triton' and with bfloat16 precision:1import torch
2import transformers
3
4name = 'mosaicml/mpt-30b-instruct'
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-instruct'
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))1def format_prompt(instruction):
2 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\n"
3 return template.format(instruction=instruction)
4
5example = "Tell me a funny joke.\nDon't make it too funny though."
6fmt_ex = format_prompt(instruction=example)fmt_ex is ready to be tokenized and sent through the model.| 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 |
|---|---|---|
| competition_math | 1.6 M | 3.01% |
| cot_gsm8k | 3.36 M | 6.32% |
| dialogsum | 0.1 M | 0.19% |
| dolly_hhrlhf | 5.89 M | 11.07% |
| duorc | 8.2 M | 15.51% |
| qasper | 10.97 M | 20.63% |
| quality | 11.31 M | 21.28% |
| scrolls/summ_screen_fd | 11.56 M | 21.82% |
| spider | 0.089 M | 0.16% |
@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}
}