Lunderberg commented on PR #16785: URL: https://github.com/apache/tvm/pull/16785#issuecomment-2025117126
I've done some experimenting, and I think this use case may be handled with `@property` instead. For the unit test `test_generate_parameters`, this would then generate `self.gate_up_proj` when accessed, rather than as part of the `__init__` method. Since the access of `self.gate_up_proj` occurs during the `forward` function, after all overwrites of `param._expr` have been applied, it wouldn't need the extensions to `nn.Module.export_tvm` added in this PR. Pros: * Would be compatible with the current `nn.Module.export_tvm`, which overwrites `param._expr`. * Would be compatible with the current `nn.Module.to` implementation, which overwrites `param._expr`. Cons: * Requires `LiftTransformParams` as a post-processing step. Would not allow the SLM to Relax conversion to generate the `transform_params` function directly. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
