Run this model with HF Jobs
Run google/switch-base-8 on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/google/switch-base-8. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/google/switch-base-8 on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use google/switch-base-8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/switch-base-8 with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("google/switch-base-8") model = AutoModelForSeq2SeqLM.from_pretrained("google/switch-base-8", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Add correct class
Browse files70 unmodified lines7172737475767778798012 unmodified lines9394959697989910010110214 unmodified lines11711811912012112212312412512612 unmodified lines13914014114214314414514614714870 unmodified lines```pythonfrom transformers import AutoTokenizer, SwitchTransformersConditionalGenerationtokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-8")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>."input_ids = tokenizer(input_text, return_tensors="pt").input_ids12 unmodified lines```python# pip install acceleratefrom transformers import AutoTokenizer, SwitchTransformersConditionalGenerationtokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto")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>."input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)14 unmodified lines```python# pip install acceleratefrom transformers import AutoTokenizer, SwitchTransformersConditionalGenerationtokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto", torch_dtype=torch.float16)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>."input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)12 unmodified lines```python# pip install bitsandbytes acceleratefrom transformers import AutoTokenizer, SwitchTransformersConditionalGenerationtokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")model = SwitchTransformersConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto")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>."input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)70 unmodified lines7172737475767778798012 unmodified lines9394959697989910010110214 unmodified lines11711811912012112212312412512612 unmodified lines13914014114214314414514614714870 unmodified lines```pythonfrom transformers import AutoTokenizer, SwitchTransformersForConditionalGenerationtokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")model = SwitchTransformersForConditionalGeneration.from_pretrained("google/switch-base-8")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>."input_ids = tokenizer(input_text, return_tensors="pt").input_ids12 unmodified lines```python# pip install acceleratefrom transformers import AutoTokenizer, SwitchTransformersForConditionalGenerationtokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")model = SwitchTransformersForConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto")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>."input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)14 unmodified lines```python# pip install acceleratefrom transformers import AutoTokenizer, SwitchTransformersForConditionalGenerationtokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")model = SwitchTransformersForConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto", torch_dtype=torch.float16)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>."input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)12 unmodified lines```python# pip install bitsandbytes acceleratefrom transformers import AutoTokenizer, SwitchTransformersForConditionalGenerationtokenizer = AutoTokenizer.from_pretrained("google/switch-base-8")model = SwitchTransformersForConditionalGeneration.from_pretrained("google/switch-base-8", device_map="auto")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>."input_ids = tokenizer(input_text, return_tensors="pt").input_ids.to(0)
README.md+8-8