Skip to content
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

[Oneshot Refactor] Main refactor #1110

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

[Oneshot Refactor] Main refactor #1110

wants to merge 3 commits into from

Conversation

horheynm
Copy link
Collaborator

@horheynm horheynm commented Jan 28, 2025

ORDER OF REVIEWS:

  1. [Oneshot Refactor] Rename get_shared_processor_src to get_processor_name_from_model #1108
  2. [Oneshot Refactor] dataclass Arguments #1103
  3. [Oneshot refactor] Refactor initialize_model_from_path #1109
  4. [Oneshot Refactor] Main refactor #1110 <- current PR

Blocked on
#1103

SUMMARY:

  • Create a class to decouple dependency to main. Class Oneshot consists of pre-processing, carrying out oneshot logic and post-processing
  • Remove apply used only for stagerunner oneshot pathway in session.py and session_function.py
  • Add oneshot only calibration dataloader logic

Entrypoints:

oneshot(**kwargs) # calls Oneshot

or

oneshot = Oneshot(**kwargs)
oneshot.run() # preprocesss, carries out logic and post process

TEST PLAN:
Contingent on #1103, should pass all tests

Copy link

👋 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.

@dsikka
Copy link
Collaborator

dsikka commented Feb 3, 2025

Blocked on #1103

SUMMARY:

  • Create a class to decouple dependency to main. Class Oneshot consists of pre-processing, carrying out oneshot logic and post-processing

Entrypoints:

oneshot(**kwargs) # calls Oneshot

or

oneshot = Oneshot(**kwargs)
oneshot.run() # preprocesss, carries out logic and post process

TEST PLAN: Contingent on #1103, should pass all tests

Can you update the PR description so it clearly lays out what PRs we should be reviewing and in what order, so that it is easier to understand the changes?

Copy link
Collaborator

@dsikka dsikka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/llmcompressor/transformers/calibration/oneshot.py Outdated Show resolved Hide resolved
self.tokenizer_or_processor = self.model_args.processor
self.recipe = self.recipe_args.recipe

def run(self, **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is run meant to take in arguments?
The docstring shows run() being called without any inputs

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are kwargs here?

Copy link
Collaborator Author

@horheynm horheynm Feb 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kwargs is for session init / finalize kwargs

src/llmcompressor/transformers/calibration/oneshot.py Outdated Show resolved Hide resolved
dsikka added a commit that referenced this pull request Feb 5, 2025
…ame_from_model (#1108)

ORDER OF REVIEWS:
1. #1108 <- current
PR
2. #1103
3. #1109
4. #1110

SUMMARY:
* Rename `get_shared_processor_src` to `get_processor_from_model`
* Appropriate signature on `initialize_processor_from_path`, where
`teacher` should be optinal


TEST PLAN:
* Pass all existing tests
* Search `get_shared_processor_src` using pygrep
```bash
  3 function pygrep() {
  2     local search_term="$1"
  1     shift
126     local search_dirs="${*:-src examples tests}"                           
  1     grep -rn --include="*.py" -E "$search_term" $search_dirs
  2 }
```

---------

Co-authored-by: Dipika Sikka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants