Spaces:
Sleeping
Sleeping
Commit
•
2753b08
1
Parent(s):
eb56c9e
refactor: configure grader
Browse files- config.yml +5 -1
- lib/graph.py +7 -2
config.yml
CHANGED
@@ -11,4 +11,8 @@ models:
|
|
11 |
rag:
|
12 |
model: cohere/command-r
|
13 |
temperature: 0
|
14 |
-
|
|
|
|
|
|
|
|
|
|
11 |
rag:
|
12 |
model: cohere/command-r
|
13 |
temperature: 0
|
14 |
+
|
15 |
+
embeddings:
|
16 |
+
intfloat:
|
17 |
+
model: intfloat/multilingual-e5-large
|
18 |
+
device: cpu
|
lib/graph.py
CHANGED
@@ -14,15 +14,20 @@ from lib.runnables import (
|
|
14 |
rag_chain,
|
15 |
message_classificator,
|
16 |
)
|
|
|
17 |
from langgraph.graph import END, StateGraph
|
18 |
from transformers import AutoModel, AutoTokenizer
|
19 |
import torch
|
20 |
import torch.nn.functional as F
|
21 |
|
22 |
-
|
|
|
|
|
|
|
23 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
24 |
model = AutoModel.from_pretrained(model_name)
|
25 |
-
|
|
|
26 |
model.to(device)
|
27 |
SIMILARITY_TRESHHOLD = 0.8
|
28 |
|
|
|
14 |
rag_chain,
|
15 |
message_classificator,
|
16 |
)
|
17 |
+
from lib.config import Config
|
18 |
from langgraph.graph import END, StateGraph
|
19 |
from transformers import AutoModel, AutoTokenizer
|
20 |
import torch
|
21 |
import torch.nn.functional as F
|
22 |
|
23 |
+
config = Config("config.yml")
|
24 |
+
model_name = config.get("embeddings", "intfloat", "model")
|
25 |
+
device = config.get("embeddings", "intfloat", "device")
|
26 |
+
|
27 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
28 |
model = AutoModel.from_pretrained(model_name)
|
29 |
+
|
30 |
+
device = torch.device(device)
|
31 |
model.to(device)
|
32 |
SIMILARITY_TRESHHOLD = 0.8
|
33 |
|