-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string<char>, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string<char>, at::Tensor>&’ #1268
Comments
emmmm...... I have tried torch-1.8.2 and complied apex successfully. $ conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch-lts
... Then compile $ pip list apex 0.1 |
same errors with pytorch 1.10.2 pre-built and python 3.9. |
I have the same error installing apex. Did you find any resolutions? |
same error for me |
@Coldog2333 use high version gcc will fix this problem. I can't remember the exact version, but you might want to try 7.5 . |
Thank you for your comment. |
@cicirori is right. Resetting to |
Did you solve the import problem? |
Got lots of 'invalid static_cast' error when compiling with CUDA 10.2 & torch 1.10.1
`
...
[2/2] /usr/local/cuda-10.2/bin/nvcc -I/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include -I/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/TH -I/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.2/include -I/home/user/.conda/envs/conda-env-py37/include/python3.7m -c -c /home/user/Projects/apex/csrc/mlp_cuda.cu -o /home/user/Projects/apex/build/temp.linux-x86_64-3.7/csrc/mlp_cuda.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DVERSION_GE_1_1 -DVERSION_GE_1_3 -DVERSION_GE_1_5 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="gcc"' '-DPYBIND11_STDLIB="libstdcpp"' '-DPYBIND11_BUILD_ABI="cxxabi1011"' -DTORCH_EXTENSION_NAME=mlp_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_52,code=compute_52 -gencode=arch=compute_52,code=sm_52 -std=c++14
FAILED: /home/user/Projects/apex/build/temp.linux-x86_64-3.7/csrc/mlp_cuda.o
/usr/local/cuda-10.2/bin/nvcc -I/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include -I/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/TH -I/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/THC -I/usr/local/cuda-10.2/include -I/home/user/.conda/envs/conda-env-py37/include/python3.7m -c -c /home/user/Projects/apex/csrc/mlp_cuda.cu -o /home/user/Projects/apex/build/temp.linux-x86_64-3.7/csrc/mlp_cuda.o -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -O3 -DVERSION_GE_1_1 -DVERSION_GE_1_3 -DVERSION_GE_1_5 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=mlp_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_52,code=compute_52 -gencode=arch=compute_52,code=sm_52 -std=c++14
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::CrossMapLRN2dImpl]’:
/tmp/tmpxft_000064a8_00000000-5_mlp_cuda.cudafe1.stub.c:97:27: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::EmbeddingBagImpl]’:
/tmp/tmpxft_000064a8_00000000-5_mlp_cuda.cudafe1.stub.c:97:27: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::EmbeddingImpl]’:
/tmp/tmpxft_000064a8_00000000-5_mlp_cuda.cudafe1.stub.c:97:27: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ParameterDictImpl]’:
/tmp/tmpxft_000064a8_00000000-5_mlp_cuda.cudafe1.stub.c:97:27: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::SequentialImpl]’:
/tmp/tmpxft_000064a8_00000000-5_mlp_cuda.cudafe1.stub.c:97:27: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ModuleListImpl]’:
/tmp/tmpxft_000064a8_00000000-5_mlp_cuda.cudafe1.stub.c:97:27: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ModuleDictImpl]’:
/tmp/tmpxft_000064a8_00000000-5_mlp_cuda.cudafe1.stub.c:97:27: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::TransformerDecoderImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::TransformerEncoderImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::TransformerDecoderLayerImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::TransformerEncoderLayerImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::GroupNormImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LocalResponseNormImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LayerNormImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::MultiheadAttentionImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::ThresholdImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LogSoftmaxImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::SoftminImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::SoftmaxImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::GRUCellImpl]’:
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/optim/sgd.h:49:48: required from here
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:57:59: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, at::Tensor>’ to type ‘torch::OrderedDict<std::basic_string, at::Tensor>&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:69:61: error: invalid static_cast from type ‘const torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >’ to type ‘torch::OrderedDict<std::basic_string, std::shared_ptrtorch::nn::Module >&’
/home/user/.conda/envs/conda-env-py37/lib/python3.7/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h: In instantiation of ‘std::shared_ptrtorch::nn::Module torch::nn::Cloneable::clone(const c10::optionalc10::Device&) const [with Derived = torch::nn::LSTMCellImpl]’:
...
...
...
RuntimeError: Error compiling objects for extension
Running setup.py install for apex ... error
ERROR: Command errored out with exit status 1: /home/user/.conda/envs/conda-env-py37/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/home/user/Projects/apex/setup.py'"'"'; file='"'"'/home/user/Projects/apex/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' --cpp_ext --cuda_ext install --record /tmp/pip-record-czubbz97/install-record.txt --single-version-externally-managed --compile --install-headers /home/user/.conda/envs/conda-env-py37/include/python3.7m/apex Check the logs for full command output.
`
My ENV:
$ pip3 install torch torchvision
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting torch
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/20/8a/c1e970cf64a1fa105bc5064b353ecabe77974b69029a80d04580fee38d5f/torch-1.10.1-cp37-cp37m-manylinux1_x86_64.whl (881.9 MB)
|████████████████████████████████| 881.9 MB 15 kB/s
Collecting torchvision
Downloading
...
...
Installing collected packages: typing-extensions, torch, pillow, numpy, torchvision
Successfully installed numpy-1.21.5 pillow-9.0.0 torch-1.10.1 torchvision-0.11.2 typing-extensions-4.0.1
$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
The text was updated successfully, but these errors were encountered: