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
| 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) | |