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

Function get_default_max_encoding_length

llm/utils.py:697–711  ·  view source on GitHub ↗

get the default max encoding length from config. Args: config (PretrainedConfig): the instance of PretrainedConfig default (int): the default value of max encoding length Returns: int: the default max_length of encoding length

(config: PretrainedConfig, default: int = 1024)

Source from the content-addressed store, hash-verified

695
696
697def get_default_max_encoding_length(config: PretrainedConfig, default: int = 1024) -> int:
698 """get the default max encoding length from config.
699
700 Args:
701 config (PretrainedConfig): the instance of PretrainedConfig
702 default (int): the default value of max encoding length
703
704 Returns:
705 int: the default max_length of encoding length
706 """
707
708 max_position_embeddings = get_model_max_position_embeddings(config)
709 if max_position_embeddings is None:
710 return default
711 return max_position_embeddings // 4 * 3
712
713
714def read_res(model_name_or_path: str, tensor_queue: mp.Queue, result_queue: mp.Queue):

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…