Comments (8)
Glad that it worked, I've actually already switched the github code to use cc
by default (this actually was the case a couple days ago) and have the possibility to use cmake
via some environment variable.
from tch-rs.
I'm working on improving the build.rs
. I'll send it today.
from tch-rs.
Hi,
Thanks for the feedback, yes CI would certainly be a good thing to add.
Re your compilation error, I haven't encountered it despite trying the pre-built cpu version 1.0.0 and 1.0.1 (as per build-version).
Is it on linux or on another platform ? I only tried linux on my side.
from tch-rs.
Yes, it was on Ubuntu 14.04 with cmake 3.2 and Rust nightly 1.34
from tch-rs.
Interesting, googling a bit the closest I found to your error is this issue. Not sure whether it's related but if it's the case updating to cmake 3.5.1 may fix the issue.
Alternatively you can try using the cc
crate rather than cmake
to compile. This can be done by replacing build.rs
with the following. If this works for you we can either switching to cc
or having an environment variable to decide between cc
and cmake
.
use std::env;
use std::path::PathBuf;
extern crate cc;
fn main() {
let libtorch = env::var("LIBTORCH").expect("LIBTORCH not defined");
let libtorch = PathBuf::from(libtorch);
let libtorch_lib = libtorch.join("lib").into_os_string().into_string().unwrap();
println!("cargo:rustc-link-search=native={}", libtorch_lib);
println!("cargo:rustc-link-lib=c10");
println!("cargo:rustc-link-lib=caffe2");
println!("cargo:rustc-link-lib=torch");
cc::Build::new()
.cpp(true)
.include(libtorch.join("include"))
.include(libtorch.join("include/torch/csrc/api/include"))
.flag(&format!("-Wl,-rpath={}", libtorch_lib))
.flag("-std=c++11")
.flag("-D_GLIBCXX_USE_CXX11_ABI=0")
.file("libtch/torch_api.cpp")
.warnings(false)
.compile("libtorch");
}
You will also have to add the following line to Cargo.toml
build-dependencies section:
cc = "1.0"
from tch-rs.
cc
worked! also upgraded my cmake
to the latest v3.14 and it worked as well.
I think, cc
is more self-contained and can have it as fallback.
from tch-rs.
Cool!
Note that I changed it quite a bit lately: there is now a separate torch-sys
crate (in the same repo). When the LIBTORCH
variable is not set the build script will automatically download the binary version of libtorch - this is similar to what the tensorflow crate does for tf. The nice thing is that if you're happy with running the cpu version of libtorch, there is no setup needed anymore.
from tch-rs.
Closing this now, thanks for your help on this and feel free to re-open if there are further issues!
from tch-rs.
Related Issues (20)
- grads become zeros after a short period of training on metal backend
- Can we `.set_retains_grad(true)` ?
- model in rust, optimizer.step in python
- Preserving gradients with copy()? HOT 2
- Can't compile or test tch-rs HOT 3
- What if I am not using `pyo3==0.18.3`? HOT 4
- Error when building burn on Windows when upgrading to tch 0.16 HOT 4
- Can you help me setting environment variables? HOT 2
- la HOT 1
- Publish pyo3-tch 0.16 HOT 3
- getting gradient for intermediate tensors
- Unable to compile on arch-linux HOT 2
- torch download and build location
- Can't compile static HOT 3
- Rust-bert does not work with Debian 12 errors HOT 1
- Any ideas? HOT 4
- M2 mac os throw error: "found architecture 'x86_64', required architecture 'arm64'" HOT 2
- error adding symbols: DSO missing from command line HOT 2
- Support of X86 quantization engine as in pytorch?
- Is it possible to access device properties with `tch-rs`, like in `torch.cuda.get_device_properties`?
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 tch-rs.