[bugfix] compat swift 4.0#1680
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the import paths for the swift library across various modules to align with its restructured package hierarchy, moving components to sub-packages like swift.tuners, swift.model, and swift.pipelines. In several instances, try...except ImportError blocks were added to maintain backward compatibility with older versions of ms-swift. Feedback suggests applying this same compatibility pattern to the SwiftModel import in swift_hook.py to ensure consistency and prevent breaking changes for users on older library versions.
| 'Please install swift by `pip install ms-swift` to use SwiftHook.' | ||
| ) | ||
| from swift import SwiftModel | ||
| from swift.tuners import SwiftModel |
There was a problem hiding this comment.
For consistency with the compatibility patterns used in other files (like builder.py and llm_pipeline.py), consider using a try...except ImportError block here if you intend to support older versions of ms-swift where SwiftModel might still be at the top-level swift package.
try:
from swift.tuners import SwiftModel
except ImportError:
from swift import SwiftModel
No description provided.