jetsonでpython2.x系のtorch2trtをimportしようとするとエラー(TypeError: can't pickle method_descriptor objects)

（同じ悩みで困っている方がいるかもしれないので記載）

jetsonでpython2.x系のtorch2trtをimportしようとするとエラー

```
$ python -c "from torch2trt import TRTModule"
WARNING: TensorRT Python 2 support is deprecated, and will be dropped in a future version!
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "build/bdist.linux-aarch64/egg/torch2trt/__init__.py", line 2, in <module>
  File "build/bdist.linux-aarch64/egg/torch2trt/converters/__init__.py", line 3, in <module>
  File "build/bdist.linux-aarch64/egg/torch2trt/converters/dummy_converters.py", line 29, in <module>
  File "build/bdist.linux-aarch64/egg/torch2trt/torch2trt.py", line 589, in tensorrt_converter
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/copy.py", line 182, in deepcopy
    rv = reductor(2)
TypeError: can't pickle method_descriptor objects
```

torch2trtの最近の変更が影響している可能性がある（git logをみると11月〜12月で３件ほどのcommitがはいっている）

```
$ cd ~/torch2trt
$ git log
commit 2b1827eeb153761e773b0770b56364cda564a362 (HEAD -> master, origin/master, origin/HEAD)
Author: John <jwelsh@nvidia.com>
Date:   Tue Dec 1 16:26:23 2020 -0800

    custom converter to changelog (#462)

commit 81024ccd7c90412fa8320eb991f3454f0be3d7a0
Author: John <jwelsh@nvidia.com>
Date:   Tue Dec 1 16:19:00 2020 -0800

    allow direct method setting to support custom layers (#460)

commit adccbf14c77ba73dd064653c0461739e3b2191ac
Author: John <jwelsh@nvidia.com>
Date:   Tue Nov 17 15:06:09 2020 -0800

    Koenvandesande remove duplicate filenames (#448)
    
    * Remove duplicate filenames which do not work on Windows by merging files
    
    * Fix
    
    * relu tests
    
    Co-authored-by: Koen van de Sande <koen@keplervision.eu>

commit d1fa6f9f20c6c4c57a9486680ab38c45d0d94ec3
Author: John <jwelsh@nvidia.com>
Date:   Wed Nov 4 13:45:36 2020 -0500
```

Nov 4の時点に戻すと発生しなくなった。戻し方は以下の通り。

```
git checkout d1fa6f9f20c6c4c57a9486680ab38c45d0d94ec3
git branch
sudo python setup.py install
sudo python3 setup.py install
```

```
python -c "from torch2trt import TRTModule"
```

おそらく、`commit 81024ccd7c90412fa8320eb991f3454f0be3d7a0`の以下の辺りが影響していると思われる。

```
def tensorrt_converter(method, is_real=True, enabled=True, imports=[]):
    
    if isinstance(method, str):
        module, module_name, qual_name = get_module_qualname(method)
    else:
        module, module_name, qual_name = importlib.import_module(method.__module__), method.__module__, method.__qualname__
        
    method_impl = eval('copy.deepcopy(module.%s)' % qual_name)
    
    def register_converter(converter):
        CONVERTERS[method] = {
            "converter": converter, 
            "is_real": is_real, 
            "module": module,
            "module_name": module_name,
            "qual_name": qual_name,
            "method_str": module_name + '.' + qual_name,
            "method_impl": method_impl
        }
        return converter

    def pass_converter(converter):
        return converter

    if enabled:
        return register_converter
    else:
        return pass_converter

    return register_converter
```

すぐに解決は難しいと思うので、とりあえず上記の通り動いてたバージョンに戻すと良いかもしれない。
githubの関連issueは[こちら](https://github.com/NVIDIA-AI-IOT/torch2trt/issues/467)

# 参考
[from torch2trt import TRTModule with python2.x version return error (TypeError: can't pickle method_descriptor objects)](https://github.com/NVIDIA-AI-IOT/torch2trt/issues/467)
[[BUG] multi_gpu_model models fail when being invoked with get_config() => TypeError: can't pickle _cffi_backend.CTypeDescr objects](https://github.com/keras-team/keras/issues/8354)