Instructions to use valhalla/awesome-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use valhalla/awesome-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="valhalla/awesome-model", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("valhalla/awesome-model", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 393 Bytes
96fb117 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import torch
from transformers import PreTrainedModel
from .config import AwesomeConfig
class AwesomeModel(PreTrainedModel):
config_class = AwesomeConfig
base_model_prefix = "base"
def __init__(self, config):
super().__init__(config)
self.linear = torch.nn.Linear(config.hidden_size, config.hidden_size)
def forward(self, x):
return self.linear(x) |