Instructions to use Dadigua12581/mymodel with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Dadigua12581/mymodel with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="Dadigua12581/mymodel", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Dadigua12581/mymodel", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download mode.py from Dadigua12581/mymodel: direct link, hf CLI and curl.
- Browser
- Download file 549 Bytes
-
https://huggingface.co/Dadigua12581/mymodel/resolve/main/mode.py
- Command line
-
hf download hf://Dadigua12581/mymodel/mode.py
-
curl -L -o mode.py https://huggingface.co/Dadigua12581/mymodel/resolve/main/mode.py
549 Bytes
| import torch | |
| from transformers import PreTrainedModel | |
| from hg.config import MConfig | |
| class MModel(PreTrainedModel): | |
| config_class = MConfig | |
| def __init__(self, config: MConfig): | |
| super().__init__(config) | |
| self.m = torch.nn.Sequential( | |
| torch.nn.Linear(1, config.hidden), | |
| torch.nn.ReLU(), | |
| torch.nn.Linear(config.hidden, 1), | |
| ) | |
| self.post_init() | |
| def forward(self, input: torch.Tensor, label: torch.Tensor): | |
| return torch.nn.functional.mse_loss(self.m(input), label) | |