Update README.md
Browse files
README.md
CHANGED
@@ -51,10 +51,17 @@ python -m pip install -U angle-emb
|
|
51 |
```
|
52 |
|
53 |
```python
|
54 |
-
from angle_emb import AnglE
|
|
|
|
|
55 |
angle = AnglE.from_pretrained('NousResearch/Llama-2-7b-hf', pretrained_lora_path='SeanLee97/angle-llama-7b-nli-v2')
|
56 |
-
|
|
|
|
|
|
|
57 |
print('prompt:', angle.prompt)
|
|
|
|
|
58 |
vec = angle.encode({'text': 'hello world'}, to_numpy=True)
|
59 |
print(vec)
|
60 |
vecs = angle.encode([{'text': 'hello world1'}, {'text': 'hello world2'}], to_numpy=True)
|
|
|
51 |
```
|
52 |
|
53 |
```python
|
54 |
+
from angle_emb import AnglE, Prompts
|
55 |
+
|
56 |
+
# init
|
57 |
angle = AnglE.from_pretrained('NousResearch/Llama-2-7b-hf', pretrained_lora_path='SeanLee97/angle-llama-7b-nli-v2')
|
58 |
+
|
59 |
+
# set prompt
|
60 |
+
print('All predefined prompts:', Prompts.list_prompts())
|
61 |
+
angle.set_prompt(prompt=Prompts.A)
|
62 |
print('prompt:', angle.prompt)
|
63 |
+
|
64 |
+
# encode text
|
65 |
vec = angle.encode({'text': 'hello world'}, to_numpy=True)
|
66 |
print(vec)
|
67 |
vecs = angle.encode([{'text': 'hello world1'}, {'text': 'hello world2'}], to_numpy=True)
|