Remove need for explicit \n in docstring lists for --help formatting (#38350)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parent
98e7f223b9
commit
21d2b53f88
+41
-35
@@ -125,26 +125,28 @@ class ModelConfig:
|
||||
"""Name or path of the Hugging Face tokenizer to use. If unspecified, model
|
||||
name or path will be used."""
|
||||
tokenizer_mode: TokenizerMode | str = "auto"
|
||||
"""Tokenizer mode:\n
|
||||
"""Tokenizer mode:
|
||||
|
||||
- "auto" will use the tokenizer from `mistral_common` for Mistral models
|
||||
if available, otherwise it will use the "hf" tokenizer.\n
|
||||
- "hf" will use the fast tokenizer if available.\n
|
||||
- "slow" will always use the slow tokenizer.\n
|
||||
- "mistral" will always use the tokenizer from `mistral_common`.\n
|
||||
- "deepseek_v32" will always use the tokenizer from `deepseek_v32`.\n
|
||||
- "qwen_vl" will always use the tokenizer from `qwen_vl`.\n
|
||||
if available, otherwise it will use the "hf" tokenizer.
|
||||
- "hf" will use the fast tokenizer if available.
|
||||
- "slow" will always use the slow tokenizer.
|
||||
- "mistral" will always use the tokenizer from `mistral_common`.
|
||||
- "deepseek_v32" will always use the tokenizer from `deepseek_v32`.
|
||||
- "qwen_vl" will always use the tokenizer from `qwen_vl`.
|
||||
- Other custom values can be supported via plugins."""
|
||||
trust_remote_code: bool = False
|
||||
"""Trust remote code (e.g., from HuggingFace) when downloading the model
|
||||
and tokenizer."""
|
||||
dtype: ModelDType | torch.dtype = "auto"
|
||||
"""Data type for model weights and activations:\n
|
||||
"""Data type for model weights and activations:
|
||||
|
||||
- "auto" will use FP16 precision for FP32 and FP16 models, and BF16
|
||||
precision for BF16 models.\n
|
||||
- "half" for FP16. Recommended for AWQ quantization.\n
|
||||
- "float16" is the same as "half".\n
|
||||
- "bfloat16" for a balance between precision and range.\n
|
||||
- "float" is shorthand for FP32 precision.\n
|
||||
precision for BF16 models.
|
||||
- "half" for FP16. Recommended for AWQ quantization.
|
||||
- "float16" is the same as "half".
|
||||
- "bfloat16" for a balance between precision and range.
|
||||
- "float" is shorthand for FP32 precision.
|
||||
- "float32" for FP32 precision."""
|
||||
seed: int = 0
|
||||
"""Random seed for reproducibility.
|
||||
@@ -182,13 +184,14 @@ class ModelConfig:
|
||||
automatically derived from the model config.
|
||||
|
||||
When passing via `--max-model-len`, supports k/m/g/K/M/G in human-readable
|
||||
format. Examples:\n
|
||||
- 1k -> 1000\n
|
||||
- 1K -> 1024\n
|
||||
- 25.6k -> 25,600\n
|
||||
format. Examples:
|
||||
|
||||
- 1k -> 1000
|
||||
- 1K -> 1024
|
||||
- 25.6k -> 25,600
|
||||
- -1 or 'auto' -> Automatically choose the maximum model length that fits in
|
||||
GPU memory. This will use the model's maximum context length if it fits,
|
||||
otherwise it will find the largest length that can be accommodated."""
|
||||
GPU memory. This will use the model's maximum context length if it fits,
|
||||
otherwise it will find the largest length that can be accommodated."""
|
||||
spec_target_max_model_len: int | None = None
|
||||
"""Specify the maximum length for spec decoding draft models."""
|
||||
quantization: QuantizationMethods | str | None = None
|
||||
@@ -248,10 +251,11 @@ class ModelConfig:
|
||||
prometheus metrics, if multiple names provided, metrics tag will take the
|
||||
first one."""
|
||||
config_format: str | ConfigFormat = "auto"
|
||||
"""The format of the model config to load:\n
|
||||
"""The format of the model config to load:
|
||||
|
||||
- "auto" will try to load the config in hf format if available after trying
|
||||
to load in mistral format.\n
|
||||
- "hf" will load the config in hf format.\n
|
||||
to load in mistral format.
|
||||
- "hf" will load the config in hf format.
|
||||
- "mistral" will load the config in mistral format."""
|
||||
hf_token: bool | str | None = None
|
||||
"""The token to use as HTTP bearer authorization for remote files . If
|
||||
@@ -276,12 +280,12 @@ class ModelConfig:
|
||||
"""Enable sleep mode for the engine (only cuda and
|
||||
hip platforms are supported)."""
|
||||
model_impl: str | ModelImpl = "auto"
|
||||
"""Which implementation of the model to use:\n
|
||||
- "auto" will try to use the vLLM implementation, if it exists, and fall
|
||||
back to the Transformers implementation if no vLLM implementation is
|
||||
available.\n
|
||||
- "vllm" will use the vLLM model implementation.\n
|
||||
- "transformers" will use the Transformers model implementation.\n
|
||||
"""Which implementation of the model to use:
|
||||
|
||||
- "auto" will try to use the vLLM implementation, if it exists, and fall back to the
|
||||
Transformers implementation if no vLLM implementation is available.
|
||||
- "vllm" will use the vLLM model implementation.
|
||||
- "transformers" will use the Transformers model implementation.
|
||||
- "terratorch" will use the TerraTorch model implementation.
|
||||
"""
|
||||
override_attention_dtype: str | None = None
|
||||
@@ -1512,10 +1516,11 @@ class ModelConfig:
|
||||
@property
|
||||
def score_type(self) -> ScoreType:
|
||||
"""
|
||||
Scoring API handles score/rerank for:\n
|
||||
- "classify" task (score_type: cross-encoder models)\n
|
||||
- "embed" task (score_type: bi-encoder models)\n
|
||||
- "token_embed" task (score_type: late interaction models)\n
|
||||
Scoring API handles score/rerank for:
|
||||
|
||||
- "classify" task (score_type: cross-encoder models)
|
||||
- "embed" task (score_type: bi-encoder models)
|
||||
- "token_embed" task (score_type: late interaction models)
|
||||
"""
|
||||
# fixme: self._model_info.score_type is the score type before
|
||||
# as_seq_cls_model, which is "bi-encoder", rather than the
|
||||
@@ -1593,9 +1598,10 @@ class ModelConfig:
|
||||
such as the lm_head in a generation model,
|
||||
or the score or classifier in a classification model.
|
||||
|
||||
`head_dtype` currently only supports pooling models.\n
|
||||
- The pooling model defaults to using fp32 head,
|
||||
you can use --hf-overrides '{"head_dtype": "model"}' to disable it.
|
||||
`head_dtype` currently only supports pooling models.
|
||||
|
||||
- The pooling model defaults to using fp32 head, you can use
|
||||
--hf-overrides '{"head_dtype": "model"}' to disable it.
|
||||
"""
|
||||
|
||||
head_dtype = _get_head_dtype(
|
||||
|
||||
Reference in New Issue
Block a user