mirror of
https://github.com/huggingface/transformers.git
synced 2026-10-28 16:54:55 +08:00
* everything untilo informer * everything until perceiver * all of them finally * style * replace by transformers init everywhere * use relative import instead * deprecated models * style * start contexts * small fixes * fix modular * remove class switch * do not initialize tied weights * typo * fix * improve * improve comments * improve * improve * fix zamba * fix import * add the post_init * more post_init * fix * protect * more post_init * fix * fixes * fix * fix * switch flag name * more fixes * fixes * fixes * copies * fix * finally find the culprit * style * last small * big bird * better * update init check * final touch * do it everywhere
21 lines
450 B
Python
21 lines
450 B
Python
import torch
|
|
|
|
from transformers import PreTrainedModel
|
|
|
|
from .custom_configuration import CustomConfig
|
|
|
|
|
|
class CustomModel(PreTrainedModel):
|
|
config_class = CustomConfig
|
|
|
|
def __init__(self, config):
|
|
super().__init__(config)
|
|
self.linear = torch.nn.Linear(config.hidden_size, config.hidden_size)
|
|
self.post_init()
|
|
|
|
def forward(self, x):
|
|
return self.linear(x)
|
|
|
|
def _init_weights(self, module):
|
|
pass
|