Metadata-Version: 2.4
Name: hf-processors-rs
Version: 0.1.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Multimedia :: Graphics
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Dist: numpy>=1.21
Requires-Dist: pillow ; extra == 'pil'
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pillow ; extra == 'test'
Provides-Extra: pil
Provides-Extra: test
License-File: licenses/LICENSE-APACHE
License-File: licenses/LICENSE-MIT
License-File: licenses/THIRD_PARTY_NOTICES.md
License-File: licenses/libjpeg-turbo-LICENSE.md
License-File: licenses/libjpeg-turbo-README.ijg
License-File: licenses/rust-dependencies.txt
Summary: Hugging Face transformers image/audio preprocessors (CLIP, SigLIP, ViT, ConvNeXt, BLIP, Qwen2-VL, Whisper) reproduced bit-exactly in Rust
Keywords: huggingface,transformers,preprocessing,clip,siglip,qwen2-vl,whisper
Author: Dat-cool-repo contributors
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.9
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/Dat-cool-repo/hf-processors-rs
Project-URL: Issues, https://github.com/Dat-cool-repo/hf-processors-rs/issues
Project-URL: Repository, https://github.com/Dat-cool-repo/hf-processors-rs

# hf-processors-rs (Python)

Hugging Face `transformers` image and audio preprocessors reproduced **bit-exactly** in Rust:
CLIP, ViT, SigLIP, ConvNeXt, BLIP, Qwen2-VL / Qwen2.5-VL / Qwen3-VL and Whisper. Both
transformers v5 backends are covered (`backend="torchvision"`, the default, and `backend="pil"`),
and decoding plus preprocessing run in Rust with the GIL released, in parallel over the batch.

**Status: alpha.** See the [project README](https://github.com/Dat-cool-repo/hf-processors-rs)
for the exactness tables, tests and benchmarks.

```bash
pip install hf-processors-rs
```

```python
import hf_processors_rs as hpr

proc = hpr.AutoImageProcessor.from_pretrained("openai/clip-vit-base-patch32")
pixel_values = proc(["cat.jpg", "dog.png"])            # numpy float32 (2, 3, 224, 224)

qwen = hpr.AutoImageProcessor.from_pretrained("Qwen/Qwen2-VL-2B-Instruct", backend="pil")
out = qwen("cat.jpg")                                 # {"pixel_values", "image_grid_thw"}

fe = hpr.AutoFeatureExtractor.from_pretrained("openai/whisper-tiny")
feats = fe(audio, sampling_rate=16000)["input_features"]   # (1, 80, 3000)
```

Inputs can be PIL images, uint8 numpy arrays, torch uint8 tensors, file paths or encoded
bytes. Paths and bytes are checked against a pixel limit before decoding, with Pillow's
`Image.MAX_IMAGE_PIXELS` semantics (`hpr.set_max_image_pixels(n)` / `None`;
`DecompressionBombWarning` above the limit, `DecompressionBombError` above twice the limit).

## License

`MIT OR Apache-2.0`. The compiled extension statically links libjpeg-turbo (IJG and BSD-3-Clause
licenses) and permissively licensed Rust crates; all their license texts are included in the
distribution (`.dist-info/licenses/`). This software is based in part on the work of the
Independent JPEG Group.

