Swin Transformer はセマンティック セグメンテーションを実行し、Ubuntu システムは RuntimeError を解決します: 勾配計算に必要な変数の 1 つ

1. 問題の説明

        最近, Swin Transformer を使用してセマンティック セグメンテーション タスクを実行しています. 基本的な構成環境は GitHub の基本的なインストール手順を参照しています. 主な問題は環境の構成です. mmcv の構成要件は 1.4 より高くすることはできません. 0. したがって、トレーニング中. py ファイルがトレーニングのために実行されている場合、エラーが報告されます: RuntimeError: one of the variables needed for gradient conversion has been modified by an inplace operation: [torch.cuda.FloatTensor [2, 512, 32, 32]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. ヒント: torch.autograd.set_detect_anomaly(True) を使用して、勾配の計算に失敗した操作を見つけるために異常検出を有効にします。

2. ソリューションと構成シート

        1、python=3.8
        2、conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
        3、pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.8.0/index.html

3. まとめ

        これは環境問題です. これは私が 1 日無駄にしてまとめた構成リストです. ご不明な点がございましたら, プライベート メッセージを送信してください

おすすめ

転載: blog.csdn.net/hacker_NO_007/article/details/127503640