Update modeling_gzipembed.py
Browse files- modeling_gzipembed.py +3 -1
modeling_gzipembed.py
CHANGED
|
@@ -50,8 +50,10 @@ class GZIPEmbeddingModel(PreTrainedModel):
|
|
| 50 |
Returns:
|
| 51 |
`List[np.ndarray]` or `List[tensor]`: List of embeddings for the given sentences
|
| 52 |
"""
|
|
|
|
| 53 |
x = self.forward(sentences, num_procs=batch_size, return_tensor=False)
|
| 54 |
-
return [torch.tensor(i) for i in x]
|
|
|
|
| 55 |
|
| 56 |
def normalize(self, x):
|
| 57 |
x = ''.join([char for char in x.lower() if char in "abcdefghijklmnopqrstuvwxyz "])
|
|
|
|
| 50 |
Returns:
|
| 51 |
`List[np.ndarray]` or `List[tensor]`: List of embeddings for the given sentences
|
| 52 |
"""
|
| 53 |
+
import numpy as np
|
| 54 |
x = self.forward(sentences, num_procs=batch_size, return_tensor=False)
|
| 55 |
+
# return [torch.tensor(i) for i in x]
|
| 56 |
+
return [np.array(i) for i in x] # test?
|
| 57 |
|
| 58 |
def normalize(self, x):
|
| 59 |
x = ''.join([char for char in x.lower() if char in "abcdefghijklmnopqrstuvwxyz "])
|