Skip to content

fix: separate model weights from inputs in extraction output#720

Open
xjtu-L wants to merge 1 commit into
PaddlePaddle:developfrom
xjtu-L:fix/separator-weights-from-inputs
Open

fix: separate model weights from inputs in extraction output#720
xjtu-L wants to merge 1 commit into
PaddlePaddle:developfrom
xjtu-L:fix/separator-weights-from-inputs

Conversation

@xjtu-L
Copy link
Copy Markdown

@xjtu-L xjtu-L commented May 20, 2026

This PR separates model weights (parameters + buffers) from real input tensors during extraction, so that weight_meta.py only contains weights and input_meta.py only contains inputs.

Previously, `extractor.py` passed all placeholder params (including
lifted parameters, buffers, SymInt symbols, and real inputs) to
`convert_state_and_inputs(params, [])`, causing all of them to be
written to `weight_meta.py`. This led to SymInt placeholders like
`Program_weight_tensor_meta_s0` appearing in `weight_meta.py`, which
are not real model weights.

This change:
- Collects `id()` of original model parameters and buffers in `wrapper()`
- Passes them to `GraphExtractor` via `param_buffer_ids`
- Splits `params` into `weights` (params/buffers by identity) and
  `example_inputs` (real inputs including SymInt)
- Writes weights to `weight_meta.py` and inputs to `input_meta.py`
- Updates `utils.py` to handle dict-style `example_inputs`
@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented May 20, 2026

Thanks for your contribution!

@paddle-bot paddle-bot Bot added the contributor External developers label May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant