refactor: improve environment and dependency compatibility#963
Open
Jingyuan-zhu wants to merge 2 commits intoOptimalScale:mainfrom
Open
refactor: improve environment and dependency compatibility#963Jingyuan-zhu wants to merge 2 commits intoOptimalScale:mainfrom
Jingyuan-zhu wants to merge 2 commits intoOptimalScale:mainfrom
Conversation
- Restore Python 3.9 support by replacing PEP 604 union types with typing.Union - Decouple sglang dependency via lazy loading in AutoPipeline - Fix ImportError by handling the removal of telemetry API in transformers >=4.41
…lity - Restore Python 3.9 support by replacing PEP 604 union types with typing.Union. - Decouple sglang dependency via lazy loading in AutoPipeline. - Fix transformers telemetry API compatibility (>=4.41). - Replace pkg_resources with importlib.metadata in version checks. - Improve conversation template robustness: - add tokenizer/hf_auto modes - strict tokenizer mode with clear error - hf_auto fallback path - safer assistant mask handling for chat-template tokenization - handle missing block_size safely in tokenization flow. - Add dependency constraints to reduce datasets/pyarrow and transformers drift."
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR addresses several dependency drift issues that currently prevent LMFlow from running in Python 3.10+ and older stable environments (Python 3.9) and improved conversation template for modern chat models.
Changes
|) withtyping.Unionand updated generic aliases inprotocol.pyandversioning.py. This restores support for Python 3.9.sglang_inferencerinauto_pipeline.pyto make new user easily run a simple fine-tuning happy pathtransformers.utils.send_example_telemetryin atry-exceptblock to handle its removal intransformers >= 4.41.0.versioning.py.pkg_resourcestoimportlib.metadata+packaging.versioninversioning.py. This removes repeated startup deprecation warningsconversation_template=tokenizerwhich requirestokenizer.chat_templateandconversation_template=hf_autowhich uses tokenizer template if available, otherwise falls back to LMFlow default template. If no template is specified, the system now prefers the tokenizer-native template when available to ensure perfect formatting for modern models