Update app.py
Browse files
app.py
CHANGED
|
@@ -18,8 +18,9 @@ Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder
|
|
| 18 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 19 |
|
| 20 |
tokenizer = AutoTokenizer.from_pretrained('intfloat/e5-mistral-7b-instruct')
|
| 21 |
-
model = AutoModel.from_pretrained('intfloat/e5-mistral-7b-instruct')
|
| 22 |
-
model.
|
|
|
|
| 23 |
|
| 24 |
def last_token_pool(last_hidden_states: Tensor, attention_mask: Tensor) -> Tensor:
|
| 25 |
left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
|
|
|
|
| 18 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 19 |
|
| 20 |
tokenizer = AutoTokenizer.from_pretrained('intfloat/e5-mistral-7b-instruct')
|
| 21 |
+
model = AutoModel.from_pretrained('intfloat/e5-mistral-7b-instruct', torch_dtype="auto", device_map=device)
|
| 22 |
+
# model.half()
|
| 23 |
+
# model.to(device)
|
| 24 |
|
| 25 |
def last_token_pool(last_hidden_states: Tensor, attention_mask: Tensor) -> Tensor:
|
| 26 |
left_padding = (attention_mask[:, -1].sum() == attention_mask.shape[0])
|