candle/candle-pyo3
Lukas Kreussel c05c0a8213
PyO3: Add `equal` and `__richcmp__` to `candle.Tensor` (#1099)
* add `equal` to tensor

* add `__richcmp__` support  for tensors and scalars

* typo

* more typos

* Add `abs` + `candle.testing`

* remove duplicated `broadcast_shape_binary_op`

* `candle.i16` => `candle.i64`

* `tensor.nelements` -> `tensor.nelement`

* Cleanup `abs`
2023-10-30 15:17:28 +00:00
..
_additional_typing PyO3: Add `equal` and `__richcmp__` to `candle.Tensor` (#1099) 2023-10-30 15:17:28 +00:00
py_src/candle PyO3: Add `equal` and `__richcmp__` to `candle.Tensor` (#1099) 2023-10-30 15:17:28 +00:00
src PyO3: Add `equal` and `__richcmp__` to `candle.Tensor` (#1099) 2023-10-30 15:17:28 +00:00
tests PyO3: Add `equal` and `__richcmp__` to `candle.Tensor` (#1099) 2023-10-30 15:17:28 +00:00
.gitignore Make the Python Wrapper more Hackable and simplify Quantization (#1010) 2023-10-06 19:01:07 +01:00
Cargo.toml PyO3: Better shape handling (#1143) 2023-10-29 15:41:44 +00:00
README.md Generate `*.pyi` stubs for PyO3 wrapper (#870) 2023-09-16 17:23:38 +01:00
build.rs Fix the pyo3 build for macos. (#324) 2023-08-05 14:53:57 +01:00
e5.py Use an attention mask in the e5 padding case. (#1085) 2023-10-13 18:53:40 +01:00
pyproject.toml Make the Python Wrapper more Hackable and simplify Quantization (#1010) 2023-10-06 19:01:07 +01:00
quant-llama.py Make the Python Wrapper more Hackable and simplify Quantization (#1010) 2023-10-06 19:01:07 +01:00
stub.py PyO3: Better shape handling (#1143) 2023-10-29 15:41:44 +00:00
test.py Add support for accelerate in the pyo3 bindings. (#1167) 2023-10-24 06:34:37 +01:00
test_pytorch.py convert pytorch's tensor in Python API (#1172) 2023-10-25 19:39:14 +01:00

README.md

Installation

From the candle-pyo3 directory, enable a virtual env where you will want the candle package to be installed then run.

maturin develop -r 
python test.py

Generating Stub Files for Type Hinting

For type hinting support, the candle-pyo3 package requires *.pyi files. You can automatically generate these files using the stub.py script.

Steps:

  1. Install the package using maturin.
  2. Generate the stub files by running:
    python stub.py
    

Validation:

To ensure that the stub files match the current implementation, execute:

python stub.py --check