Commit Graph

2893 Commits

Author SHA1 Message Date
Natalia Gimelshein
056287aec4 turn off deadline for adagrad test
Summary: Tests are frequently failing with "exceeded the deadline of 1000.00ms", we expect this to happen, so remove the deadline

Test Plan: N/A: Fix breakages

Reviewed By: robieta

Differential Revision: D28581051

fbshipit-source-id: 4825ada9af151fa5d57c45c549138c15ba613705
2021-05-20 13:47:02 -07:00
Taylor Robie
6989eb60e5 Remove timeouts for C2 tests
Summary: When run on very heavily loaded machines, some of these tests are timing out. It's not an issue with the test, it's an issue with the environment. I've removed the timeout so we at least keep unit test coverage.

Test Plan: N/A: Fix breakages

Reviewed By: ngimel

Differential Revision: D28492334

fbshipit-source-id: aed3ee371763161aab2d356f5623c7df053fda6f
2021-05-17 16:39:30 -07:00
Sam Estep
3507ca320b Remove unused python2 shebang (#58409)
Summary:
This is the only line (not in `third_party`) matching the regex `^#!.*python2`, and [it is not the first line of its file](https://github.com/koalaman/shellcheck/wiki/SC1128), so it has no effect. As a followup to https://github.com/pytorch/pytorch/issues/58275, this PR removes that shebang to reduce confusion, so now all Python shebangs in this repo are `python3`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/58409

Reviewed By: walterddr

Differential Revision: D28478469

Pulled By: samestep

fbshipit-source-id: c17684c8651e45d3fc383cbbc04a31192d10f52f
2021-05-17 13:19:32 -07:00
Sam Estep
2e26976ad3 Disallow versionless Python shebangs (#58275)
Summary:
Some machines don't have a versionless `python` on their PATH, which breaks these existing shebangs.

I'm assuming that all the existing versionless `python` shebangs are meant to be `python3` and not `python2`; please let me know if my assumption was incorrect for any of these.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/58275

Test Plan: CI.

Reviewed By: zhouzhuojie

Differential Revision: D28428143

Pulled By: samestep

fbshipit-source-id: 6562be3d12924db72a92a0207b060ef740f61ebf
2021-05-14 08:26:02 -07:00
Zhijing Li
88a1e8eb01 Add EMA to DecayAdagrad (#57866)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57866

As titled

Test Plan: f271267365

Reviewed By: lanlanfb

Differential Revision: D28292875

fbshipit-source-id: f6532048eb558afce87fdada3b7dfa8457a1f538
2021-05-07 23:09:08 -07:00
Valentin Andrei
da06ae73a3 [c2] Fix flaky test_spatial_bn_multi_batch_grad
Summary: Removed the deadline restriction since the first run can take more than the deadline, wile subsequent runs are shorter.

Reviewed By: ngimel

Differential Revision: D28260077

fbshipit-source-id: 8ed2f5c16bc184bf4fae0a59b662fa1da2d4dd0a
2021-05-06 12:50:53 -07:00
Pyre Bot Jr
bca1949dc9 [typing] suppress errors in fbcode/caffe2 - batch 2
Test Plan: Sandcastle

Differential Revision: D28191118

fbshipit-source-id: 59421c7346903597308b0fdf8a0984f56664fb4f
2021-05-04 12:44:27 -07:00
Aapo Kyrola
d1def93166 [torch/debuggability] use log.info() in addition to print() in timeoutguard (#57296)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/57296

Seems many trainers disable print(), so we cannot see the thread dumps with CompleteInTimeOrDie(). So log.info() also.

Test Plan: sandcastle

Reviewed By: aalmah

Differential Revision: D28098738

fbshipit-source-id: dfdca8801bacf5c7bccecc2387cb7ef41dadfa46
2021-04-29 15:23:35 -07:00
Nikita Shulga
4cb534f92e Make PyTorch code-base clang-tidy compliant (#56892)
Summary:
This is an automatic change generated by the following script:
```
#!/usr/bin/env python3
from subprocess import check_output, check_call
import os

def get_compiled_files_list():
    import json
    with open("build/compile_commands.json") as f:
        data = json.load(f)
    files = [os.path.relpath(node['file']) for node in data]
    for idx, fname in enumerate(files):
        if fname.startswith('build/') and fname.endswith('.DEFAULT.cpp'):
            files[idx] = fname[len('build/'):-len('.DEFAULT.cpp')]
    return files

def run_clang_tidy(fname):
    check_call(["python3", "tools/clang_tidy.py", "-c", "build", "-x", fname,"-s"])
    changes = check_output(["git", "ls-files", "-m"])
    if len(changes) == 0:
        return
    check_call(["git", "commit","--all", "-m", f"NOLINT stubs for {fname}"])

def main():
    git_files = check_output(["git", "ls-files"]).decode("ascii").split("\n")
    compiled_files = get_compiled_files_list()
    for idx, fname in enumerate(git_files):
        if fname not in compiled_files:
            continue
        if fname.startswith("caffe2/contrib/aten/"):
            continue
        print(f"[{idx}/{len(git_files)}] Processing {fname}")
        run_clang_tidy(fname)

if __name__ == "__main__":
    main()
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/56892

Reviewed By: H-Huang

Differential Revision: D27991944

Pulled By: malfet

fbshipit-source-id: 5415e1eb2c1b34319a4f03024bfaa087007d7179
2021-04-28 14:10:25 -07:00
Pritam Damania
dc8a8cea79 Move caffe2 signal_handler to c10. (#56717)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56717

The signal_handler was under the caffe2 namespacee but was being used
by PyTorch as well.

I've fixed this my moving it to the c10 namespace where now both C2 and PyTorch
can use it.

The signal_handler interface in caffe2/utils/signal_handler.h is kept the same
for backward compatiblity for C2, but most of the commmon code is moved to c10.
ghstack-source-id: 127446929

Test Plan: waitforbuildbot

Reviewed By: ezyang

Differential Revision: D27946738

fbshipit-source-id: d6228d1a0108f4c807d405e7a0bb799c5375388f
2021-04-26 23:08:12 -07:00
Amir Shimoni
34eb6c8589 [Caffe2] ScriptModuleOp support pass_inputs_as_tensor_list (#56813)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/56813

When the arg `pass_inputs_as_tensor_list` is True, the input tensors are wrapped into a TensorList and passes in as a single param.

Test Plan: buck test //caffe2/caffe2/python:workspace_test -- TestScriptModule

Reviewed By: dzhulgakov

Differential Revision: D27972928

fbshipit-source-id: 5a199649445b0306f3134086c85bd55da45e1a0b
2021-04-23 18:49:57 -07:00
Andy Wei
19943aafe9 [caffe2] Speed up remote net loading
Summary:
Training recovery takes over 3 hours for DI models. See T88118480 for more details.

One of the slowness reasons could be the linear search in the ApplicationSpecificInfo. To improve that, we cache the app info into a dict so the lookup can be much faster.

Test Plan:
Unit test
  buck test caffe2/caffe2/fb/predictor:predictor_py_dist_utils_test
```Building: finished in 6.2 sec (100%) 11023/11023 jobs, 2 updated
  Total time: 6.6 sec
More details at https://www.internalfb.com/intern/buck/build/95555464-b15f-44f2-a781-a712126aeaa1
Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details.
Running with tpx session id: 3f4e4913-5802-4437-81bf-1e0a08c067da
Trace available for this run at /tmp/tpx-20210420-101444.394595/trace.log
Started reporting to test run: https://www.internalfb.com/intern/testinfra/testrun/5348024608951863
    ✓ ListingSuccess: caffe2/caffe2/fb/predictor:predictor_py_dist_utils_test - main (8.412)
    ✓ Pass: caffe2/caffe2/fb/predictor:predictor_py_dist_utils_test - test_empty_remote_net_in_app_into (caffe2.caffe2.fb.predictor.predictor_py_dist_utils_test.TestPredictorDistUtils) (7.844)
    ✓ Pass: caffe2/caffe2/fb/predictor:predictor_py_dist_utils_test - test_distributed_context_in_app_info (caffe2.caffe2.fb.predictor.predictor_py_dist_utils_test.TestPredictorDistUtils) (8.014)
    ✓ Pass: caffe2/caffe2/fb/predictor:predictor_py_dist_utils_test - test_remote_net_in_app_info (caffe2.caffe2.fb.predictor.predictor_py_dist_utils_test.TestPredictorDistUtils) (8.027)
Summary
  Pass: 3
  ListingSuccess: 1
If you need help debugging your runs, please follow the wiki: https://fburl.com/posting_in_tpx_users
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/5348024608951863
```

Performance Test:
N557020 is the old way, which takes about 30~60 secs for every 1000 remote nets
N556897 is the new way, which takes 0.12 secs for every 1000 remote nets

N557020 output:
~~~
I0420 112047.755 <ipython-input-2-515f8ba1b5f6>:48] Start retrieving remote nets ...
I0420 112050.036 <ipython-input-2-515f8ba1b5f6>:27] Get 1000 remote nets
I0420 112052.750 <ipython-input-2-515f8ba1b5f6>:27] Get 2000 remote nets
I0420 112055.907 <ipython-input-2-515f8ba1b5f6>:27] Get 3000 remote nets
I0420 112059.542 <ipython-input-2-515f8ba1b5f6>:27] Get 4000 remote nets
I0420 112103.628 <ipython-input-2-515f8ba1b5f6>:27] Get 5000 remote nets
I0420 112108.309 <ipython-input-2-515f8ba1b5f6>:27] Get 6000 remote nets
I0420 112113.883 <ipython-input-2-515f8ba1b5f6>:27] Get 7000 remote nets
I0420 112119.564 <ipython-input-2-515f8ba1b5f6>:27] Get 8000 remote nets
I0420 112125.629 <ipython-input-2-515f8ba1b5f6>:27] Get 9000 remote nets
I0420 112132.057 <ipython-input-2-515f8ba1b5f6>:27] Get 10000 remote nets
I0420 112138.979 <ipython-input-2-515f8ba1b5f6>:27] Get 11000 remote nets
I0420 112146.198 <ipython-input-2-515f8ba1b5f6>:27] Get 12000 remote nets
I0420 112154.381 <ipython-input-2-515f8ba1b5f6>:27] Get 13000 remote nets
I0420 112202.881 <ipython-input-2-515f8ba1b5f6>:27] Get 14000 remote nets
I0420 112211.595 <ipython-input-2-515f8ba1b5f6>:27] Get 15000 remote nets
I0420 112221.341 <ipython-input-2-515f8ba1b5f6>:27] Get 16000 remote nets
I0420 112231.300 <ipython-input-2-515f8ba1b5f6>:27] Get 17000 remote nets
I0420 112242.615 <ipython-input-2-515f8ba1b5f6>:27] Get 18000 remote nets
I0420 112253.730 <ipython-input-2-515f8ba1b5f6>:27] Get 19000 remote nets
I0420 112305.044 <ipython-input-2-515f8ba1b5f6>:27] Get 20000 remote nets
I0420 112316.378 <ipython-input-2-515f8ba1b5f6>:27] Get 21000 remote nets
I0420 112328.176 <ipython-input-2-515f8ba1b5f6>:27] Get 22000 remote nets
I0420 112341.466 <ipython-input-2-515f8ba1b5f6>:27] Get 23000 remote nets
I0420 112355.653 <ipython-input-2-515f8ba1b5f6>:27] Get 24000 remote nets
I0420 112409.014 <ipython-input-2-515f8ba1b5f6>:27] Get 25000 remote nets
I0420 112422.924 <ipython-input-2-515f8ba1b5f6>:27] Get 26000 remote nets
I0420 112437.026 <ipython-input-2-515f8ba1b5f6>:27] Get 27000 remote nets
I0420 112451.413 <ipython-input-2-515f8ba1b5f6>:27] Get 28000 remote nets
I0420 112506.773 <ipython-input-2-515f8ba1b5f6>:27] Get 29000 remote nets
I0420 112522.614 <ipython-input-2-515f8ba1b5f6>:27] Get 30000 remote nets
I0420 112538.564 <ipython-input-2-515f8ba1b5f6>:27] Get 31000 remote nets
I0420 112555.075 <ipython-input-2-515f8ba1b5f6>:27] Get 32000 remote nets
I0420 112612.159 <ipython-input-2-515f8ba1b5f6>:27] Get 33000 remote nets
I0420 112629.656 <ipython-input-2-515f8ba1b5f6>:27] Get 34000 remote nets
I0420 112647.850 <ipython-input-2-515f8ba1b5f6>:27] Get 35000 remote nets
I0420 112705.807 <ipython-input-2-515f8ba1b5f6>:27] Get 36000 remote nets
I0420 112724.495 <ipython-input-2-515f8ba1b5f6>:27] Get 37000 remote nets
I0420 112744.072 <ipython-input-2-515f8ba1b5f6>:27] Get 38000 remote nets
I0420 112804.266 <ipython-input-2-515f8ba1b5f6>:27] Get 39000 remote nets
I0420 112824.954 <ipython-input-2-515f8ba1b5f6>:27] Get 40000 remote nets
I0420 112845.934 <ipython-input-2-515f8ba1b5f6>:27] Get 41000 remote nets
I0420 112908.721 <ipython-input-2-515f8ba1b5f6>:27] Get 42000 remote nets
I0420 112930.573 <ipython-input-2-515f8ba1b5f6>:27] Get 43000 remote nets
I0420 112952.775 <ipython-input-2-515f8ba1b5f6>:27] Get 44000 remote nets
I0420 113015.969 <ipython-input-2-515f8ba1b5f6>:27] Get 45000 remote nets
I0420 113041.214 <ipython-input-2-515f8ba1b5f6>:27] Get 46000 remote nets
I0420 113104.702 <ipython-input-2-515f8ba1b5f6>:27] Get 47000 remote nets
I0420 113128.730 <ipython-input-2-515f8ba1b5f6>:27] Get 48000 remote nets
I0420 113153.378 <ipython-input-2-515f8ba1b5f6>:27] Get 49000 remote nets
I0420 113218.021 <ipython-input-2-515f8ba1b5f6>:27] Get 50000 remote nets
I0420 113243.351 <ipython-input-2-515f8ba1b5f6>:27] Get 51000 remote nets
I0420 113309.279 <ipython-input-2-515f8ba1b5f6>:27] Get 52000 remote nets
I0420 113335.202 <ipython-input-2-515f8ba1b5f6>:27] Get 53000 remote nets
I0420 113402.367 <ipython-input-2-515f8ba1b5f6>:27] Get 54000 remote nets
I0420 113430.947 <ipython-input-2-515f8ba1b5f6>:27] Get 55000 remote nets
I0420 113458.127 <ipython-input-2-515f8ba1b5f6>:27] Get 56000 remote nets
I0420 113526.365 <ipython-input-2-515f8ba1b5f6>:27] Get 57000 remote nets
I0420 113554.709 <ipython-input-2-515f8ba1b5f6>:27] Get 58000 remote nets
I0420 113623.601 <ipython-input-2-515f8ba1b5f6>:27] Get 59000 remote nets
I0420 113653.264 <ipython-input-2-515f8ba1b5f6>:27] Get 60000 remote nets
I0420 113724.726 <ipython-input-2-515f8ba1b5f6>:27] Get 61000 remote nets
I0420 113755.080 <ipython-input-2-515f8ba1b5f6>:27] Get 62000 remote nets
I0420 113827.936 <ipython-input-2-515f8ba1b5f6>:27] Get 63000 remote nets
I0420 113859.362 <ipython-input-2-515f8ba1b5f6>:27] Get 64000 remote nets
I0420 113931.138 <ipython-input-2-515f8ba1b5f6>:27] Get 65000 remote nets
I0420 114003.229 <ipython-input-2-515f8ba1b5f6>:27] Get 66000 remote nets
I0420 114038.085 <ipython-input-2-515f8ba1b5f6>:27] Get 67000 remote nets
I0420 114111.300 <ipython-input-2-515f8ba1b5f6>:27] Get 68000 remote nets
I0420 114145.383 <ipython-input-2-515f8ba1b5f6>:27] Get 69000 remote nets
I0420 114219.571 <ipython-input-2-515f8ba1b5f6>:27] Get 70000 remote nets
I0420 114254.233 <ipython-input-2-515f8ba1b5f6>:27] Get 71000 remote nets
I0420 114329.326 <ipython-input-2-515f8ba1b5f6>:27] Get 72000 remote nets
I0420 114405.087 <ipython-input-2-515f8ba1b5f6>:27] Get 73000 remote nets
I0420 114440.979 <ipython-input-2-515f8ba1b5f6>:27] Get 74000 remote nets
I0420 114518.520 <ipython-input-2-515f8ba1b5f6>:27] Get 75000 remote nets
I0420 114556.013 <ipython-input-2-515f8ba1b5f6>:27] Get 76000 remote nets
I0420 114633.434 <ipython-input-2-515f8ba1b5f6>:27] Get 77000 remote nets
I0420 114711.834 <ipython-input-2-515f8ba1b5f6>:27] Get 78000 remote nets
I0420 114750.741 <ipython-input-2-515f8ba1b5f6>:27] Get 79000 remote nets
I0420 114829.749 <ipython-input-2-515f8ba1b5f6>:27] Get 80000 remote nets
I0420 114909.038 <ipython-input-2-515f8ba1b5f6>:27] Get 81000 remote nets
I0420 114948.711 <ipython-input-2-515f8ba1b5f6>:27] Get 82000 remote nets
I0420 115028.869 <ipython-input-2-515f8ba1b5f6>:27] Get 83000 remote nets
I0420 115109.094 <ipython-input-2-515f8ba1b5f6>:27] Get 84000 remote nets
I0420 115150.249 <ipython-input-2-515f8ba1b5f6>:27] Get 85000 remote nets
I0420 115231.601 <ipython-input-2-515f8ba1b5f6>:27] Get 86000 remote nets
I0420 115313.772 <ipython-input-2-515f8ba1b5f6>:27] Get 87000 remote nets
I0420 115356.035 <ipython-input-2-515f8ba1b5f6>:27] Get 88000 remote nets
I0420 115438.846 <ipython-input-2-515f8ba1b5f6>:27] Get 89000 remote nets
I0420 115522.213 <ipython-input-2-515f8ba1b5f6>:27] Get 90000 remote nets
I0420 115607.908 <ipython-input-2-515f8ba1b5f6>:27] Get 91000 remote nets
I0420 115652.009 <ipython-input-2-515f8ba1b5f6>:27] Get 92000 remote nets
I0420 115736.510 <ipython-input-2-515f8ba1b5f6>:27] Get 93000 remote nets
I0420 115822.303 <ipython-input-2-515f8ba1b5f6>:27] Get 94000 remote nets
I0420 115908.392 <ipython-input-2-515f8ba1b5f6>:27] Get 95000 remote nets
I0420 115954.912 <ipython-input-2-515f8ba1b5f6>:27] Get 96000 remote nets
I0420 120042.219 <ipython-input-2-515f8ba1b5f6>:27] Get 97000 remote nets
I0420 120129.969 <ipython-input-2-515f8ba1b5f6>:27] Get 98000 remote nets
I0420 120218.765 <ipython-input-2-515f8ba1b5f6>:27] Get 99000 remote nets
I0420 120306.883 <ipython-input-2-515f8ba1b5f6>:27] Get 100000 remote nets
I0420 120355.543 <ipython-input-2-515f8ba1b5f6>:27] Get 101000 remote nets
I0420 120444.976 <ipython-input-2-515f8ba1b5f6>:27] Get 102000 remote nets
I0420 120533.482 <ipython-input-2-515f8ba1b5f6>:27] Get 103000 remote nets
I0420 120622.351 <ipython-input-2-515f8ba1b5f6>:27] Get 104000 remote nets
I0420 120712.467 <ipython-input-2-515f8ba1b5f6>:27] Get 105000 remote nets
I0420 120802.660 <ipython-input-2-515f8ba1b5f6>:27] Get 106000 remote nets
I0420 120854.634 <ipython-input-2-515f8ba1b5f6>:27] Get 107000 remote nets
I0420 120945.786 <ipython-input-2-515f8ba1b5f6>:27] Get 108000 remote nets
~~~

N556897 output:
~~~
I0420 111502.516 <ipython-input-7-52640a51556f>:60] Start retrieving remote nets ...
I0420 111504.709 <ipython-input-7-52640a51556f>:40] Get 1000 remote nets
I0420 111504.825 <ipython-input-7-52640a51556f>:40] Get 2000 remote nets
I0420 111504.941 <ipython-input-7-52640a51556f>:40] Get 3000 remote nets
I0420 111505.056 <ipython-input-7-52640a51556f>:40] Get 4000 remote nets
I0420 111505.174 <ipython-input-7-52640a51556f>:40] Get 5000 remote nets
I0420 111505.286 <ipython-input-7-52640a51556f>:40] Get 6000 remote nets
I0420 111505.405 <ipython-input-7-52640a51556f>:40] Get 7000 remote nets
I0420 111505.522 <ipython-input-7-52640a51556f>:40] Get 8000 remote nets
I0420 111505.639 <ipython-input-7-52640a51556f>:40] Get 9000 remote nets
I0420 111505.756 <ipython-input-7-52640a51556f>:40] Get 10000 remote nets
I0420 111505.873 <ipython-input-7-52640a51556f>:40] Get 11000 remote nets
I0420 111505.990 <ipython-input-7-52640a51556f>:40] Get 12000 remote nets
I0420 111506.106 <ipython-input-7-52640a51556f>:40] Get 13000 remote nets
I0420 111506.223 <ipython-input-7-52640a51556f>:40] Get 14000 remote nets
I0420 111506.343 <ipython-input-7-52640a51556f>:40] Get 15000 remote nets
I0420 111506.457 <ipython-input-7-52640a51556f>:40] Get 16000 remote nets
I0420 111506.585 <ipython-input-7-52640a51556f>:40] Get 17000 remote nets
I0420 111508.930 <ipython-input-7-52640a51556f>:40] Get 18000 remote nets
I0420 111509.045 <ipython-input-7-52640a51556f>:40] Get 19000 remote nets
I0420 111509.154 <ipython-input-7-52640a51556f>:40] Get 20000 remote nets
I0420 111509.266 <ipython-input-7-52640a51556f>:40] Get 21000 remote nets
I0420 111509.382 <ipython-input-7-52640a51556f>:40] Get 22000 remote nets
I0420 111509.497 <ipython-input-7-52640a51556f>:40] Get 23000 remote nets
I0420 111509.614 <ipython-input-7-52640a51556f>:40] Get 24000 remote nets
I0420 111509.736 <ipython-input-7-52640a51556f>:40] Get 25000 remote nets
I0420 111509.854 <ipython-input-7-52640a51556f>:40] Get 26000 remote nets
I0420 111509.972 <ipython-input-7-52640a51556f>:40] Get 27000 remote nets
I0420 111510.090 <ipython-input-7-52640a51556f>:40] Get 28000 remote nets
I0420 111510.210 <ipython-input-7-52640a51556f>:40] Get 29000 remote nets
I0420 111510.329 <ipython-input-7-52640a51556f>:40] Get 30000 remote nets
I0420 111510.448 <ipython-input-7-52640a51556f>:40] Get 31000 remote nets
I0420 111510.572 <ipython-input-7-52640a51556f>:40] Get 32000 remote nets
I0420 111510.689 <ipython-input-7-52640a51556f>:40] Get 33000 remote nets
I0420 111510.821 <ipython-input-7-52640a51556f>:40] Get 34000 remote nets
I0420 111510.989 <ipython-input-7-52640a51556f>:40] Get 35000 remote nets
I0420 111511.110 <ipython-input-7-52640a51556f>:40] Get 36000 remote nets
I0420 111511.236 <ipython-input-7-52640a51556f>:40] Get 37000 remote nets
I0420 111511.357 <ipython-input-7-52640a51556f>:40] Get 38000 remote nets
I0420 111511.482 <ipython-input-7-52640a51556f>:40] Get 39000 remote nets
I0420 111511.607 <ipython-input-7-52640a51556f>:40] Get 40000 remote nets
I0420 111511.729 <ipython-input-7-52640a51556f>:40] Get 41000 remote nets
I0420 111511.855 <ipython-input-7-52640a51556f>:40] Get 42000 remote nets
I0420 111511.988 <ipython-input-7-52640a51556f>:40] Get 43000 remote nets
I0420 111512.112 <ipython-input-7-52640a51556f>:40] Get 44000 remote nets
I0420 111512.232 <ipython-input-7-52640a51556f>:40] Get 45000 remote nets
I0420 111512.353 <ipython-input-7-52640a51556f>:40] Get 46000 remote nets
I0420 111512.477 <ipython-input-7-52640a51556f>:40] Get 47000 remote nets
I0420 111512.597 <ipython-input-7-52640a51556f>:40] Get 48000 remote nets
I0420 111512.723 <ipython-input-7-52640a51556f>:40] Get 49000 remote nets
I0420 111512.839 <ipython-input-7-52640a51556f>:40] Get 50000 remote nets
I0420 111512.969 <ipython-input-7-52640a51556f>:40] Get 51000 remote nets
I0420 111513.085 <ipython-input-7-52640a51556f>:40] Get 52000 remote nets
I0420 111513.205 <ipython-input-7-52640a51556f>:40] Get 53000 remote nets
I0420 111513.322 <ipython-input-7-52640a51556f>:40] Get 54000 remote nets
I0420 111513.441 <ipython-input-7-52640a51556f>:40] Get 55000 remote nets
I0420 111513.559 <ipython-input-7-52640a51556f>:40] Get 56000 remote nets
I0420 111513.678 <ipython-input-7-52640a51556f>:40] Get 57000 remote nets
I0420 111513.796 <ipython-input-7-52640a51556f>:40] Get 58000 remote nets
I0420 111513.918 <ipython-input-7-52640a51556f>:40] Get 59000 remote nets
I0420 111514.038 <ipython-input-7-52640a51556f>:40] Get 60000 remote nets
I0420 111514.158 <ipython-input-7-52640a51556f>:40] Get 61000 remote nets
I0420 111514.273 <ipython-input-7-52640a51556f>:40] Get 62000 remote nets
I0420 111514.391 <ipython-input-7-52640a51556f>:40] Get 63000 remote nets
I0420 111514.512 <ipython-input-7-52640a51556f>:40] Get 64000 remote nets
I0420 111514.638 <ipython-input-7-52640a51556f>:40] Get 65000 remote nets
I0420 111514.759 <ipython-input-7-52640a51556f>:40] Get 66000 remote nets
I0420 111514.874 <ipython-input-7-52640a51556f>:40] Get 67000 remote nets
I0420 111515.000 <ipython-input-7-52640a51556f>:40] Get 68000 remote nets
I0420 111515.117 <ipython-input-7-52640a51556f>:40] Get 69000 remote nets
I0420 111515.235 <ipython-input-7-52640a51556f>:40] Get 70000 remote nets
I0420 111515.358 <ipython-input-7-52640a51556f>:40] Get 71000 remote nets
I0420 111515.481 <ipython-input-7-52640a51556f>:40] Get 72000 remote nets
I0420 111515.604 <ipython-input-7-52640a51556f>:40] Get 73000 remote nets
I0420 111515.725 <ipython-input-7-52640a51556f>:40] Get 74000 remote nets
I0420 111515.848 <ipython-input-7-52640a51556f>:40] Get 75000 remote nets
I0420 111515.979 <ipython-input-7-52640a51556f>:40] Get 76000 remote nets
I0420 111516.102 <ipython-input-7-52640a51556f>:40] Get 77000 remote nets
I0420 111516.226 <ipython-input-7-52640a51556f>:40] Get 78000 remote nets
I0420 111516.344 <ipython-input-7-52640a51556f>:40] Get 79000 remote nets
I0420 111516.472 <ipython-input-7-52640a51556f>:40] Get 80000 remote nets
I0420 111516.603 <ipython-input-7-52640a51556f>:40] Get 81000 remote nets
I0420 111516.751 <ipython-input-7-52640a51556f>:40] Get 82000 remote nets
I0420 111516.883 <ipython-input-7-52640a51556f>:40] Get 83000 remote nets
I0420 111517.025 <ipython-input-7-52640a51556f>:40] Get 84000 remote nets
I0420 111517.160 <ipython-input-7-52640a51556f>:40] Get 85000 remote nets
I0420 111517.290 <ipython-input-7-52640a51556f>:40] Get 86000 remote nets
I0420 111517.415 <ipython-input-7-52640a51556f>:40] Get 87000 remote nets
I0420 111517.541 <ipython-input-7-52640a51556f>:40] Get 88000 remote nets
I0420 111517.665 <ipython-input-7-52640a51556f>:40] Get 89000 remote nets
I0420 111517.790 <ipython-input-7-52640a51556f>:40] Get 90000 remote nets
I0420 111517.918 <ipython-input-7-52640a51556f>:40] Get 91000 remote nets
I0420 111518.044 <ipython-input-7-52640a51556f>:40] Get 92000 remote nets
I0420 111518.171 <ipython-input-7-52640a51556f>:40] Get 93000 remote nets
I0420 111518.292 <ipython-input-7-52640a51556f>:40] Get 94000 remote nets
I0420 111518.429 <ipython-input-7-52640a51556f>:40] Get 95000 remote nets
I0420 111520.024 <ipython-input-7-52640a51556f>:40] Get 96000 remote nets
I0420 111520.148 <ipython-input-7-52640a51556f>:40] Get 97000 remote nets
I0420 111520.271 <ipython-input-7-52640a51556f>:40] Get 98000 remote nets
I0420 111520.396 <ipython-input-7-52640a51556f>:40] Get 99000 remote nets
I0420 111520.522 <ipython-input-7-52640a51556f>:40] Get 100000 remote nets
I0420 111520.646 <ipython-input-7-52640a51556f>:40] Get 101000 remote nets
I0420 111520.770 <ipython-input-7-52640a51556f>:40] Get 102000 remote nets
I0420 111520.899 <ipython-input-7-52640a51556f>:40] Get 103000 remote nets
I0420 111521.023 <ipython-input-7-52640a51556f>:40] Get 104000 remote nets
I0420 111521.149 <ipython-input-7-52640a51556f>:40] Get 105000 remote nets
I0420 111521.274 <ipython-input-7-52640a51556f>:40] Get 106000 remote nets
I0420 111521.399 <ipython-input-7-52640a51556f>:40] Get 107000 remote nets
I0420 111521.526 <ipython-input-7-52640a51556f>:40] Get 108000 remote nets
I0420 111521.651 <ipython-input-7-52640a51556f>:40] Get 109000 remote nets
I0420 111521.778 <ipython-input-7-52640a51556f>:40] Get 110000 remote nets
I0420 111521.900 <ipython-input-7-52640a51556f>:40] Get 111000 remote nets
I0420 111522.055 <ipython-input-7-52640a51556f>:40] Get 112000 remote nets
I0420 111522.173 <ipython-input-7-52640a51556f>:40] Get 113000 remote nets
I0420 111522.297 <ipython-input-7-52640a51556f>:40] Get 114000 remote nets
I0420 111522.421 <ipython-input-7-52640a51556f>:40] Get 115000 remote nets
I0420 111522.545 <ipython-input-7-52640a51556f>:40] Get 116000 remote nets
I0420 111522.671 <ipython-input-7-52640a51556f>:40] Get 117000 remote nets
I0420 111522.795 <ipython-input-7-52640a51556f>:40] Get 118000 remote nets
I0420 111522.919 <ipython-input-7-52640a51556f>:40] Get 119000 remote nets
I0420 111523.048 <ipython-input-7-52640a51556f>:40] Get 120000 remote nets
I0420 111523.171 <ipython-input-7-52640a51556f>:40] Get 121000 remote nets
I0420 111523.298 <ipython-input-7-52640a51556f>:40] Get 122000 remote nets
I0420 111523.420 <ipython-input-7-52640a51556f>:40] Get 123000 remote nets
I0420 111523.544 <ipython-input-7-52640a51556f>:40] Get 124000 remote nets
I0420 111523.669 <ipython-input-7-52640a51556f>:40] Get 125000 remote nets
I0420 111523.794 <ipython-input-7-52640a51556f>:40] Get 126000 remote nets
I0420 111523.920 <ipython-input-7-52640a51556f>:40] Get 127000 remote nets
I0420 111524.041 <ipython-input-7-52640a51556f>:40] Get 128000 remote nets
I0420 111524.173 <ipython-input-7-52640a51556f>:40] Get 129000 remote nets
I0420 111524.293 <ipython-input-7-52640a51556f>:40] Get 130000 remote nets
I0420 111524.417 <ipython-input-7-52640a51556f>:40] Get 131000 remote nets
I0420 111524.542 <ipython-input-7-52640a51556f>:40] Get 132000 remote nets
I0420 111524.665 <ipython-input-7-52640a51556f>:40] Get 133000 remote nets
I0420 111524.790 <ipython-input-7-52640a51556f>:40] Get 134000 remote nets
I0420 111524.913 <ipython-input-7-52640a51556f>:40] Get 135000 remote nets
I0420 111525.038 <ipython-input-7-52640a51556f>:40] Get 136000 remote nets
I0420 111525.166 <ipython-input-7-52640a51556f>:40] Get 137000 remote nets
I0420 111525.289 <ipython-input-7-52640a51556f>:40] Get 138000 remote nets
I0420 111525.414 <ipython-input-7-52640a51556f>:40] Get 139000 remote nets
I0420 111525.536 <ipython-input-7-52640a51556f>:40] Get 140000 remote nets
I0420 111525.659 <ipython-input-7-52640a51556f>:40] Get 141000 remote nets
I0420 111525.782 <ipython-input-7-52640a51556f>:40] Get 142000 remote nets
I0420 111525.907 <ipython-input-7-52640a51556f>:40] Get 143000 remote nets
I0420 111526.035 <ipython-input-7-52640a51556f>:40] Get 144000 remote nets
I0420 111526.157 <ipython-input-7-52640a51556f>:40] Get 145000 remote nets
I0420 111526.287 <ipython-input-7-52640a51556f>:40] Get 146000 remote nets
I0420 111526.409 <ipython-input-7-52640a51556f>:40] Get 147000 remote nets
I0420 111526.533 <ipython-input-7-52640a51556f>:40] Get 148000 remote nets
I0420 111526.658 <ipython-input-7-52640a51556f>:40] Get 149000 remote nets
I0420 111526.781 <ipython-input-7-52640a51556f>:40] Get 150000 remote nets
I0420 111526.908 <ipython-input-7-52640a51556f>:40] Get 151000 remote nets
I0420 111527.033 <ipython-input-7-52640a51556f>:40] Get 152000 remote nets
I0420 111527.158 <ipython-input-7-52640a51556f>:40] Get 153000 remote nets
I0420 111527.289 <ipython-input-7-52640a51556f>:40] Get 154000 remote nets
I0420 111527.413 <ipython-input-7-52640a51556f>:40] Get 155000 remote nets
I0420 111527.544 <ipython-input-7-52640a51556f>:40] Get 156000 remote nets
I0420 111527.665 <ipython-input-7-52640a51556f>:40] Get 157000 remote nets
I0420 111527.790 <ipython-input-7-52640a51556f>:40] Get 158000 remote nets
I0420 111527.917 <ipython-input-7-52640a51556f>:40] Get 159000 remote nets
I0420 111528.046 <ipython-input-7-52640a51556f>:40] Get 160000 remote nets
I0420 111528.175 <ipython-input-7-52640a51556f>:40] Get 161000 remote nets
I0420 111528.297 <ipython-input-7-52640a51556f>:40] Get 162000 remote nets
I0420 111528.422 <ipython-input-7-52640a51556f>:40] Get 163000 remote nets
I0420 111528.548 <ipython-input-7-52640a51556f>:40] Get 164000 remote nets
I0420 111528.672 <ipython-input-7-52640a51556f>:40] Get 165000 remote nets
I0420 111528.796 <ipython-input-7-52640a51556f>:40] Get 166000 remote nets
I0420 111528.920 <ipython-input-7-52640a51556f>:40] Get 167000 remote nets
I0420 111529.045 <ipython-input-7-52640a51556f>:40] Get 168000 remote nets
I0420 111529.172 <ipython-input-7-52640a51556f>:40] Get 169000 remote nets
I0420 111529.300 <ipython-input-7-52640a51556f>:40] Get 170000 remote nets
I0420 111529.426 <ipython-input-7-52640a51556f>:40] Get 171000 remote nets
I0420 111529.547 <ipython-input-7-52640a51556f>:40] Get 172000 remote nets
I0420 111529.683 <ipython-input-7-52640a51556f>:40] Get 173000 remote nets
I0420 111529.800 <ipython-input-7-52640a51556f>:40] Get 174000 remote nets
I0420 111529.923 <ipython-input-7-52640a51556f>:40] Get 175000 remote nets
I0420 111530.080 <ipython-input-7-52640a51556f>:40] Get 176000 remote nets
I0420 111530.205 <ipython-input-7-52640a51556f>:40] Get 177000 remote nets
I0420 111530.331 <ipython-input-7-52640a51556f>:40] Get 178000 remote nets
I0420 111530.453 <ipython-input-7-52640a51556f>:40] Get 179000 remote nets
I0420 111530.577 <ipython-input-7-52640a51556f>:40] Get 180000 remote nets
I0420 111530.705 <ipython-input-7-52640a51556f>:40] Get 181000 remote nets
I0420 111530.829 <ipython-input-7-52640a51556f>:40] Get 182000 remote nets
I0420 111530.955 <ipython-input-7-52640a51556f>:40] Get 183000 remote nets
I0420 111531.082 <ipython-input-7-52640a51556f>:40] Get 184000 remote nets
I0420 111531.210 <ipython-input-7-52640a51556f>:40] Get 185000 remote nets
I0420 111531.338 <ipython-input-7-52640a51556f>:40] Get 186000 remote nets
I0420 111531.461 <ipython-input-7-52640a51556f>:40] Get 187000 remote nets
I0420 111531.588 <ipython-input-7-52640a51556f>:40] Get 188000 remote nets
I0420 111531.708 <ipython-input-7-52640a51556f>:40] Get 189000 remote nets
I0420 111531.845 <ipython-input-7-52640a51556f>:40] Get 190000 remote nets
I0420 111531.968 <ipython-input-7-52640a51556f>:40] Get 191000 remote nets
I0420 111532.096 <ipython-input-7-52640a51556f>:40] Get 192000 remote nets
I0420 111534.047 <ipython-input-7-52640a51556f>:40] Get 193000 remote nets
I0420 111534.172 <ipython-input-7-52640a51556f>:40] Get 194000 remote nets
I0420 111534.297 <ipython-input-7-52640a51556f>:40] Get 195000 remote nets
I0420 111534.420 <ipython-input-7-52640a51556f>:40] Get 196000 remote nets
I0420 111534.543 <ipython-input-7-52640a51556f>:40] Get 197000 remote nets
I0420 111534.671 <ipython-input-7-52640a51556f>:40] Get 198000 remote nets
I0420 111534.794 <ipython-input-7-52640a51556f>:40] Get 199000 remote nets
I0420 111534.920 <ipython-input-7-52640a51556f>:40] Get 200000 remote nets
I0420 111535.044 <ipython-input-7-52640a51556f>:40] Get 201000 remote nets
I0420 111535.167 <ipython-input-7-52640a51556f>:40] Get 202000 remote nets
I0420 111535.291 <ipython-input-7-52640a51556f>:40] Get 203000 remote nets
I0420 111537.169 <ipython-input-7-52640a51556f>:64] Finish retrieving remote nets. Starting processing ...
I0420 111537.201 <ipython-input-7-52640a51556f>:77] Finished processing remote nets
~~~

Reviewed By: heslami

Differential Revision: D27886217

fbshipit-source-id: cdc398d04bf963d4f495adc0a91c8ceb54466e58
2021-04-20 22:32:40 -07:00
Avinash Nagaraj Bukkittu
70a09d97d1 Use nodes instead of node
Summary: `networkx 2.4+` replaced `node` attribute to `nodes` in graph object. This caused failures in `caffe2`'s' `topological_sort_traversal_longest_path` function which uses networkx library for topological sort.

Differential Revision: D27718857

fbshipit-source-id: 812fbb613946565d089cc84a20f3cdf7df046e19
2021-04-13 10:45:35 -07:00
Yukio Siraichi
93bf0ae6fc Remove legacy constructor calls from pytorch codebase. (#54142)
Summary:
Follow up from https://github.com/pytorch/pytorch/issues/53889
Related to https://github.com/pytorch/pytorch/issues/47112

Removing every occurrence of the legacy constructor call present in PyTorch at:
- _docs_
- _benchmarks_
- _test_
- _caffe2_
- _CONTRIBUTING.md_

Pull Request resolved: https://github.com/pytorch/pytorch/pull/54142

Reviewed By: ngimel

Differential Revision: D27699450

Pulled By: mruberry

fbshipit-source-id: 530aa3f5746cc8bc1407d5d51b2bbd8075e30546
2021-04-11 15:45:17 -07:00
Pritam Damania
e3691be2d9 Dump C++ stack traces of all threads for distributed tests. (#55003)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55003

Using the `caffe2::setPrintStackTracesOnFatalSignal` utility in
distributed tests to set a signal handler that dumps the state of all threads
for all processes when it receives a FATAL signal. This would help in debugging
tests further.

I had to revert all the python faulthandler code since only one signal handler
function is supported, so running python faulthandler with
`setPrintStackTracesOnFatalSignal` doesn't work.

Sample output:
```
SIGSEGV(11), PID: 3492872, Thread 3492872:
[0] ???(0x7fa7b2d1d61b) in libcaffe2_caffe2_caffe2_cpu.so
[1] ???(0x7fa7b2d1d3fb) in libcaffe2_caffe2_caffe2_cpu.so
[2] ???(0x7fa7b2d1d33d) in libcaffe2_caffe2_caffe2_cpu.so
[3] ???(0x7fa7b2d1d167) in libcaffe2_caffe2_caffe2_cpu.so
[4] ???(0x7fa7ce683150) in libpthread.so.0
[5] ???(0x7fa7be2b233c) in libcaffe2__C_impl_cuda.so
[6] ???(0x7fa7be2ce80c) in libcaffe2__C_impl_cuda.so
[7] ???(0x7fa7be2a0512) in libcaffe2__C_impl_cuda.so
[8] torch::distributed::rpc::TensorPipeAgent::send(torch::distributed::rpc::WorkerInfo const&, torch::distributed::rpc::Message&&, float, std::unordered_map<signed char, signed char, std::hash<signed char>, std::equal_to<signed char>, std::allocator<std::pair<signed char const, signed char> > > const&)+0x24f(0x7fa7be29f71f) in libcaffe2__C_impl_cuda.so
[9] torch::distributed::autograd::sendMessageWithAutograd(torch::distributed::rpc::RpcAgent&, torch::distributed::rpc::WorkerInfo const&, torch::distributed::rpc::Message&&, bool, float, bool)+0x393(0x7fa7b602b203) in libcaffe2_libtorch.so
[10] torch::distributed::rpc::pyRpcPythonUdf(torch::distributed::rpc::WorkerInfo const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::vector<at::Tensor, std::allocator<at::Tensor> >&, float, bool)+0x201(0x7fa7bd844971) in libcaffe2__C_impl_cuda.so
```
ghstack-source-id: 125630551

Test Plan: waitforbuildbot

Reviewed By: SciPioneer

Differential Revision: D27419714

fbshipit-source-id: 8aca9a14ef688004053d8798124d9c3a3fbe3489
2021-04-03 13:59:56 -07:00
Oleg Khabinov
6145ac07b5 [caffe2] Reintroduce Log1p operator (#55073)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/55073

Original diff D27422219 (d92e2520de) was reverted, reintroducing this op again.

Reviewed By: ChunliF

Differential Revision: D27473735

fbshipit-source-id: 1af0281724e9ada699ebf2045d51f65083daf5b4
2021-03-31 22:29:23 -07:00
Alexander Golynski
25e07c6e91 Revert D27422219: [caffe2] Support Log1p operator
Test Plan: revert-hammer

Differential Revision:
D27422219 (d92e2520de)

Original commit changeset: f9eba82bf09c

fbshipit-source-id: 7cd5b778ae5f296187f57b6efaa782de97a6f013
2021-03-31 06:03:45 -07:00
Oleg Khabinov
d92e2520de [caffe2] Support Log1p operator (#54968)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54968

Support Log1p operator to add feature parity with PyTorch.

NumPy doc https://numpy.org/doc/stable/reference/generated/numpy.log1p.html
PyTorch doc https://pytorch.org/docs/stable/generated/torch.log1p.html

Test Plan:
```
$ buck test mode/dev-nosan //caffe2/caffe2/python/operator_test:log1p_op_test
```

Differential Revision: D27422219

fbshipit-source-id: f9eba82bf09c1c440f11a33f8ae2bf8084609457
2021-03-30 16:38:37 -07:00
Sam Estep
5bcbbf5373 Lint trailing newlines (#54737)
Summary:
*Context:* https://github.com/pytorch/pytorch/issues/53406 added a lint for trailing whitespace at the ends of lines. However, in order to pass FB-internal lints, that PR also had to normalize the trailing newlines in four of the files it touched. This PR adds an OSS lint to normalize trailing newlines.

The changes to the following files (made in 54847d0adb9be71be4979cead3d9d4c02160e4cd) are the only manually-written parts of this PR:

- `.github/workflows/lint.yml`
- `mypy-strict.ini`
- `tools/README.md`
- `tools/test/test_trailing_newlines.py`
- `tools/trailing_newlines.py`

I would have liked to make this just a shell one-liner like the other three similar lints, but nothing I could find quite fit the bill. Specifically, all the answers I tried from the following Stack Overflow questions were far too slow (at least a minute and a half to run on this entire repository):

- [How to detect file ends in newline?](https://stackoverflow.com/q/38746)
- [How do I find files that do not end with a newline/linefeed?](https://stackoverflow.com/q/4631068)
- [How to list all files in the Git index without newline at end of file](https://stackoverflow.com/q/27624800)
- [Linux - check if there is an empty line at the end of a file [duplicate]](https://stackoverflow.com/q/34943632)
- [git ensure newline at end of each file](https://stackoverflow.com/q/57770972)

To avoid giving false positives during the few days after this PR is merged, we should probably only merge it after https://github.com/pytorch/pytorch/issues/54967.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/54737

Test Plan:
Running the shell script from the "Ensure correct trailing newlines" step in the `quick-checks` job of `.github/workflows/lint.yml` should print no output and exit in a fraction of a second with a status of 0. That was not the case prior to this PR, as shown by this failing GHA workflow run on an earlier draft of this PR:

- https://github.com/pytorch/pytorch/runs/2197446987?check_suite_focus=true

In contrast, this run (after correcting the trailing newlines in this PR) succeeded:

- https://github.com/pytorch/pytorch/pull/54737/checks?check_run_id=2197553241

To unit-test `tools/trailing_newlines.py` itself (this is run as part of our "Test tools" GitHub Actions workflow):
```
python tools/test/test_trailing_newlines.py
```

Reviewed By: malfet

Differential Revision: D27409736

Pulled By: samestep

fbshipit-source-id: 46f565227046b39f68349bbd5633105b2d2e9b19
2021-03-30 13:09:52 -07:00
Leszek Nowaczyk
1551bcc670 change logging.warn to logging.warning (#51727)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51727

logging.warn() is deprecated since Python 3.3 in favor of logging.warning()

Reviewed By: yinghai

Differential Revision: D25785598

fbshipit-source-id: 391d834fe607cd571ee147445aa0a98910535099
2021-03-29 10:42:30 -07:00
Lanlan Liu
695eef05a4 optimizer exploration - v1 and v2 + fix position_weighted optimizer + decoupled weight decay (#54042)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54042

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53881

1. Fix position_weighted optimizer: Position weighted layer uses default optimizer but is actually gradient_slice, which will cause problem if we do not handle it properly in the new optimizier. The solution is to use sparseadagrad when it is gradient_slices.
2. Optimizer implementation of v1 and v2: using 1st momentum with/without bias_correction.
3. also implemented decoupled weight decay in the new optimizer.

Test Plan:
buck test //caffe2/caffe2/fb/dper/layer_models/tests/split_1:sparse_nn_test_2 -- test_mlp_optimization

buck test //caffe2/caffe2/python:optimizer_test -- TestDecayAdagrad

buck test //caffe2/caffe2/python/operator_test:decay_adagrad_test

ctr_mbl_feed work flow: f255731660
oc work flow: f255739503

Reviewed By: 0x10cxR1

Differential Revision: D26839668

fbshipit-source-id: 2b6881c1a88540ef5766be40f5e80001257e2199
2021-03-27 23:03:29 -07:00
Rahul Arunapuram Gokul
6eaf96961d [codemod] fix tautological imports
Test Plan: waitforsandcastle

Reviewed By: koronthaly

Differential Revision: D27310963

fbshipit-source-id: 9ca0a6468e00d481b1583ab98578dc70f80bb3bf
2021-03-27 01:15:57 -07:00
Adam Simpkins
87989a6cf9 [caffe2] support serializing float data as bfloat16 (#53735)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53735

Add an option to BlobSerializationOptions to request that float data be
serialized as bfloat16.  This reduces the serialized data size at the expense
of some loss in precision.
ghstack-source-id: 124317910

Test Plan: Included a new unit test.

Reviewed By: mraway

Differential Revision: D26658205

fbshipit-source-id: 74521ed161059066355a3f208488ed01a344dbb5
2021-03-24 13:27:22 -07:00
Neha Shah
f3c00047ce Reset Optimizer counter while deserializing netWithBackwardOptions
Summary: Add ability to reset optimizer counter..

Test Plan: will wait for integration tests to run on diff.

Differential Revision: D27248286

fbshipit-source-id: a608df1bd61b64eb317c9ffd9cfdd804c5288f6d
2021-03-23 11:16:11 -07:00
Adam Simpkins
da18313de3 [caffe2] expose whether FBGEMM is available to the Python code (#54274)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/54274

Some of the Python tests need to be aware of whether or not FBGEMM is
available, so expose this setting in the pybind extension.
ghstack-source-id: 124317732

Test Plan: Will use this variable in the tests on D26658205.

Reviewed By: mraway

Differential Revision: D27171780

fbshipit-source-id: 4c94144a959bf8bf0e1553b6e029e94a91794e29
2021-03-19 12:52:14 -07:00
generatedunixname89002005307016
c4f50162be [typing] suppress errors in fbcode/caffe2 - batch 2
Test Plan: Sandcastle

Differential Revision: D27082725

fbshipit-source-id: a920b4eb62ff07d8e80fa2b9e3fd340cb44b689f
2021-03-16 16:45:41 -07:00
Chester Liu
f6df18f6ca Clean up future imports for Python 2 (#53349)
Summary:
See https://github.com/pytorch/pytorch/issues/42919

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53349

Reviewed By: malfet

Differential Revision: D27039089

Pulled By: bugra

fbshipit-source-id: 8063dc184248604506a8dbb1bcb73da8ec85bb18
2021-03-14 15:56:13 -07:00
Adam Simpkins
7e5ffbfa94 [caffe2] add a SerializationOptions field for the save operator (#53402)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53402

Add an `options` field to the `Save` operator which accepts options for how to
serialize different blobs.  At the moment this simply allows controlling the
existing `chunk_size` behavior, but in the future we can add other options,
such as the ability to control compression settings or other serialization
formats.
ghstack-source-id: 123567034

Test Plan:
Added a new test to `load_save_test.py` that passes in options and verifies
that blobs were serialized with the expected number of chunks.

  buck test caffe2/caffe2:caffe2_test_cpu \
    caffe2/caffe2/core:serialization_test \
    caffe2/caffe2/python/operator_test:load_save_test

Reviewed By: mraway

Differential Revision: D26502577

fbshipit-source-id: 6e302e530bb96990517c2e35c505db7f14a56284
2021-03-11 13:02:58 -08:00
Adam Simpkins
023948e6d7 [caffe2] update load_save_test.py to also verify the chunking behavior (#53401)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53401

This is a reland of D26641599 (cd9ac54ea7) after rebasing onto D26802576 (f595ba1bae).

Add some small utility functions to read the blob names back from the minidb
file so that we can verify how many chunks were written for each blob.
ghstack-source-id: 123567033

Test Plan: buck test caffe2/caffe2/python/operator_test:load_save_test

Reviewed By: mraway

Differential Revision: D26853942

fbshipit-source-id: 0b45078fdd279f547752c8fdb771e296374a00da
2021-03-10 15:29:36 -08:00
Giuseppe Ottaviano
0ca029b22d [caffe2] Fix DBFileReader (#53498)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53498

This code depended on `Blobs()` being returned in sorted order:

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/fbcode/caffe2/caffe2/python/db_file_reader.py?commit=472774e7f507e124392491800d9654e01269cbaf&lines=89-91

But D26504408 (69bb0e0285) changed the underlying storage to a hashmap, so now the blobs are returned in arbitrary order (Note that `Blobs()` returns also non-local blobs, and for those there was already no guarantee of ordering).

So we need to explicitly sort the result.

Test Plan:
```
$ buck test dper3/dper3/toolkit/tests:lime_test
$ buck test //dper3/dper3/toolkit/tests:model_insight_test
```
Pass after this diff.

Differential Revision: D26879502

fbshipit-source-id: d76113f8780544af1d97ec0a818fb21cc767f2bf
2021-03-08 08:34:39 -08:00
Sam Estep
8c798e0622 Forbid trailing whitespace (#53406)
Summary:
Context: https://github.com/pytorch/pytorch/pull/53299#discussion_r587882857

These are the only hand-written parts of this diff:
- the addition to `.github/workflows/lint.yml`
- the file endings changed in these four files (to appease FB-internal land-blocking lints):
  - `GLOSSARY.md`
  - `aten/src/ATen/core/op_registration/README.md`
  - `scripts/README.md`
  - `torch/csrc/jit/codegen/fuser/README.md`

The rest was generated by running this command (on macOS):
```
git grep -I -l ' $' -- . ':(exclude)**/contrib/**' ':(exclude)third_party' | xargs gsed -i 's/ *$//'
```

I looked over the auto-generated changes and didn't see anything that looked problematic.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/53406

Test Plan:
This run (after adding the lint but before removing existing trailing spaces) failed:
- https://github.com/pytorch/pytorch/runs/2043032377

This run (on the tip of this PR) succeeded:
- https://github.com/pytorch/pytorch/runs/2043296348

Reviewed By: walterddr, seemethere

Differential Revision: D26856620

Pulled By: samestep

fbshipit-source-id: 3f0de7f7c2e4b0f1c089eac9b5085a58dd7e0d97
2021-03-05 17:22:55 -08:00
Nikita Shulga
68810c1836 Delete test_rand_quantization (#53234)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53234

Test has been permanently skipped since Nov 2019, see https://github.com/pytorch/pytorch/pull/29463

Test Plan: CI

Reviewed By: mruberry

Differential Revision: D26802660

fbshipit-source-id: ea66be1afd4d7cfbe692594df5d9dd8c29bc5d23
2021-03-03 20:59:00 -08:00
Natalia Gimelshein
69b2d5c7c3 Revert D26641599: [caffe2] update load_save_test.py to also verify the chunking behavior
Test Plan: revert-hammer

Differential Revision:
D26641599 (cd9ac54ea7)

Original commit changeset: bccb0af157d8

fbshipit-source-id: 9fe35382876d19aefd16496bf8f920e12aa6f169
2021-02-25 21:30:36 -08:00
Adam Simpkins
cd9ac54ea7 [caffe2] update load_save_test.py to also verify the chunking behavior
Summary:
Add some small utility functions to read the blob names back from the minidb
file so that we can verify how many chunks were written for each blob.

Test Plan: buck test caffe2/caffe2/python/operator_test:load_save_test

Reviewed By: mraway

Differential Revision: D26641599

fbshipit-source-id: bccb0af157d85e585e95bc7be61c4584fba3cb04
2021-02-25 20:24:06 -08:00
Adam Simpkins
e2afb269b8 [caffe2] add a Python test for SaveOp chunking
Summary:
Add a test in `load_save_test.py` that passes in a chunk_size parameter,
to ensure that we exercise the logic that passes the chunk size to the C++
serialization code.

Test Plan:
Ran the tests with the vlog level set to 3 and manually verified the log
messages showed that we were serializing in the expected chunks.
There are existing C++ tests that confirm chunking behavior works as expected
in the pure C++ code.

Reviewed By: mraway

Differential Revision: D26502578

fbshipit-source-id: cd0074f2358da81c68b0fed2c2a94818d83a957d
2021-02-23 11:52:13 -08:00
Yinghai Lu
f4c33edb45 Add onnxifi interface for set/get options (#52388)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52388

Pull Request resolved: https://github.com/pytorch/glow/pull/5364

This allows us to change global variables through onnxifi calls. And add python bindings along with it. Note that we supply a dummy backend_id as it's not needed by glow due to setting being global.

#codemod

Test Plan:
```
buck test mode/dev //glow/fb/test:test_onnxifi_optionnnpi
```

Reviewed By: jfix71, khabinov

Differential Revision: D26481652

fbshipit-source-id: 19b8201c77f653cf7d93ad68760aa7fb5ec45ff4
2021-02-18 20:12:34 -08:00
Adam Simpkins
f7aa88b400 [caffe2] Explicitly define all DataTypes in python/core.py (#51768)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51768

This updates python/core.py to explicitly define all of the `DataType`
values rather than dynamically defining them at runtime from the
`caffe2_pb2` values.

This allows type checkers like Pyre and Mypy to see the members of the
`DataType` class.  Otherwise the type checkers report errors such as
`"core.DataType" has no attribute "INT64"`.

This code does keep a run-time check that all of the data types defined
by `caffe2_pb2.proto` are defined correctly in this file.  This way if
someone does add a new type to `caffe2_pb2.proto` it should be very
quickly apparent that this file needs to be updated and kept in sync.
ghstack-source-id: 121936201

Test Plan:
Confirmed that various caffe2/python tests still pass.
Verified that this allows many `pyre-fixme` comments to be removed in
downstream projects, and that Pyre is still clean for these projects.

Reviewed By: jeffdunn

Differential Revision: D26271725

Pulled By: simpkins

fbshipit-source-id: f9e95795de60aba67d7d3872d0c141ed82ba8e39
2021-02-17 20:54:17 -08:00
Adam Simpkins
b9f051db9f Add type hints for the _import_c_extension module (#51767)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51767

The `_import_c_extension.py` finds the right C extension library to use,
and then simply re-exports all of the symbols that it defines.

This adds a `_import_c_extension.pyi` file with type hints to let type
checkers like Pyre and Mypy know the names of the symbols that will be
re-exported from the C extension.

This does not define all of the symbols provided by the C extension,
but does define all of the symbols necessary to make type checkers happy
about other code in the `caffe2/python` directory.
ghstack-source-id: 121916324

Test Plan:
Was able to have Pyre successfully type check the `caffe2/python`
directory with this stub file plus a few other changes.

Confirmed that all of the dependent projects affected by this report no new
pyre issues in sandcastle.

Ran `python test/test_type_hints.py` in the PyTorch github repository and
confirmed it also passes.

Differential Revision: D26271726

Pulled By: simpkins

fbshipit-source-id: 6dbadcf02e0b2cc44a9e3cdabe9291c1250959b4
2021-02-17 17:37:47 -08:00
Junjie Yang
0dc0cb1d8d Enable FP16 sparse regularizer
Summary: Previously there was no regularizer implemented for fp16 sparse features. Add regularizer support here using the Float16SparseNormalize implemented in this stack.

Test Plan:
buck test //caffe2/caffe2/python:regularizer_test

In f248648705, we can see there is the operator `Float16SparseNormalize`.

{F356635445}

Reviewed By: bigrabithong

Differential Revision: D24042567

fbshipit-source-id: 5e0065f8c10b8748daffa8a54a6bf8f461460b18
2021-02-12 12:29:32 -08:00
Adam Simpkins
fa0a049d4e Add a make_tempdir() utility function to the TestCase base class (#51762)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51762

Update test_util.py to add a `make_tempdir()` function to the `TestCase`
class.  The main advantage of this function is that the temporary
directory will be automatically cleaned up when the test case finishes,
so that test case does not need to worry about manually cleaning up this
directory.

This also prefixes the directory name with `caffe2_test.` so that it is
more obvious where the temporary directories came from if they are ever
left behind after a crashed or killed test process.

This updates the tests in `operator_test/load_save_test.py` to use this
new function, so they no longer have to perform their own manual cleanup
in each test.

Test Plan: python caffe2/python/operator_test/load_save_test.py

Reviewed By: mraway

Differential Revision: D26271178

Pulled By: simpkins

fbshipit-source-id: 51175eefed39d65c03484482e84923e5f39a4768
2021-02-12 10:56:01 -08:00
Adam Simpkins
db6e0c7c0e Replace a platform.system() check with sys.platform (#51766)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51766

Check if we are on Windows using `sys.platform` rather than
`platform.system()`.  Even though `platform.system()` is more modern, it
has a few downsides: this performs a runtime check of the platform type,
which has non-zero overhead.  On Linux it actually executes the separate
`/bin/uname` process.  On the other hand `sys.platform` is determined
when the Python interpreter is compiled, so this is a simple hard-coded
string.

Because it is a runtime check, `platform.system()` checks also cannot be
analyzed by static type checkers like Pyre and Mypy.  These type
checkers do understand `sys.platform` checks, and can correctly avoid
complaining about code paths that use platform-specific modules and
functions.  e.g., they can avoid complaining about `ctypes.WinDLL` not
existing on Linux if its use is guarded by a `sys.platform` check.
ghstack-source-id: 121107705

Test Plan: Ran tests on Linux, and will check CI test results.

Reviewed By: mraway

Differential Revision: D26271724

Pulled By: simpkins

fbshipit-source-id: b86e427e4ceec0324464ba4bc88b95d5813172d0
2021-02-11 20:09:14 -08:00
Roy, Arindam
517185f946 test_lc_1d: Increase deadline to 5 seconds (#52013)
Summary:
Increasing the deadline as to avoid
flakiness of the test on ROCM.

Signed-off-by: Roy, Arindam <rarindam@gmail.com>

Fixes #{issue number}

Pull Request resolved: https://github.com/pytorch/pytorch/pull/52013

Reviewed By: albanD

Differential Revision: D26360209

Pulled By: mrshenli

fbshipit-source-id: 1ddc7062c5ff7c980233d22844073de9fb7dcbb3
2021-02-11 11:59:56 -08:00
Adam Simpkins
81b9aa743b [pytorch] Update caffe2/python to eliminate Pyre errors (#52083)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52083

This makes minor fixes in `caffe2/python` to address all errors currently
reported by Pyre.

I update the code to fix errors when doing so looked simple and safe,
and added `pyre-fixme` comments in other places.
ghstack-source-id: 121109695

Test Plan: Confirmed that Pyre no longer reports errors under `caffe2/python`

Differential Revision: D26272279

fbshipit-source-id: b1eb19d323b613f23280ce9c71e800e874ca1162
2021-02-11 11:04:59 -08:00
Adam Simpkins
c4eb22009e Drop some Python 2 compatibility code (#51769)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51769

Remove some Python 2 compatibility code that otherwise causes errors to
be reported from static type checkers.

Static type checkers complain that the old Python 2 modules and
functions referenced by this code do not exist.  Given that Python 2
support is entirely deprecated now we can simply remove the
compatibility code.
ghstack-source-id: 121313191

Test Plan:
Was able to get Pyre to successfully type check the `caffe2/python`
directory with this and some other changes.

Reviewed By: Tianshu-Bao

Differential Revision: D26271723

Pulled By: simpkins

fbshipit-source-id: fec8a09466be6867388832380480aafd36616aa1
2021-02-11 11:02:33 -08:00
cyy
39aa3db62b use make_shared and make_unique and clean unneeded code (#51829)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/51829

Reviewed By: izdeby

Differential Revision: D26306098

Pulled By: smessmer

fbshipit-source-id: 4f6c0469c68f044c0bfe0925fcf7b030a25d15e2
2021-02-10 21:38:43 -08:00
Andrey Malevich
7e54a64828 [C2] Add shape inference logic for ColwiseMax operator. (#51914)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51914

As desc.

Test Plan: Unit-test.

Reviewed By: intermilan

Differential Revision: D26299115

fbshipit-source-id: 9c80236f843e907476da1747dcd623c85147fa90
2021-02-09 14:12:07 -08:00
Rong Rong (AI Infra)
50c9c08203 Enable GPU/RE tags for caffe2/caffe2/python/TARGETS
Summary: Moving caffe2_core_gpu_python contbuild to use GPU/RE

Test Plan: CI

Reviewed By: malfet

Differential Revision: D26261826

fbshipit-source-id: a6f8c7bd8368c1cb69499ea0ea7d5add0956a7ad
2021-02-05 13:52:48 -08:00
pbialecki
7b85adf20f Add back pycuda.autoinit to test_pt_onnx_trt (#51106)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/51105 by adding back the `import pycuda.autoinit`.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/51106

Reviewed By: mingzhe09088

Differential Revision: D26086808

Pulled By: heitorschueroff

fbshipit-source-id: 88d98796c87a44cedaa1f6666e9f71a424293641
2021-01-27 07:10:11 -08:00
Arindam Roy
09b896261c Skip test_lc_1d for ROCM (#50964)
Summary:
The test is flaky on ROCM when deadline is set to 1 second. This is affecting builds as it is failing randomly.
Disabling for now.

Signed-off-by: Arindam Roy <rarindam@gmail.com>

Pull Request resolved: https://github.com/pytorch/pytorch/pull/50964

Reviewed By: houseroad

Differential Revision: D26049370

Pulled By: BIT-silence

fbshipit-source-id: 22337590a8896ad75f1281e56fbbeae897f5c3b2
2021-01-25 11:43:37 -08:00
Lu Fang
f32b10e564 [BE] Fix the broken test caffe2/caffe2/python:lazy_dyndep_test - test_allcompare (#50696)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/50696

set no deadline for test_alklcompare

Test Plan: buck test mode/dev //caffe2/caffe2/python:lazy_dyndep_test -- --exact 'caffe2/caffe2/python:lazy_dyndep_test - test_allcompare (caffe2.caffe2.python.lazy_dyndep_test.TestLazyDynDepAllCompare)' --run-disabled

Reviewed By: hl475

Differential Revision: D25947800

fbshipit-source-id: d2043f97128e257ef06ebca9b68262bb1c0c5e6b
2021-01-18 16:21:06 -08:00