get the default max decoding length from config. Args: config (PretrainedConfig): the instance of PretrainedConfig default (int): the default value of max decoding length Returns: int: the default max_length of decoding length
(config: PretrainedConfig, default: int = 1024)
| 679 | |
| 680 | |
| 681 | def get_default_max_decoding_length(config: PretrainedConfig, default: int = 1024) -> int: |
| 682 | """get the default max decoding length from config. |
| 683 | |
| 684 | Args: |
| 685 | config (PretrainedConfig): the instance of PretrainedConfig |
| 686 | default (int): the default value of max decoding length |
| 687 | |
| 688 | Returns: |
| 689 | int: the default max_length of decoding length |
| 690 | """ |
| 691 | max_position_embeddings = get_model_max_position_embeddings(config) |
| 692 | if max_position_embeddings is None: |
| 693 | return default |
| 694 | return max_position_embeddings // 4 |
| 695 | |
| 696 | |
| 697 | def get_default_max_encoding_length(config: PretrainedConfig, default: int = 1024) -> int: |
no test coverage detected
searching dependent graphs…