Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfeil authored Oct 12, 2023
1 parent b246193 commit ab021fc
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ Connecting Transformers on HuggingfaceHub with Ctranslate2 - a small utility for

--------
## Usage:

### PYPI Install
```bash
pip install hf-hub-ctranslate2
```
--------

## Decoder-only Transformer:
```python
# download ctranslate.Generator repos from Huggingface Hub (GPT-J, ..)
Expand Down Expand Up @@ -66,6 +73,9 @@ outputs = model.generate(
)
```
## Encoder-only Sentence Transformers
Feel free to try out a new repo, using CTranslate2 for vector-embeddings:
https://github.com/michaelfeil/infinity

```python
from hf_hub_ctranslate2 import CT2SentenceTransformer
model_name_pytorch = "intfloat/e5-small"
Expand All @@ -82,7 +92,7 @@ print(embeddings.shape, embeddings)
scores = (embeddings @ embeddings.T) * 100
```

## Encoder-only
## Encoder-only -> no longer recommended
```python
from hf_hub_ctranslate2 import EncoderCT2fromHfHub
model_name = "michaelfeil/ct2fast-e5-small"
Expand All @@ -98,12 +108,6 @@ outputs = model.generate(
)
```

--------
## PYPI Install
```bash
pip install hf-hub-ctranslate2
```
--------



Expand Down

0 comments on commit ab021fc

Please sign in to comment.