(self)
| 124 | |
| 125 | @property |
| 126 | def max_length(self): |
| 127 | if self._max_length: # if max length manually set, return it |
| 128 | return self._max_length |
| 129 | seqlen_config_attrs = ("n_positions", "max_position_embeddings", "n_ctx") |
| 130 | for attr in seqlen_config_attrs: |
| 131 | if hasattr(self.model.config, attr): |
| 132 | return getattr(self.model.config, attr) |
| 133 | if hasattr(self.tokenizer, "model_max_length"): |
| 134 | if self.tokenizer.model_max_length == 1000000000000000019884624838656: |
| 135 | return self._DEFAULT_MAX_LENGTH |
| 136 | return self.tokenizer.model_max_length |
| 137 | return self._DEFAULT_MAX_LENGTH |
| 138 | |
| 139 | |
| 140 | @property |
nothing calls this directly
no outgoing calls
no test coverage detected