pszemraj commited on
Commit
c53c970
1 Parent(s): b51ddaf

add details on usage

Browse files
Files changed (1) hide show
  1. README.md +31 -1
README.md CHANGED
@@ -19,6 +19,36 @@ This is a version of the [mpt-7b-storywriter](https://huggingface.co/mosaicml/mp
19
 
20
  Please refer to the previously linked repo for details on usage/implementation/etc. This model was downloaded from the original repo under Apache-2.0 and is redistributed under the same license.
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  ---
23
 
24
- > More details/usage to be added later
 
19
 
20
  Please refer to the previously linked repo for details on usage/implementation/etc. This model was downloaded from the original repo under Apache-2.0 and is redistributed under the same license.
21
 
22
+
23
+ ## Basic Usage
24
+
25
+ Install/upgrade packages:
26
+
27
+ ```bash
28
+ pip install -U torch transformers accelerate
29
+ ```
30
+
31
+ Load the model:
32
+
33
+ ```python
34
+ import torch
35
+ from transformers import AutoModelForCausalLM, AutoTokenizer
36
+
37
+ model_name = 'ethzanalytics/mpt-7b-storywriter-sharded'
38
+ model = AutoModelForCausalLM.from_pretrained(
39
+ model_name,
40
+ torch_dtype=torch.bfloat16,
41
+ trust_remote_code=True,
42
+ revision='b51ddaf1a256420debfb44fd7367ed7b291b7c19', # optional, but a good idea
43
+ device_map='auto',
44
+ load_in_8bit=False, # install bitsandbytes then set to true for 8-bit
45
+ )
46
+ model = torch.compile(model)
47
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
48
+ ```
49
+
50
+ Then you can use `model.generate()` as you would normally - see the notebook for details.
51
+
52
+
53
  ---
54