MCPcopy
hub / github.com/PaddlePaddle/PaddleNLP / get_default_max_decoding_length

Function get_default_max_decoding_length

llm/utils.py:681–694  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

679
680
681def 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
697def get_default_max_encoding_length(config: PretrainedConfig, default: int = 1024) -> int:

Callers 1

create_predictorFunction · 0.90

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…