(self, trust_remote_code: bool = False)
| 69 | stop_words: list[str] | None = None |
| 70 | |
| 71 | def chat_template(self, trust_remote_code: bool = False): |
| 72 | attrs = {key: value for key, value in dataclasses.asdict(self).items() if value is not None} |
| 73 | attrs.pop('model_name', None) |
| 74 | if self.model_name in MODELS.module_dict.keys(): |
| 75 | model = MODELS.get(self.model_name)(**attrs, trust_remote_code=trust_remote_code) |
| 76 | else: |
| 77 | logger.warning(f'Could not find {self.model_name} in registered models. ' |
| 78 | f'Register {self.model_name} using the BaseChatTemplate.') |
| 79 | model = BaseChatTemplate(**attrs, trust_remote_code=trust_remote_code) |
| 80 | return model |
| 81 | |
| 82 | def to_json(self, file_path=None): |
| 83 | """Convert the dataclass instance to a JSON formatted string and |
no test coverage detected