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