Update README.md
Browse files
README.md
CHANGED
@@ -89,4 +89,14 @@ sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask']
|
|
89 |
|
90 |
print("Sentence embeddings:")
|
91 |
print(sentence_embeddings)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
```
|
|
|
89 |
|
90 |
print("Sentence embeddings:")
|
91 |
print(sentence_embeddings)
|
92 |
+
```
|
93 |
+
|
94 |
+
### How to enable Multi-GPU
|
95 |
+
```python
|
96 |
+
from transformers import AutoModel
|
97 |
+
from torch.nn import DataParallel
|
98 |
+
|
99 |
+
model = AutoModel.from_pretrained("ssmits/Qwen2-7B-Instruct-embed-base")
|
100 |
+
for module_key, module in model._modules.items():
|
101 |
+
model._modules[module_key] = DataParallel(module)
|
102 |
```
|