Update README.md
Browse files
README.md
CHANGED
@@ -68,14 +68,18 @@ import torch
|
|
68 |
from llm2vec_wrapper import LLM2VecWrapper as LLM2Vec
|
69 |
|
70 |
# Load the model - latent attention weights are automatically loaded!
|
|
|
71 |
model = LLM2Vec.from_pretrained(
|
72 |
base_model_name_or_path='lukeingawesome/llm2vec4cxr',
|
73 |
-
pooling_mode="latent_attention",
|
74 |
max_length=512,
|
75 |
enable_bidirectional=True,
|
76 |
torch_dtype=torch.bfloat16,
|
77 |
use_safetensors=True,
|
78 |
-
)
|
|
|
|
|
|
|
79 |
|
80 |
# Simple text encoding
|
81 |
report = "There is a small increase in the left-sided effusion. There continues to be volume loss at both bases."
|
@@ -125,12 +129,18 @@ import torch
|
|
125 |
from llm2vec_wrapper import LLM2VecWrapper as LLM2Vec
|
126 |
|
127 |
# Load model
|
|
|
128 |
model = LLM2Vec.from_pretrained(
|
129 |
-
'lukeingawesome/llm2vec4cxr',
|
130 |
pooling_mode="latent_attention",
|
|
|
|
|
131 |
torch_dtype=torch.bfloat16,
|
132 |
use_safetensors=True,
|
133 |
-
)
|
|
|
|
|
|
|
134 |
|
135 |
# Medical text analysis
|
136 |
instruction = 'Determine the change or the status of the pleural effusion.'
|
|
|
68 |
from llm2vec_wrapper import LLM2VecWrapper as LLM2Vec
|
69 |
|
70 |
# Load the model - latent attention weights are automatically loaded!
|
71 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
72 |
model = LLM2Vec.from_pretrained(
|
73 |
base_model_name_or_path='lukeingawesome/llm2vec4cxr',
|
74 |
+
pooling_mode="latent_attention",
|
75 |
max_length=512,
|
76 |
enable_bidirectional=True,
|
77 |
torch_dtype=torch.bfloat16,
|
78 |
use_safetensors=True,
|
79 |
+
).to(device).eval()
|
80 |
+
|
81 |
+
# Configure tokenizer
|
82 |
+
model.tokenizer.padding_side = 'left'
|
83 |
|
84 |
# Simple text encoding
|
85 |
report = "There is a small increase in the left-sided effusion. There continues to be volume loss at both bases."
|
|
|
129 |
from llm2vec_wrapper import LLM2VecWrapper as LLM2Vec
|
130 |
|
131 |
# Load model
|
132 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
133 |
model = LLM2Vec.from_pretrained(
|
134 |
+
base_model_name_or_path='lukeingawesome/llm2vec4cxr',
|
135 |
pooling_mode="latent_attention",
|
136 |
+
max_length=512,
|
137 |
+
enable_bidirectional=True,
|
138 |
torch_dtype=torch.bfloat16,
|
139 |
use_safetensors=True,
|
140 |
+
).to(device).eval()
|
141 |
+
|
142 |
+
# Configure tokenizer
|
143 |
+
model.tokenizer.padding_side = 'left'
|
144 |
|
145 |
# Medical text analysis
|
146 |
instruction = 'Determine the change or the status of the pleural effusion.'
|