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

Remove session_mocker usage to prevent test cross talking #2375

Merged
merged 1 commit into from
May 31, 2023

Conversation

mreso
Copy link
Collaborator

@mreso mreso commented May 31, 2023

Description

Fixes failing test for scriptable tokenizer

Fixes #(issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Feature/Issue validation/testing

Please describe the Unit or Integration tests that you ran to verify your changes and relevant result summary. Provide instructions so it can be reproduced.
Please also list any relevant details for your test configuration.

  • pytest -v test/pytest/test_example_micro_batching.py test/pytest/test_example_scriptable_tokenzier.py
=========================================================================================================================================================================== test session starts ============================================================================================================================================================================
platform linux -- Python 3.8.16, pytest-7.3.1, pluggy-1.0.0 -- /home/ubuntu/miniconda3/envs/zipfile_issue/bin/python
cachedir: .pytest_cache
rootdir: /home/ubuntu/serve
plugins: mock-3.10.0, cov-4.1.0
collected 10 items

test/pytest/test_example_micro_batching.py::test_single_example_inference[yaml_config] PASSED                                                                                                                                                                                                                                                                        [ 10%]
test/pytest/test_example_micro_batching.py::test_multi_example_inference[4-yaml_config] PASSED                                                                                                                                                                                                                                                                       [ 20%]
test/pytest/test_example_micro_batching.py::test_multi_example_inference[4-no_config] PASSED                                                                                                                                                                                                                                                                         [ 30%]
test/pytest/test_example_micro_batching.py::test_single_example_inference[no_config] PASSED                                                                                                                                                                                                                                                                          [ 40%]
test/pytest/test_example_micro_batching.py::test_multi_example_inference[16-no_config] PASSED                                                                                                                                                                                                                                                                        [ 50%]
test/pytest/test_example_micro_batching.py::test_multi_example_inference[16-yaml_config] PASSED                                                                                                                                                                                                                                                                      [ 60%]
test/pytest/test_example_scriptable_tokenzier.py::test_handler PASSED                                                                                                                                                                                                                                                                                                [ 70%]
test/pytest/test_example_scriptable_tokenzier.py::test_inference_with_untrained_model_and_sample_text PASSED                                                                                                                                                                                                                                                         [ 80%]
test/pytest/test_example_scriptable_tokenzier.py::test_inference_with_untrained_model_and_empty_string PASSED                                                                                                                                                                                                                                                        [ 90%]
test/pytest/test_example_scriptable_tokenzier.py::test_inference_with_pretrained_model PASSED                                                                                                                                                                                                                                                                        [100%]

============================================================================================================================================================================= warnings summary =============================================================================================================================================================================
test/pytest/test_example_scriptable_tokenzier.py::test_handler
  /home/ubuntu/miniconda3/envs/zipfile_issue/lib/python3.8/site-packages/torch/jit/_recursive.py:266: UserWarning: 'batch_first' was found in ScriptModule constants, but was not actually set in __init__. Consider removing it.
    warnings.warn("'{}' was found in ScriptModule constants, "

test/pytest/test_example_scriptable_tokenzier.py::test_handler
  /home/ubuntu/miniconda3/envs/zipfile_issue/lib/python3.8/site-packages/pkg_resources/__init__.py:121: DeprecationWarning: pkg_resources is deprecated as an API
    warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

test/pytest/test_example_scriptable_tokenzier.py::test_handler
  /home/ubuntu/miniconda3/envs/zipfile_issue/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

test/pytest/test_example_scriptable_tokenzier.py::test_handler
test/pytest/test_example_scriptable_tokenzier.py::test_handler
  /home/ubuntu/miniconda3/envs/zipfile_issue/lib/python3.8/site-packages/pkg_resources/__init__.py:2870: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('ruamel')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

test/pytest/test_example_scriptable_tokenzier.py::test_handler
  /home/ubuntu/miniconda3/envs/zipfile_issue/lib/python3.8/site-packages/torch/nn/modules/module.py:1501: UserWarning: The PyTorch API of nested tensors is in prototype stage and will change in the near future. (Triggered internally at ../aten/src/ATen/NestedTensorImpl.cpp:177.)
    return forward_call(*args, **kwargs)

test/pytest/test_example_scriptable_tokenzier.py::test_handler
  /home/ubuntu/serve/test/pytest/../../examples/text_classification_with_scriptable_tokenizer/handler.py:97: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
    data = F.softmax(data)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================================================================================================================================================================ 10 passed, 7 warnings in 159.49s (0:02:39) ================================================================================================================================================================

Checklist:

  • Did you have fun?

@mreso mreso requested review from msaroufim and agunapal May 31, 2023 20:12
@mreso mreso changed the title Remove evil session_mocker usage to prevent test cross talking Remove session_mocker usage to prevent test cross talking May 31, 2023
@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Merging #2375 (2046937) into master (130a29e) will decrease coverage by 0.11%.
The diff coverage is n/a.

❗ Current head 2046937 differs from pull request most recent head 329bca4. Consider uploading reports for the commit 329bca4 to get more accurate results

@@            Coverage Diff             @@
##           master    #2375      +/-   ##
==========================================
- Coverage   72.15%   72.04%   -0.11%     
==========================================
  Files          78       78              
  Lines        3641     3641              
  Branches       58       58              
==========================================
- Hits         2627     2623       -4     
- Misses       1010     1014       +4     
  Partials        4        4              

see 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mreso mreso merged commit 1f863f9 into master May 31, 2023
@mreso mreso deleted the fix/fix_scriptable_tokenizer_test branch May 31, 2023 22:01
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.

3 participants