Fix missing ParameterModule export in GPT-OSS compiler path#519
Fix missing ParameterModule export in GPT-OSS compiler path#519danielhanchen wants to merge 7 commits intomainfrom
Conversation
Summary of ChangesHello @danielhanchen, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses and resolves Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a compiler failure for GPT-OSS models by exporting necessary symbols like ParameterModule into the transformers.models.gpt_oss.modeling_gpt_oss namespace. The implementation is straightforward and adds a new patch function patch_gpt_oss_compiler_exports to handle this. My only feedback is a minor code cleanup suggestion to improve readability.
| m.dtype_from_config = dtype_from_config | ||
| m.transformers_version = transformers_version | ||
| m.Version = Version | ||
| pass |
|
|
||
|
|
||
| def patch_gpt_oss_compiler_exports(): | ||
| model_name = os.environ.get("UNSLOTH_MODEL_NAME", "").replace("-", "_") |
There was a problem hiding this comment.
Ideally, if our temporary_patches creates and references a class, compiler.py should automatically handle copying it over. But for now this is fine.
|
|
||
| # Export helpers so compiler generated GPT-OSS modules can resolve symbols. | ||
| m = transformers.models.gpt_oss.modeling_gpt_oss | ||
| m.ParameterModule = ParameterModule |
There was a problem hiding this comment.
My only worry here is that this would leave from unsloth_zoo.temporary_patches.gpt_oss import ParameterModule in the unsloth_compiled_module_gpt_oss.py. Can you please verify where the import resolves to and it doesnot create a dependency cycle?
|
Addressed review comments on #519 and verified import resolution:
Datta concern check (dependency cycle):
Latest verification logs:
|
Summary
Fixes GPT-OSS compiled-cache failures where generated modules can reference
ParameterModulebut the symbol is not available fromtransformers.models.gpt_oss.modeling_gpt_oss.Root cause
ParameterModuleis defined inunsloth_zoo.temporary_patches.gpt_oss, but compiler-generated code expects symbols to be resolvable from the GPT-OSS modeling namespace.Changes
patch_gpt_oss_compiler_exports()inunsloth_zoo/temporary_patches/gpt_oss.py.transformers.models.gpt_oss.modeling_gpt_oss:ParameterModuleswiglu_torch_forwarddtype_from_configtransformers_versionVersionTEMPORARY_PATCHES.append(patch_gpt_oss_compiler_exports).UNSLOTH_MODEL_NAME.replace("-", "_")usage across key 4-bit/load guards.pass.@use_kernel_forward_from_hub(...)@auto_docstringThis removes noisy unknown-decorator warnings in GPT-OSS compile paths.
Validation
Run dirs:
logs/pr519_verify_20260226_031808/test_gpt_oss_compiler_export.loglogs/pr519_verify_20260226_031808/test_gpt_oss_compiler_export_after_autodoc_reinstall.logResults:
@use_kernel_forward_from_hubunknown decorator warning: removed@auto_docstringunknown decorator warning: removedNotes
This change is scoped to symbol export and compile-time compatibility. It does not modify model math.