(self)
| 35 | |
| 36 | @property |
| 37 | def max_length(self): |
| 38 | if self._max_length != -1: |
| 39 | return self._max_length |
| 40 | if hasattr(self.model.config, 'n_ctx'): |
| 41 | return self.model.config.n_ctx |
| 42 | elif hasattr(self.model.config, 'max_position_embeddings'): |
| 43 | return self.model.config.max_position_embeddings |
| 44 | elif hasattr(self.model.config, 'n_positions'): |
| 45 | return self.model.config.n_positions |
| 46 | elif 'bloom' in self.model_name: |
| 47 | return 2048 |
| 48 | elif 'llama' in self.model_name: |
| 49 | return 2048 # TODO: did not check this |
| 50 | elif 'mpt' in self.model_name: |
| 51 | return 2048 |
| 52 | elif 'falcon' in self.model_name: |
| 53 | return 2048 |
| 54 | else: |
| 55 | print(self.model.config) |
| 56 | raise NotImplementedError |
| 57 | |
| 58 | @property |
| 59 | def max_gen_toks(self): |
nothing calls this directly
no outgoing calls
no test coverage detected