Spaces:
Runtime error
Runtime error
adrien.aribaut-gaudin
commited on
Commit
·
9b8ba2b
1
Parent(s):
a7a4b4c
added the token to the environ and the llm agent
Browse files- app.py +2 -2
- src/tools/llm.py +2 -2
app.py
CHANGED
@@ -36,12 +36,12 @@ client_db = chromadb.Client()
|
|
36 |
|
37 |
try:
|
38 |
client_db.get_collection(name="illumio_database")
|
39 |
-
llm = LlmAgent(model="meta-llama/Llama-2-7b")
|
40 |
retriever = Retriever(client_db, None, "illumio_database", llmagent=llm)
|
41 |
except:
|
42 |
print("Database is empty")
|
43 |
doc = Doc(path=content_en_path_real)
|
44 |
-
llm = LlmAgent(model="meta-llama/Llama-2-7b")
|
45 |
retriever = Retriever(client_db,doc.container,"illumio_database",llmagent=llm)
|
46 |
|
47 |
|
|
|
36 |
|
37 |
try:
|
38 |
client_db.get_collection(name="illumio_database")
|
39 |
+
llm = LlmAgent(model="meta-llama/Llama-2-7b",token=os.environ["TOKEN_HF"])
|
40 |
retriever = Retriever(client_db, None, "illumio_database", llmagent=llm)
|
41 |
except:
|
42 |
print("Database is empty")
|
43 |
doc = Doc(path=content_en_path_real)
|
44 |
+
llm = LlmAgent(model="meta-llama/Llama-2-7b",token=os.environ["TOKEN_HF"])
|
45 |
retriever = Retriever(client_db,doc.container,"illumio_database",llmagent=llm)
|
46 |
|
47 |
|
src/tools/llm.py
CHANGED
@@ -6,12 +6,12 @@ import torch
|
|
6 |
|
7 |
class LlmAgent:
|
8 |
|
9 |
-
def __init__(self, model :str = "meta-llama/Llama-2-7b"):
|
10 |
self.tokenizer = AutoTokenizer.from_pretrained(model, use_fast=True)
|
11 |
self.model = AutoModelForCausalLM.from_pretrained(model,
|
12 |
device_map="cuda",
|
13 |
trust_remote_code=False, #A CHANGER SELON LES MODELES, POUR CELUI DE LAMA2 CA MARCHE (celui par default)
|
14 |
-
revision="main")
|
15 |
self.pipe = pipeline("text-generation", model=self.model, tokenizer=self.tokenizer,torch_dtype=torch.float16)
|
16 |
|
17 |
def generate_paragraph(self, query: str, context: {}, histo: [(str, str)], language='fr') -> str:
|
|
|
6 |
|
7 |
class LlmAgent:
|
8 |
|
9 |
+
def __init__(self, model :str = "meta-llama/Llama-2-7b",token : str = None):
|
10 |
self.tokenizer = AutoTokenizer.from_pretrained(model, use_fast=True)
|
11 |
self.model = AutoModelForCausalLM.from_pretrained(model,
|
12 |
device_map="cuda",
|
13 |
trust_remote_code=False, #A CHANGER SELON LES MODELES, POUR CELUI DE LAMA2 CA MARCHE (celui par default)
|
14 |
+
revision="main",token=token)
|
15 |
self.pipe = pipeline("text-generation", model=self.model, tokenizer=self.tokenizer,torch_dtype=torch.float16)
|
16 |
|
17 |
def generate_paragraph(self, query: str, context: {}, histo: [(str, str)], language='fr') -> str:
|