-
Notifications
You must be signed in to change notification settings - Fork 6
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
Optimize the model analysis weekly pipeline #874
Optimize the model analysis weekly pipeline #874
Conversation
7829276
to
f257796
Compare
0a3153c
to
a236b80
Compare
Great work @chandrasekaranpradeep! I don't see any major issues from code changes. However, I would like to confirm few details before proceeding with further review. That said, can you provide details about achieved results with this change? Here are a few questions as a guideline:
Other:
|
I have checked the behaviour of the implementation but haven't noted the execution time before and after the change, will check and let you know here.
Summary of previous workflow:
Summary of the new workflow:
All these question are related to generation of test for nightly from the extracted unique op configuration across all the models, the PR doesn't have implementation for generating test for nightly from extracted unique op configuration across all the models. The pchandrasekaran/generate_nightly_test branch that I am working has the changes for generating test for nightly which will be later include as part of push pipeline The idea is to generate nightly test by using the exported unique op config test details excel and models metadata info json files produced from the Generate the unique op tests for the models present in the directory path specified by the user(i. e forge/test/models/pytorch) step in the new workflow In the model analysis script main function, I have added an option to generate nightly test. When we enable the option of generating nightly test, after generating unique op test from all the models with xlsx and json files, we are extracting unique op configuration across all the models and then generate nightly test for extracted unique op configuration across models. Instead of loading actual parameters and constants from models with process_framework_paremeter method, now the parameters and constants are randomly generated by modifying the add_constants method in ForgeModule in forge/forge/module.py and Parameter class in forge/forge/parameter.py and also done some modification in the write_class_defination function in ForgeWritter. Added recorded_property fixtures in the nightly test function which includes model_name, variant_name, framework_op_name and op_kind In sum, the model_analysis script will additional generate nightly test with model_analysis_nightly marker and then create a separate PR for the generate nightly test and then we will have some github workflow to run the generated nightly based upon the test results we can remove the failed test cases from the same PR branch and check it and merge it into main. Currently comparing the generated nightly test result with unique op test result for bert models which also includes pcc drop check when we use random tensor instead of actual params and constants from the model. The idea is the unique op and generated nightly test results should match. Whats your thoughts on this nikola? |
Genereted nightly test from model analysis script: |
@nvukobratTT I have tested the model analysis script before and after optimisation with the Model analysis script overall execution time
|
Thanks for the details! Sounds good!
Think about how we can include passing ones right away as part of push pipeline, while keeping other part of nightly. Ofc, this is more question for upcoming PR rather then this one. For other details related to futhre PR, let's discuss in our sync tomorrow. |
a236b80
to
6a5cde5
Compare
6a5cde5
to
af30e57
Compare
1. **Restructure the model analysis script:** Fixes [#1001](#1001) Instead of having multiple class(i.e MarkDownWriter, MatchingExceptionRule, ModelVariantInfo, etc.) and functions in single python file, created python package named model_analysis and declared the function and class in separate file. Eg: MarkDownWriter class is used for creating and writing markdown files which is included in markdown.py file and common_failure_matching_rules_list has separate python module named expcetion_rules.py file 2. **Created a script for generating models ops test from the unique ops configuration extracted all the models present in the `forge/test/models` directory.** Fixes [#874](#761) Workflow: 1. Collect all the test that doesn't contain skip_model_analysis marker in the directory path specified the user eg: `forge/test/models`. 2. Run all the collected tests to extract the unique ops configuration and export the model unique ops configuration as excel and metadata json file Note: It will doesn't generate unique op test like model analysis pipeline 3. After extracting unique op configuration for the all test, then try to extract the unique ops configuration across all the test (i.e model variants) 4. By using extracted unique ops configuration across all the model variants, create models ops test with forge module in the directory path specified by the user. 5. Black formating and spdx headers are also automatically done in the generated nightly/push test **Note:** The ForgeModules present in the generated models ops test doesn't use actual parameter/constant tensor values from the model parameter/buffers by using the process_framework_parameter function. Instead, it will generate random tensor based upon the constant/parameter tensor shapes and dtypes which is done inside the test function. <img width="937" alt="Screenshot 2025-01-07 at 6 32 35 PM" src="https://github.com/user-attachments/assets/851ae7ef-da53-407a-a344-4656dd3e92e5" /> 3. **Breakdown the Model Analysis Weekly workflow:** Fixes [#1002](#1002) 1. model-analysis.yml -> Common yml file used for running the model analysis pipeline for markdown generation and models ops test generation. 2. model-analysis-weekly.yml -> Workflow used for triggering the Model Analysis Workflow(i.e model-analysis.yml) for running the model analysis and markdown files generation. 3. model-analysis-config.sh -> shell script containing the script and PR configuration/environmental variables for the markdown generation and model test generation. The generated models ops test PR for albert model - #1014
The PR will optimise the model analysis weekly pipeline - #761
The current model_analysis script will generate the unique op tests and running the unique op configuration test model wise instead collect the unique op test configuration from all the models and then extract unique op configuration test across all the models which will avoid running same configuration that are present in multiple models again and again.
For example, if we have add op with operands shape of (1, 32) and (1, 32) in resnet and mobilenet, will run the test only once and populate the test results in both resnet and mobilenet