enable profiling for video-comprehension sample#1958
Conversation
| project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) | ||
| if project_root not in sys.path: | ||
| sys.path.insert(0, project_root) |
There was a problem hiding this comment.
Why do we need these lines?
There was a problem hiding this comment.
to import this:
from examples.common_parser import add_profiling_args
I do believe it's good approach to use the examples folder for shared code among examples
alternatively:
- I could use a relative import, but these scripts are not run as a module.
- I could modify
PYTHONPATH, but this would cause changes to all tests and instructions for running these scripts.
There was a problem hiding this comment.
@regisss can you check my comment please
There was a problem hiding this comment.
@alexey-belyakov, I would suggest to wait for #1931 to be merged as there is some rebase of profiling code.
Besides that, probably another solution in case you do not want to rewrite code multiple times is to create a file like examples_utils.py, or the like, under optimum/habana which is already in the path. To avoid the solution you provided which is not very clear.
There was a problem hiding this comment.
Honestly I'm also fine in not creating a new file for the three profiling args that are repeating : ) But I can understand the pain
There was a problem hiding this comment.
optimum/habana does not contain code related to examples. examples folder is the most obvious folder for files related to examples.
It is always possible to rename the file after adding more logic to it.
| project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) | ||
| if project_root not in sys.path: | ||
| sys.path.insert(0, project_root) |
| project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) | ||
| if project_root not in sys.path: | ||
| sys.path.insert(0, project_root) |
There was a problem hiding this comment.
@alexey-belyakov, I would suggest to wait for #1931 to be merged as there is some rebase of profiling code.
Besides that, probably another solution in case you do not want to rewrite code multiple times is to create a file like examples_utils.py, or the like, under optimum/habana which is already in the path. To avoid the solution you provided which is not very clear.
| project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) | ||
| if project_root not in sys.path: | ||
| sys.path.insert(0, project_root) |
There was a problem hiding this comment.
Honestly I'm also fine in not creating a new file for the three profiling args that are repeating : ) But I can understand the pain
|
The code quality check failed, please run |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
|
@alexey-belyakov do you still need this change? |
|
@astachowiczhabana I believe we can close it |
What does this PR do?
Enable profiling for video-comprehension sample. I needed to collect profiling results for performance degradation issue, to do it
Some command lines to test:
python examples/video-comprehension/run_example.py --help
python examples/text-generation/run_generation.py --help
python examples/video-comprehension/run_example.py --model_name_or_path LanguageBind/Video-LLaVA-7B-hf --bf16 --use_hpu_graphs --output_dir /tmp/tmpssf594uz --profiling_steps 10 --profiling_warmup_steps 3 --profiling_record_shapes
Fixes # (issue)
Before submitting