Comments (4)
For the first error ("Could not find compatible version") you probably point cmake to a libtorch version that is not yet currently compatible (i.e. tested) with the tutorials.
If you want to try a later libtorch version, you can modify the root-level CMakeLists.txt file to allow the later version.
For the second error: As mentioned in the Readme, if you chose to let the script create the scriptmodule files automatically, you must have python3 installed and Pytorch and torchvision (python versions!) must be importable by the python interpreter.
Hope this clears some things up for you!
from pytorch-cpp.
Thanks for your reply.
The first problem Could not find compatible Torch version (> = 1.12.0, < = 2.1.1)
: I use the cuda version of libtorch automatically downloaded so it has been solved .
The second question No module named 'torch'
: I found out that it was because CMake did not detect python in the conda virtual environment, but used the python that came with the system, so I change the code in CMakeLists.txt:
set if(CREATE_SCRIPTMODULES)
find_package(Python3 COMPONENTS Interpreter REQUIRED)
endif()
to
if(CREATE_SCRIPTMODULES)
set(Python3_EXECUTABLE "/home/olioolii/miniconda3/envs/pytorch/bin/python3")
endif()
Then everything works well.
Finally, thank you for your contribution to this project!
from pytorch-cpp.
Great! In this case you could probably even do:
cmake -B build ... -D CREATE_SCRIPTMODULES=ON -D Python3_EXECUTABLE=<path/to/python>
without modifying the cmake file.
from pytorch-cpp.
Got it! Thanks!
from pytorch-cpp.
Related Issues (20)
- Compile failure HOT 2
- [feature] Upgrade libtorch to v1.12.0
- Human detection tutorial please. HOT 2
- [feature] Dockerfile to support CUDA-version pytorch-cpp HOT 2
- Update CI GIthub Actions runner settings
- Image captioning runs only on CPU [bug] HOT 2
- [feature] Upgrade to libtorch v1.13.1
- [feature] Upgrade to libtorch v2.0.0
- Can c++ impls of torch::nn::Module be bound back to python? HOT 1
- binary '<<': no operator found which takes a right-hand operand of type 'const Value' HOT 3
- How to initialize tensor from gpu memory HOT 1
- Saving and loading models HOT 1
- Set CUDA as default device in torch C++ HOT 2
- CUDA configuration with libtorch C++ and training time control for CNN model HOT 1
- omp_set_num_threads should only be called in serial regions HOT 1
- Loading Keypoint RCNN on C++ HOT 2
- External stb image header no longer available [bug]
- [feature] Upgrade libtorch to v2.1.1
- [feature] pytorch DDP with C++ (utilizing CUDA / NCCL)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-cpp.