Skip to content

Commit 626993b

Browse files
committed
[init]
0 parents  commit 626993b

File tree

6 files changed

+413
-0
lines changed

6 files changed

+413
-0
lines changed

.cargo/config.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[env]
2+
LIBTORCH = { value = "torch" , relative = true }
3+
DYLD_LIBRARY_PATH = { value = "torch/lib" , relative = true }

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
/torch
3+
/.idea/

Cargo.lock

+359
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[package]
2+
name = "tch-m1"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7+
8+
[dependencies]
9+
tch = { version = "0.7.2", default-features = false }

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Demo of tch-rs on M1
2+
3+
## Steps
4+
5+
- install miniforge with homebrew -- See https://naolin.medium.com/conda-on-m1-mac-with-miniforge-bbc4e3924f2b
6+
- create a new conda environment: `conda create -n tch-rs-demo python=3.8`
7+
- activate the new environment: `conda activate tch-rs-demo`
8+
- install pytorch: `conda install pytorch`
9+
- create a symlink in this repo: `ln -s /opt/homebrew/Caskroom/miniforge/base/envs/tch-rs-demo/lib/python3.8/site-packages/torch/ torch`
10+
- run: `cargo run`
11+
12+
## Details
13+
14+
- .cargo/config.toml is used to set envs for torch-sys to find the library and headers.
15+
- Tensor::print() segfaults.
16+

0 commit comments

Comments
 (0)