neuralmagic / deepsparse

Sparsity-aware deep learning inference runtime for CPUs
https://neuralmagic.com/deepsparse/
Other
2.94k stars 169 forks source link

[BugFix] Remove `src.` from imports #1507

Closed rahul-tuli closed 6 months ago

rahul-tuli commented 6 months ago

This PR fixes a bug where src. was included in front of imports; this is faulty because once the package is built src.deepsparse becomes invalid

Ran the affected tests locally

$ pytest -vv tests/deepsparse/evaluation                                                                                                                                 (main|✚10…1)
================================================================================ test session starts =================================================================================
platform linux -- Python 3.11.5, pytest-7.4.4, pluggy-1.3.0 -- /home/rahul/venvs/.base_venv/bin/python3.11
cachedir: .pytest_cache
rootdir: /home/rahul/projects/deepsparse
configfile: pyproject.toml
plugins: flaky-3.7.0
collected 28 items                                                                                                                                                                   

tests/deepsparse/evaluation/test_evaluator.py::test_evaluate_unknown_integration PASSED                                                                                        [  3%]
tests/deepsparse/evaluation/test_evaluator.py::test_evaluate PASSED                                                                                                            [  7%]
tests/deepsparse/evaluation/test_evaluator.py::test_evaluation_llm_evaluation_harness_integration_name SKIPPED (lm_evaluation_harness not installed)                           [ 10%]
tests/deepsparse/evaluation/test_evaluator.py::test_cli[json] PASSED                                                                                                           [ 14%]
tests/deepsparse/evaluation/test_evaluator.py::test_cli[yaml] PASSED                                                                                                           [ 17%]
tests/deepsparse/evaluation/test_registry.py::test_get_foo_from_registry PASSED                                                                                                [ 21%]
tests/deepsparse/evaluation/test_registry.py::test_get_multiple_buzz_from_registry PASSED                                                                                      [ 25%]
tests/deepsparse/evaluation/test_results.py::test_serialize_result_json PASSED                                                                                                 [ 28%]
tests/deepsparse/evaluation/test_results.py::test_serialize_result_yaml PASSED                                                                                                 [ 32%]
tests/deepsparse/evaluation/test_utils.py::test_resolve_known_llm_model PASSED                                                                                                 [ 35%]
tests/deepsparse/evaluation/test_utils.py::test_resolve_unknown_model PASSED                                                                                                   [ 39%]
tests/deepsparse/evaluation/test_utils.py::test_if_generative_language_model_true PASSED                                                                                       [ 42%]
tests/deepsparse/evaluation/test_utils.py::test_if_generative_language_model_false PASSED                                                                                      [ 46%]
tests/deepsparse/evaluation/test_utils.py::test_if_generative_language_pipeline_true PASSED                                                                                    [ 50%]
tests/deepsparse/evaluation/test_utils.py::test_get_save_path_path_provided PASSED                                                                                             [ 53%]
tests/deepsparse/evaluation/test_utils.py::test_get_save_to_current_working_directory PASSED                                                                                   [ 57%]
tests/deepsparse/evaluation/test_utils.py::test_initialize_model_from_target_pipeline_onnx PASSED                                                                              [ 60%]
tests/deepsparse/evaluation/test_utils.py::test_initialize_model_from_target_pipeline_deepsparse PASSED                                                                        [ 64%]
tests/deepsparse/evaluation/test_utils.py::test_initialize_model_from_target_pipeline_with_kwargs PASSED                                                                       [ 67%]
tests/deepsparse/evaluation/test_utils.py::test_initialize_model_from_target_torch PASSED                                                                                      [ 71%]
tests/deepsparse/evaluation/integrations/test_lm_evaluation_harness.py::TestLMEvaluationHarness::test_integration_eval_onnx_matches_torch[1-datasets0-pipeline0-model_torch0] SKIPPED [ 75%]
tests/deepsparse/evaluation/integrations/test_lm_evaluation_harness.py::TestLMEvaluationHarness::test_integration_eval_onnx_matches_torch[1-datasets1-pipeline0-model_torch0] SKIPPED [ 78%]
tests/deepsparse/evaluation/integrations/test_lm_evaluation_harness.py::TestLMEvaluationHarness::test_integration_eval_onnx_matches_torch[1-gsm8k-pipeline0-model_torch0] SKIPPED [ 82%]
tests/deepsparse/evaluation/integrations/test_lm_evaluation_harness.py::TestLMEvaluationHarness::test_integration_eval_onnx_matches_torch[1-arc_challenge-pipeline0-model_torch0] SKIPPED [ 85%]
tests/deepsparse/evaluation/integrations/test_lm_evaluation_harness.py::TestLMEvaluationHarness::test_integration_eval_onnx_matches_torch[3-datasets0-pipeline0-model_torch0] SKIPPED [ 89%]
tests/deepsparse/evaluation/integrations/test_lm_evaluation_harness.py::TestLMEvaluationHarness::test_integration_eval_onnx_matches_torch[3-datasets1-pipeline0-model_torch0] SKIPPED [ 92%]
tests/deepsparse/evaluation/integrations/test_lm_evaluation_harness.py::TestLMEvaluationHarness::test_integration_eval_onnx_matches_torch[3-gsm8k-pipeline0-model_torch0] SKIPPED [ 96%]
tests/deepsparse/evaluation/integrations/test_lm_evaluation_harness.py::TestLMEvaluationHarness::test_integration_eval_onnx_matches_torch[3-arc_challenge-pipeline0-model_torch0] SKIPPED [100%]

================================================================================== warnings summary ==================================================================================
../../venvs/.base_venv/lib/python3.11/site-packages/sparsezoo/objects/file.py:15
  /home/rahul/venvs/.base_venv/lib/python3.11/site-packages/sparsezoo/objects/file.py:15: DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13
    import imghdr

src/deepsparse/utils/onnx.py:106: 2 warnings
tests/deepsparse/evaluation/test_evaluator.py: 8 warnings
tests/deepsparse/evaluation/test_utils.py: 8 warnings
  /home/rahul/projects/deepsparse/src/deepsparse/utils/onnx.py:106: DeprecationWarning: `mapping.TENSOR_TYPE_TO_NP_TYPE` is now deprecated and will be removed in a future release.To silence this warning, please use `helper.tensor_dtype_to_np_dtype` instead.
    return TENSOR_TYPE_TO_NP_TYPE[tensor_type]

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
==================================================================== 19 passed, 9 skipped, 19 warnings in 52.47s =====================================================================