Instructions to use AbdulElahGwaith/transformers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AbdulElahGwaith/transformers with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("AbdulElahGwaith/transformers", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download examples/modular-transformers/modular_switch_function.py from AbdulElahGwaith/transformers: direct link, hf CLI and curl.
- Browser
- Download file 488 Bytes
-
https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/examples/modular-transformers/modular_switch_function.py
- Command line
-
hf download hf://AbdulElahGwaith/transformers/examples/modular-transformers/modular_switch_function.py
-
curl -L -o modular_switch_function.py https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/examples/modular-transformers/modular_switch_function.py
488 Bytes
| # Note that llama and cohere have different definitions for rotate_half | |
| from transformers.models.cohere.modeling_cohere import rotate_half # noqa | |
| from transformers.models.llama.modeling_llama import LlamaAttention | |
| # When following LlamaAttention dependencies, we will grab the function `rotate_half` defined | |
| # in `modeling_llama.py`. But here we imported it explicitly from Cohere, so it should use Cohere's | |
| # definition instead | |
| class SwitchFunctionAttention(LlamaAttention): | |
| pass | |