SeanLee97 commited on
Commit
791554a
1 Parent(s): e4b3365
Files changed (1) hide show
  1. README.md +38 -1
README.md CHANGED
@@ -2613,7 +2613,44 @@ Our model is built upon the powerful BGE-Large, enhanced with [AnglE optimizing]
2613
 
2614
  Welcome to follow us on GitHub: https://github.com/SeanLee97/AnglE.
2615
 
2616
- If you use our pre-trained models, please support us by citing our work:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2617
 
2618
  ```
2619
  @article{li2023angle,
 
2613
 
2614
  Welcome to follow us on GitHub: https://github.com/SeanLee97/AnglE.
2615
 
2616
+ # Usage
2617
+
2618
+
2619
+ ```bash
2620
+ python -m pip install -U angle-emb
2621
+ ```
2622
+
2623
+ ### UAE
2624
+
2625
+ 1) Non-Retrieval
2626
+
2627
+ ```python
2628
+ from angle_emb import AnglE
2629
+
2630
+ angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
2631
+ vec = angle.encode('hello world', to_numpy=True)
2632
+ print(vec)
2633
+ vecs = angle.encode(['hello world1', 'hello world2'], to_numpy=True)
2634
+ print(vecs)
2635
+ ```
2636
+
2637
+ 2) Retrieval
2638
+
2639
+ For retrieval purposes, please use the prompt `Prompts.C`.
2640
+
2641
+ ```python
2642
+ from angle_emb import AnglE, Prompts
2643
+
2644
+ angle = AnglE.from_pretrained('WhereIsAI/UAE-Large-V1', pooling_strategy='cls').cuda()
2645
+ angle.set_prompt(prompt=Prompts.C)
2646
+ vec = angle.encode({'text': 'hello world'}, to_numpy=True)
2647
+ print(vec)
2648
+ vecs = angle.encode([{'text': 'hello world1', 'text': 'hello world2'}], to_numpy=True)
2649
+ print(vecs)
2650
+ ```
2651
+
2652
+ # Citation
2653
+ If you use our pre-trained models, welcome to support us by citing our work:
2654
 
2655
  ```
2656
  @article{li2023angle,