How to repair the dusty nv jetson-inference training?

Hi, the dusty nv inference was working fine until I install python 3.9 and other stuff… :<
I tried to rebuild it but it still give me this error, may I know how to repair it? Thx

nvidia@nvidia-desktop:~/jetson-inference/python/training/detection/ssd$ python3 train_ssd.py --dataset-type=voc --data=data/$NET --model-dir=models/$NET
Traceback (most recent call last):
  File "train_ssd.py", line 16, in <module>
    from vision.ssd.vgg_ssd import create_vgg_ssd
  File "/home/nvidia/jetson-inference/python/training/detection/ssd/vision/ssd/vgg_ssd.py", line 6, in <module>
    from .predictor import Predictor
  File "/home/nvidia/jetson-inference/python/training/detection/ssd/vision/ssd/predictor.py", line 4, in <module>
    from .data_preprocessing import PredictionTransform
  File "/home/nvidia/jetson-inference/python/training/detection/ssd/vision/ssd/data_preprocessing.py", line 1, in <module>
    from ..transforms.transforms import *
  File "/home/nvidia/jetson-inference/python/training/detection/ssd/vision/transforms/transforms.py", line 5, in <module>
    from torchvision import transforms
  File "/usr/local/lib/python3.6/dist-packages/torchvision/__init__.py", line 6, in <module>
    from torchvision import models
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/__init__.py", line 8, in <module>
    from .mobilenet import *
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/mobilenet.py", line 1, in <module>
    from .mobilenetv2 import MobileNetV2, mobilenet_v2, __all__ as mv2_all
  File "/usr/local/lib/python3.6/dist-packages/torchvision/models/mobilenetv2.py", line 8, in <module>
    from ..ops.misc import ConvNormActivation
  File "/usr/local/lib/python3.6/dist-packages/torchvision/ops/__init__.py", line 12, in <module>
    from .stochastic_depth import stochastic_depth, StochasticDepth
  File "/usr/local/lib/python3.6/dist-packages/torchvision/ops/stochastic_depth.py", line 2, in <module>
    import torch.fx
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/fx/__init__.py", line 85, in <module>
    from .graph_module import GraphModule
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/fx/graph_module.py", line 3, in <module>
    import torch.overrides
  File "/home/nvidia/.local/lib/python3.6/site-packages/torch/overrides.py", line 31, in <module>
    from torch._C import (
ImportError: cannot import name '_has_torch_function'

Hi @AK51, can you run train_ssd.py with python3.6? You might want to verify you can still run the jetson-inference container, which should include a working PyTorch environment for you to run the training in.

Hi Dusty,

Yes, if I use container method, I can train the model and get the onnx file.
I have removed the python 3.9 and tried to uninstall/reinstall the torch, is it possible to repair my python and torch?
Thx

Are your python3 and pip3 now showing as python3.6?

$ python3 --version
Python 3.6.9

$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

You should be able to install the PyTorch wheel again. If you continue having problems with your environment, it may be easier to just backup your work and reflash your SD card to start with a clean slate.

Dear Dusty,

I ended up copying my files to a new SD card. Tired of fixing it…
Thanks,