File size: 556 Bytes
4c19b30 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from transformers import PreTrainedModel
from .configuration_test import TestConfig
import torch.nn as nn
from transformers import AutoModelForMaskedLM
class TestModel(PreTrainedModel):
config_class = TestConfig
def __init__(self, config: TestConfig):
super().__init__(config)
self.model1 = nn.Linear(config.input_dim, config.output_dim)
self.model2 = AutoModelForMaskedLM.from_pretrained("bert-base-uncased")
self.model3 = None
def forward(self, tensor):
return self.model1(tensor)
|