Refactor OmniProcessor and update parsing logic

- Removed redundant imports of `torch` and `numpy` in `OmniProcessor` class.
- Improved comments in `parse_singleton_prompt_omni` function for clarity on token handling.
- Ensured `current_platform` is imported only once for better code organization.
This commit is contained in:
tzhouam committed 2025-10-24 11:27:30 +08:00
1 parent 3a27ff51d0
commit 4cd3b36fa0
2 files changed
+4 -7

No files matched your search

+1 -1
View File
@@ -8,7 +8,7 @@ def parse_singleton_prompt_omni(prompt: SingletonPrompt) -> ParsedSingletonPromp
elif isinstance(prompt, dict):
# Type ignores are because mypy does not correctly infer the TypedDicts
# Pyright does succeed.
# 优先 tokens:当 tokens 与 embeds 同在时,保留两者并走 tokens 路径
# Priority tokens: When both tokens and embeds exist, keep both and follow the tokens path
if "prompt_token_ids" in prompt:
return ParsedTokensPrompt(
type="tokens", content=prompt) # type: ignore[typeddict-item]