Skip to content

Implement nas.convert() api for the compress algorithm#482

Merged
danielkorzekwa merged 52 commits intofeature/compressfrom
dkorzekwa/nas_convert
Oct 31, 2025
Merged

Implement nas.convert() api for the compress algorithm#482
danielkorzekwa merged 52 commits intofeature/compressfrom
dkorzekwa/nas_convert

Conversation

@danielkorzekwa
Copy link
Copy Markdown
Contributor

What does this PR do?

Implement nas.convert() api for the compress algorithm

danielkorzekwa and others added 30 commits October 27, 2025 11:50
using MIP-based NAS search algorithm.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
…ation.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
…ress module.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
…ntal/ folder to not be run by CICD yet.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
…tmp_path.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
…thm.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
…as_convert

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
…rtion

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
@danielkorzekwa danielkorzekwa requested a review from a team as a code owner October 29, 2025 18:19
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.40%. Comparing base (cef3655) to head (936556f).
⚠️ Report is 1 commits behind head on feature/compress.

Additional details and impacted files
@@                Coverage Diff                @@
##           feature/compress     #482   +/-   ##
=================================================
  Coverage             73.40%   73.40%           
=================================================
  Files                   180      180           
  Lines                 18127    18127           
=================================================
  Hits                  13306    13306           
  Misses                 4821     4821           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment on lines +60 to +61
hydra_config_dir = project_root_path / "tests/experimental/torch/_compress/resources/configs"
hydra_config_name = "Llama-3_1-8B"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Any reason for passing hydra_config_dir and hydra_config_name instead of just 1 argument hydra_config_path?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

there could be multiple models supported, not just Llama-3_1-8B, currently, by design for each model there is a dedicated hydra file,

for the user facing interface we could simplify it, but we need to think how.

Comment on lines +70 to +77
setup_puzzle_dir(puzzle_dir)
save_dummy_dataset(dataset_path)

# Create a small Llama model
tokenizer = create_tokenizer(project_root_path)
create_and_save_small_llama_model(
llama_checkpoint_path, vocab_size=tokenizer.vocab_size, tokenizer=tokenizer
)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We can move this to test_utils.py and reuse in test_compress.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

already did as part of the next nas_search() MR, let's wait till you see it there.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
#
# Run the mnt.convert() step
#
input_model = CompressModel()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is the CompressModel just a placeholder so it can pass the API requirements? Lets discuss in our meeting tomorrow how to better handle this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it is there because it is needed by mtn api, but I agree it is not really used. let's discuss.

Comment on lines +16 to +17
from hydra import compose, initialize, initialize_config_dir
from omegaconf import DictConfig, OmegaConf
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add hydra and omegaconf to setup.py puzzle dependencies

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done, do we have some integration test that will set setup.py? for:

 # Dependedencies for modelopt.torch._compress subpackage
    "compress": [
        "fire",
        "hydra-core==1.3.2",
        "omegaconf==2.3.0",
    ],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I will work on the integration test next week

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
@danielkorzekwa danielkorzekwa requested a review from a team as a code owner October 30, 2025 20:39
@danielkorzekwa danielkorzekwa requested review from kevalmorabia97 and removed request for a team October 30, 2025 20:39
@danielkorzekwa danielkorzekwa merged commit 002b8b5 into feature/compress Oct 31, 2025
21 checks passed
@danielkorzekwa danielkorzekwa deleted the dkorzekwa/nas_convert branch October 31, 2025 18:27
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