Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,8 @@ import re
|
|
16 |
|
17 |
class DocumentRetrievalAndGeneration:
|
18 |
def __init__(self, embedding_model_name, lm_model_id, data_folder):
|
19 |
-
|
|
|
20 |
self.all_splits = self.load_documents(data_folder)
|
21 |
self.embeddings = SentenceTransformer(embedding_model_name)
|
22 |
self.cpu_index = self.create_faiss_index()
|
@@ -47,7 +48,7 @@ class DocumentRetrievalAndGeneration:
|
|
47 |
bnb_4bit_compute_dtype=torch.bfloat16
|
48 |
)
|
49 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
50 |
-
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config,token=
|
51 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
52 |
generate_text = pipeline(
|
53 |
model=model,
|
|
|
16 |
|
17 |
class DocumentRetrievalAndGeneration:
|
18 |
def __init__(self, embedding_model_name, lm_model_id, data_folder):
|
19 |
+
hf_token = os.getenv('HF_TOKEN')
|
20 |
+
print(HF_TOKEN,hf_token)
|
21 |
self.all_splits = self.load_documents(data_folder)
|
22 |
self.embeddings = SentenceTransformer(embedding_model_name)
|
23 |
self.cpu_index = self.create_faiss_index()
|
|
|
48 |
bnb_4bit_compute_dtype=torch.bfloat16
|
49 |
)
|
50 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
51 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, quantization_config=bnb_config,token=hf_token)
|
52 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
53 |
generate_text = pipeline(
|
54 |
model=model,
|