Repository navigation
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The platform-specific monkeypatch lacks automated coverage for its guard and application behavior.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Documents and provides an opt-in workaround for the Windows/Python 3.14 ModernBERT loading segfault.
Changes:
- Documents affected environments and workaround options.
- Adds guarded
laya.win_patchmonkeypatch.
| File | Description |
|---|---|
README.md |
Documents the incompatibility and usage. |
laya/win_patch.py |
Applies the opt-in platform-specific workaround. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| import transformers.modeling_utils as _mu | ||
| except ImportError: | ||
| return False | ||
| _mu.PreTrainedModel.initialize_weights = lambda self: None |
|
Closing this as no longer needed, which is the outcome you anticipated in the PR itself. #195 landed in 0.3.7 and skips the weight-init pass that segfaulted, on every platform, so the opt-in Two things I want to credit, because they are why this was easy to act on. You declined to add the hard Closing as fixed upstream rather than rejected. |

Relates to #123.
On Windows 11 + Python 3.14 + torch 2.14, any ModernBERT build via transformers segfaults in PreTrainedModel.initialize_weights, so Agent(...) cannot finish loading.
This PR implements the two non-breaking suggestions from the issue (deliberately not the hard requires-python ceiling, which would block users who rely on the workaround):
Usage: import laya.win_patch before loading laya.