CharlieFRuan opened a new pull request, #16284: URL: https://github.com/apache/tvm/pull/16284
This PR allows dynamic shape in some modules of `nn.Module` (Linear and Embedding), motivated by dynamic vocab size as discussed in https://github.com/mlc-ai/mlc-llm/pull/1417. **UX-wise** We allow `nn.Parameter("vocab_size", 4096)`, equivalent to `nn.Parameter(tir.Var("vocab_size", "int64"), 4096)`. **Symbolic relationship across Parameters** Besides, we make sure the same symbolic shape for different parameters do not appear twice within the same method. For instance, the following **_would not happen_**: ```python @R.function def prefill(...): vocab_size = T.int64() # for `embed_tokens` vocab_size1 = T.int64() # for `lm_head` ``` This is prevented by `str2var_params` in `Exporter`, so that all `embed_tokens.shape[0]` and `lm_head.shape[0]` share the same `tir.Var`. -- 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]
