Update README.md
Browse files
README.md
CHANGED
|
@@ -1,11 +1,23 @@
|
|
| 1 |
-
# BioLLM2Vec
|
| 2 |
-
|
| 3 |
-
This repository contains the model weights for the sentence-to-vector embedding model used in BioLitGPT. The main github repository is at https://github.com/jeffreyzhang92/BioLitGPT.
|
| 4 |
-
|
| 5 |
-
Basic usage:
|
| 6 |
-
|
| 7 |
-
```
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
```
|
|
|
|
| 1 |
+
# BioLLM2Vec
|
| 2 |
+
|
| 3 |
+
This repository contains the model weights for the sentence-to-vector embedding model used in BioLitGPT. The main github repository is at https://github.com/jeffreyzhang92/BioLitGPT.
|
| 4 |
+
|
| 5 |
+
Basic usage:
|
| 6 |
+
|
| 7 |
+
```
|
| 8 |
+
import torch
|
| 9 |
+
from llm2vec import LLM2Vec
|
| 10 |
+
model = LLM2Vec.from_pretrained("McGill-NLP/LLM2Vec-Meta-Llama-3-8B-Instruct-mntp",
|
| 11 |
+
peft_model_name_or_path="YBXL/BioLLM2Vec",
|
| 12 |
+
device_map="cuda" if torch.cuda.is_available() else "cpu",
|
| 13 |
+
torch_dtype=torch.bfloat16,
|
| 14 |
+
revision="main"
|
| 15 |
+
)
|
| 16 |
+
embedding = model.encode("This is a sentence")
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
You will also require access to the Meta LLaMA repository to load the model: https://huggingface.co/meta-llama
|
| 20 |
+
```
|
| 21 |
+
from huggingface_hub import login
|
| 22 |
+
login("insert_hf_access_token_here")
|
| 23 |
```
|