Skip to content

[bugfix] compat swift 4.0#1680

Merged
Jintao-Huang merged 1 commit into
modelscope:masterfrom
Jintao-Huang:compat_swift_4
Apr 16, 2026
Merged

[bugfix] compat swift 4.0#1680
Jintao-Huang merged 1 commit into
modelscope:masterfrom
Jintao-Huang:compat_swift_4

Conversation

@Jintao-Huang
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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

@Jintao-Huang Jintao-Huang merged commit 6059df3 into modelscope:master Apr 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants