You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat🚀: Add the ability to download from HF by repo_id (#65)
Python Bindings Version **0.4.0**:
the `clip` model object in python_bindings now can take
`model_path_or_repo_id` paramter to download a model from HuggingFace by repo_id.
⚠️ breaking changes:
- The `model_path` parameter was renamed to `model_path_or_repo_id` for the adding support downloading by repo id
- `model_file` as an Optional parameter to specify the exact model file to download from that repo if you pass a **HF repo_id** that has more than `.bin` file , If `model_path_or_repo_id` is a HF repo id and `model_file` is not specified,
it will download the default model file (usually the file with smallest size ending with `.bin`)
✨ Features Added :
- ability to download from Hugging Face (no dependencies)
- if the file already exists (downloaded by the package) it will loaded instead of redownloading
- added some doc string to the main methods
📝file changed:
- python_bindings/clip_cpp/clip.py
- python_bindings/example_main.py
- pyproject.toml -> bump version 0.4.0
- update the python_bindings/README.md
- update the ./README.md
Copy file name to clipboardExpand all lines: examples/python_bindings/README.md
+82-37Lines changed: 82 additions & 37 deletions
Original file line number
Diff line number
Diff line change
@@ -5,12 +5,16 @@ This package provides basic Python bindings for [clip.cpp](https://github.com/mo
5
5
It requires no third-party libraries and no big dependencies such as PyTorch, TensorFlow, Numpy, ONNX etc.
6
6
7
7
## Install
8
+
8
9
If you are on a X64 Linux distribution, you can simply Pip-install it:
9
10
10
11
```sh
11
12
pip install clip_cpp
12
13
```
13
14
15
+
> Colab Notebook available for quick experiment :
16
+
>
17
+
> <ahref="https://colab.research.google.com/github/Yossef-Dawoad/clip.cpp/blob/add_colab_notebook_example/examples/python_bindings/notebooks/clipcpp_demo.ipynb"target="_blank"><imgsrc="https://colab.research.google.com/assets/colab-badge.svg"alt="Open In Colab"/></a>
14
18
15
19
If you are on another operating system or architecture,
16
20
or if you want to make use of support for instruction sets other than AVX2 (e.g., AVX512),
@@ -20,19 +24,59 @@ Se [clip.cpp](https://github.com/monatis/clip.cpp) for more info.
20
24
All you need to do is to compile with the `-DBUILD_SHARED_LIBS=ON` option and copy `libclip.so` to `examples/python_bindings/clip_cpp`.
21
25
22
26
## Usage
27
+
28
+
```python
29
+
from clip_cpp import Clip
30
+
31
+
## you can either pass repo_id or .bin file
32
+
## incase you pass repo_id and it has more than .bin file
33
+
## it's recommended to spacify which file to download with `model_file`
The `Clip` class provides a Python interface to clip.cpp, allowing you to perform various tasks such as text and image encoding, similarity scoring, and text-image comparison. Below are the constructor and public methods of the `Clip` class:
0 commit comments