ybelkada commited on
Commit
7b4fcf1
1 Parent(s): cec1694

Update README.md (#1)

Browse files

- Update README.md (78152d87a976885d8cec3ad19f0cbdbb085d6212)

Files changed (1) hide show
  1. README.md +8 -8
README.md CHANGED
@@ -74,8 +74,8 @@ Find below some example scripts on how to use the model in `transformers`:
74
 
75
  from transformers import AutoTokenizer, SwitchTransformersConditionalGeneration
76
 
77
- tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")
78
- model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-8")
79
 
80
  input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
81
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids
@@ -96,8 +96,8 @@ print(tokenizer.decode(outputs[0]))
96
  # pip install accelerate
97
  from transformers import AutoTokenizer, SwitchTransformersConditionalGeneration
98
 
99
- tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")
100
- model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto")
101
 
102
  input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
103
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)
@@ -120,8 +120,8 @@ print(tokenizer.decode(outputs[0]))
120
  # pip install accelerate
121
  from transformers import AutoTokenizer, SwitchTransformersConditionalGeneration
122
 
123
- tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")
124
- model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto", torch_dtype=torch.float16)
125
 
126
  input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
127
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)
@@ -142,8 +142,8 @@ print(tokenizer.decode(outputs[0]))
142
  # pip install bitsandbytes accelerate
143
  from transformers import AutoTokenizer, SwitchTransformersConditionalGeneration
144
 
145
- tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")
146
- model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto")
147
 
148
  input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
149
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)
 
74
 
75
  from transformers import AutoTokenizer, SwitchTransformersConditionalGeneration
76
 
77
+ tokenizer = AutoTokenizer.from_pretrained("google/switch-base-16")
78
+ model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-16")
79
 
80
  input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
81
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids
 
96
  # pip install accelerate
97
  from transformers import AutoTokenizer, SwitchTransformersConditionalGeneration
98
 
99
+ tokenizer = AutoTokenizer.from_pretrained("google/switch-base-16")
100
+ model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-16", device_map="auto")
101
 
102
  input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
103
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)
 
120
  # pip install accelerate
121
  from transformers import AutoTokenizer, SwitchTransformersConditionalGeneration
122
 
123
+ tokenizer = AutoTokenizer.from_pretrained("google/switch-base-16")
124
+ model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-16", device_map="auto", torch_dtype=torch.float16)
125
 
126
  input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
127
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)
 
142
  # pip install bitsandbytes accelerate
143
  from transformers import AutoTokenizer, SwitchTransformersConditionalGeneration
144
 
145
+ tokenizer = AutoTokenizer.from_pretrained("google/switch-base-16")
146
+ model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-16", device_map="auto")
147
 
148
  input_text = "A <extra_id_0> walks into a bar a orders a <extra_id_1> with <extra_id_2> pinch of <extra_id_3>."
149
  input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)