Instructions to use copper-light/test-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use copper-light/test-model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="copper-light/test-model", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("copper-light/test-model", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
File size: 627 Bytes
fc0237e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from transformers import PreTrainedModel, PretrainedConfig
from torch import nn
class TestConfig(PretrainedConfig):
model_type = "test-model"
def __init__(self, input_dim=4, output_dim=16, **kwargs):
self.input_dim = input_dim
self.output_dim = output_dim
super().__init__(**kwargs)
class TestModel(PreTrainedModel):
config_class = TestConfig
def __init__(self, config):
super().__init__(config)
self.layer = nn.Linear(config.input_dim, config.output_dim)
def forward(self, input):
return self.layer(input)
|