(self, args, model=None)
| 28 | |
| 29 | class ChatModel(nn.Module, GenerationMixin): |
| 30 | def __init__(self, args, model=None): |
| 31 | super().__init__() |
| 32 | self.config = AutoConfig.from_pretrained('THUDM/chatglm2-6b', trust_remote_code=True) |
| 33 | self.generation_config = GenerationConfig.from_model_config(self.config) |
| 34 | if model is None: |
| 35 | self.model, self.args = AutoModel.from_pretrained("chatglm2-6b", args) |
| 36 | else: |
| 37 | self.model, self.args = model, args |
| 38 | self.device = self.model.parameters().__next__().device |
| 39 | self.main_input_name = 'input_ids' |
| 40 | |
| 41 | @classmethod |
| 42 | def from_pretrained(cls, name, args=None, base_cls=None, *, home_path=None, url=None, prefix='', **kwargs): |
nothing calls this directly
no test coverage detected