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 utils/test_module/custom_modeling.py from AbdulElahGwaith/transformers: direct link, hf CLI and curl.
- Browser
- Download file 450 Bytes
-
https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/utils/test_module/custom_modeling.py
- Command line
-
hf download hf://AbdulElahGwaith/transformers/utils/test_module/custom_modeling.py
-
curl -L -o custom_modeling.py https://huggingface.co/AbdulElahGwaith/transformers/resolve/main/utils/test_module/custom_modeling.py
450 Bytes
| import torch | |
| from transformers import PreTrainedModel | |
| from .custom_configuration import CustomConfig | |
| class CustomModel(PreTrainedModel): | |
| config_class = CustomConfig | |
| def __init__(self, config): | |
| super().__init__(config) | |
| self.linear = torch.nn.Linear(config.hidden_size, config.hidden_size) | |
| self.post_init() | |
| def forward(self, x): | |
| return self.linear(x) | |
| def _init_weights(self, module): | |
| pass | |