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