Skip to content

Commit 1d9f632

Browse files
justinchubyCopilot
andcommitted
fix: improve warning message and docstring for config-mode token IDs
- Warning now says 'missing, None, or not mapped' and logs raw_type (%r) so users can diagnose which value caused the fallback to 'unknown' - Update hf_model_id param docstring to describe the new config-field fallback (bos/eos/pad read from ArchitectureConfig when hf_model_id is None) instead of the old 'defaults to None' description Addresses Copilot review comments on PR #152. Co-authored-by: Copilot <[email protected]> Signed-off-by: Justin Chu <[email protected]>
1 parent 5f60a20 commit 1d9f632

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

‎src/mobius/integrations/ort_genai/auto_export.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ def write_ort_genai_config(
195195
directory: Output directory (created if needed).
196196
hf_model_id: HuggingFace model ID. When provided, used to fetch token
197197
IDs (``bos``/``eos``/``pad``) and download tokenizer files.
198-
When ``None``, token IDs default to ``None`` and tokenizer files
199-
are not copied.
198+
When ``None``, token IDs are read from ``pkg.config`` fields
199+
(``bos_token_id``, ``eos_token_id``, ``pad_token_id``) populated
200+
by :meth:`~mobius._configs.ArchitectureConfig.from_transformers`,
201+
and tokenizer files are not copied.
200202
ep: Execution provider for ``session_options`` in
201203
``genai_config.json`` (e.g. ``"cpu"``, ``"cuda"``, ``"dml"``,
202204
``"trt-rtx"``). Defaults to ``"cpu"``.
@@ -254,10 +256,11 @@ def write_ort_genai_config(
254256
ort_model_type = _resolve_ort_genai_model_type(raw_type)
255257
if ort_model_type == "unknown":
256258
logger.warning(
257-
"Could not determine ORT-GenAI model type: pkg.config has no "
258-
"'model_type' attribute. Pass hf_model_id to resolve it from "
259-
"the HuggingFace config, or the generated genai_config.json "
260-
"may not load correctly."
259+
"Could not determine ORT-GenAI model type: pkg.config.model_type "
260+
"is missing, None, or not mapped to an ORT-GenAI type (got %r). "
261+
"Pass hf_model_id to resolve it from the HuggingFace config, or "
262+
"the generated genai_config.json may not load correctly.",
263+
raw_type,
261264
)
262265
# Read token IDs from ArchitectureConfig (populated by from_transformers()
263266
# when --config is used with a local directory).

0 commit comments

Comments
 (0)