Update main.py
Browse files
main.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
from flask import Flask, request, jsonify
|
2 |
from langchain_community.llms import LlamaCpp
|
3 |
from sentence_transformers import SentenceTransformer
|
|
|
|
|
4 |
# cosine_similarity
|
5 |
import torch
|
6 |
from torch.nn.functional import cosine_similarity
|
@@ -19,8 +21,9 @@ llm = LlamaCpp(
|
|
19 |
verbose=True,
|
20 |
n_ctx=4096
|
21 |
)
|
|
|
22 |
|
23 |
-
model = SentenceTransformer('paraphrase-TinyBERT-L6-v2')
|
24 |
|
25 |
file_size = os.stat('Phi-3-mini-4k-instruct-q4.gguf')
|
26 |
print("model size ====> :", file_size.st_size, "bytes")
|
|
|
1 |
from flask import Flask, request, jsonify
|
2 |
from langchain_community.llms import LlamaCpp
|
3 |
from sentence_transformers import SentenceTransformer
|
4 |
+
from transformers import AutoTokenizer, AutoModel
|
5 |
+
|
6 |
# cosine_similarity
|
7 |
import torch
|
8 |
from torch.nn.functional import cosine_similarity
|
|
|
21 |
verbose=True,
|
22 |
n_ctx=4096
|
23 |
)
|
24 |
+
model0 = AutoModel.from_pretrained('sentence-transformers/paraphrase-TinyBERT-L6-v2')
|
25 |
|
26 |
+
model = SentenceTransformer('sentence-transformers/paraphrase-TinyBERT-L6-v2')
|
27 |
|
28 |
file_size = os.stat('Phi-3-mini-4k-instruct-q4.gguf')
|
29 |
print("model size ====> :", file_size.st_size, "bytes")
|