-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Callbacks] Remove pre_initialize_structure #1160
Conversation
Signed-off-by: Kyle Sayers <[email protected]>
👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review. Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed. |
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
…initialize-structure
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job XD
## Purpose ## * Simplify all methods of saving into one point, namely the wrapped `save_pretrained` function * Precursor to #1160 * Needed for having a single point for saving on top of existing recipes ## Background ## All the things needed to be done during saving 1. Save the model weights, potentially compressed 2. Save the processor 3. Update the recipe checkpoint 4. Copy any necessary python files from the model cache 5. Only save on the main process After these changes, (1, 2, 3, 4) will be done within the `save_pretrained` function, and (5) will be the responsibility of the caller. (3) will be implemented by #1160 so as not to conflict with existing logic in pre_init All of the places where a model is saved are * If an output dir is specified, at the end of the main function * Between stages of the stage runner * Between epochs of the HF Trainer * By the user after oneshot/training completes After these changes, all of these will be replaced by a single `save_checkpoint` function which calls `save_pretrained` to do all the necessary things ## Changes ## * Remove `save_model_and_recipe` * Saving recipes is now done by `save_pretrained` function * Implement `save_checkpoint` * Single entrypoint for saving a model and its processor * Performs actions (1, 2, 4) * Replace all locations where a model is saved with `save_checkpoint` * All applicable callers with only saving on the main process (5) * Remove support for `modify_fsdp_model_save_pretrained` and `unwrap_and_export_model`, to be added back in a future release --------- Signed-off-by: Kyle Sayers <[email protected]> Co-authored-by: Dipika Sikka <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good, but i'm going off an assumption that none of this deleted code we actually need
@brian-dellabetta The PR description lists all of the functionality that was needed by preinitialize and where that functionality now lives |
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
Signed-off-by: Kyle Sayers <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work!
src/llmcompressor/transformers/sparsification/compressed_tensors_utils.py
Show resolved
Hide resolved
## Purpose ## * Fix staged 2of4 example ## Background ## * When #1160 landed, this change introduced a bug in the recipe container which meant that the recipe was not recompiled after `append`ing. This caused sgpt to initialize twice and gptq to never initialize, leading to a sparsity-only quantization config * At some point, a changed was introduced which causes previous stages to become reconstructed after recipe recompilation. This means that without resetting the session in between stages, previous stages will initialize twice. * In order to avoid this issue, this PR introduces `session.reset()` in between stages * This change has the consequence of creating `recipe.yaml` files which do not have the full recipe history. However, I believe this is acceptable for the time being, as the stage runner and this work flow will be removed in the next release. --------- Signed-off-by: Kyle Sayers <[email protected]>
Purpose
Prerequisites
Follow-ups
Changes
The preinitialization step used to fulfill a few purposes
initialize
initialize
is called. In these cases, we can pass the model directlyProvide a way for modifiers to influence the model after they have already been applied
Create quantization modifier on GPTQ
on_initialize
functionRemove
EventType.order()
method which is unusedExtend the
Recipe.simplify_recipe
class method to support stringsLifecycle
create_session()
(doesn't do much and can be hidden behindinitialize
)initialize(model=..., recipe=...)
start
modifiersLifecycleCallback.event(...)
start/end
modifiersfinalize()
Regression Evaluation
Main
This branch