【已解决】RuntimeError: “nll_loss_forward_reduce_cuda_kernel_2d_index“ not implemented for ‘Float‘

问题描述

        最近在复现Watermark-Robustness-Toolbox的时候出现了一些问题,并通过不懈的努力(不是)把这个给完美的跑起来了,这很“完美”。

        先来简单介绍一下,这是一个攻防项目,

        github链接为:https://github.com/dnn-security/Watermark-Robustness-Toolbox,

        论文链接为:https://arxiv.org/abs/2108.04974

        环境是:python==3.8,系统ubuntu20.04,其他按照readme操作就可以。

        遇到的问题包括但不仅限于no module named 'backdoor' ,

        IndexError: tensors used as indices must be long, int, byte or bool tensors

        DeprecationWarning: `np.int` is a deprecated alias for the builtin `int`. To silence this warning, use `int` by itself. Doing this will not modify any behavior and is safe.

        RuntimeError: "nll_loss_forward_reduce_cuda_kernel_2d_index" not implemented for 'Float',

        RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors after they have already been freed). Saved intermediate values of the graph are freed when you call .backward() or autograd.grad(). Specify retain_graph=True if you need to backward through the graph a second time or if you need to access saved tensors after calling backward.

        RuntimeError: Input type (long int) and bias type (float) should be the same

        ValueError: zero-size array to reduction operation minimum which has no identity

        RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

        RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [96, 96, 3, 3]] is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

        ImportError: cannot import name 'OrderedDict' from 'typing' (/home/visionx/anaconda3/envs/waterwater/lib/python3.7/typing.py)

        RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation"

        ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2u  20 Dec 2019'. See: https://github.com/urllib3/urllib3/issues/2168

        AttributeError: module 'torch.jit' has no attribute '_script_if_tracing'

        AttributeError: 'version_info' object has no attribute '__version__'

        

        PackagesNotFoundError: The following packages are not available from current channels:

  - python==3.6

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch

你可能感兴趣的:(算法)