mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 02:38:10 +00:00
Fix the pyo3 build for macos. (#324)
* Fix the pyo3 build for macos. * rustfmt fix.
This commit is contained in:
@ -19,6 +19,9 @@ candle = { path = "../candle-core", version = "0.1.0", package = "candle-core" }
|
||||
pyo3 = { version = "0.19.0", features = ["extension-module"] }
|
||||
half = { workspace = true }
|
||||
|
||||
[build-dependencies]
|
||||
pyo3-build-config = "0.19"
|
||||
|
||||
[features]
|
||||
default = []
|
||||
cuda = ["candle/cuda"]
|
||||
|
@ -1,5 +1,11 @@
|
||||
From the top level directory run:
|
||||
From the top level directory run the following for linux.
|
||||
```
|
||||
cargo build --release --package candle-pyo3 && cp -f ./target/release/libcandle.so candle.so
|
||||
cargo build --profile=release-with-debug --package candle-pyo3 && cp -f ./target/release-with-debug/libcandle.so candle.so
|
||||
PYTHONPATH=. python3 candle-pyo3/test.py
|
||||
```bash
|
||||
|
||||
Or for macOS users:
|
||||
```bash
|
||||
cargo build --profile=release-with-debug --package candle-pyo3 && cp -f ./target/release-with-debug/libcandle.dylib candle.so
|
||||
PYTHONPATH=. python3 candle-pyo3/test.py
|
||||
```
|
||||
|
3
candle-pyo3/build.rs
Normal file
3
candle-pyo3/build.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
pyo3_build_config::add_extension_module_link_args();
|
||||
}
|
Reference in New Issue
Block a user