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_add_function.py from AbdulElahGwaith/transformers: direct link, hf CLI and curl.
- Browser
- Download file 704 Bytes
-
https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/examples/modular-transformers/modular_add_function.py
- Command line
-
hf download hf://AbdulElahGwaith/transformers/examples/modular-transformers/modular_add_function.py
-
curl -L -o modular_add_function.py https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/examples/modular-transformers/modular_add_function.py
704 Bytes
| # Note that zamba does not have the `apply_rotary_pos_emb` function! | |
| from transformers.models.llama.modeling_llama import apply_rotary_pos_emb | |
| from transformers.models.zamba.modeling_zamba import ZambaAttention | |
| # When following ZambaAttention dependencies, the function `apply_rotary_pos_emb` is not present | |
| # by default as it is absent from the class definition (and the file altogether). | |
| # Note that this syntax should be able to add both `apply_rotary_pos_emb` as imported directly, but | |
| # `rotate_half` as well as a dependency from the imported function!! | |
| class TestAttention(ZambaAttention): | |
| def __init__(self): | |
| pass | |
| def forward(self): | |
| _ = apply_rotary_pos_emb(1, 1, 1, 1) | |