Spaces:
Runtime error
Runtime error
changed settings for cpu workload
Browse files- app.py +3 -4
- chatBot/common/llama.py +14 -10
app.py
CHANGED
@@ -1,12 +1,11 @@
|
|
1 |
from chatBot import create_app
|
2 |
from threading import Thread
|
3 |
-
from flask import
|
4 |
app = create_app()
|
5 |
|
6 |
-
@app.route('/
|
7 |
def index():
|
8 |
-
return
|
9 |
-
|
10 |
|
11 |
def run():
|
12 |
app.run(host='0.0.0.0', port=7860, debug=False)
|
|
|
1 |
from chatBot import create_app
|
2 |
from threading import Thread
|
3 |
+
from flask import redirect, url_for
|
4 |
app = create_app()
|
5 |
|
6 |
+
@app.route('/')
|
7 |
def index():
|
8 |
+
return redirect(url_for('update.upload'))
|
|
|
9 |
|
10 |
def run():
|
11 |
app.run(host='0.0.0.0', port=7860, debug=False)
|
chatBot/common/llama.py
CHANGED
@@ -7,7 +7,7 @@ from langchain.embeddings import HuggingFaceInstructEmbeddings
|
|
7 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
8 |
from langchain.vectorstores import Chroma
|
9 |
from pdf2image import convert_from_path
|
10 |
-
from transformers import AutoTokenizer, TextStreamer, pipeline
|
11 |
from chatBot.common.pdfToText import loadLatestPdf
|
12 |
from transformers import LlamaTokenizer
|
13 |
from langchain.document_loaders import PyPDFLoader
|
@@ -32,17 +32,21 @@ model_basename = "model"
|
|
32 |
|
33 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
34 |
|
35 |
-
model = AutoGPTQForCausalLM.from_quantized(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
model_name_or_path,
|
37 |
-
device_map="auto",
|
38 |
-
revision="gptq-4bit-128g-actorder_True",
|
39 |
-
model_basename=model_basename,
|
40 |
use_safetensors=True,
|
41 |
-
trust_remote_code=True,
|
42 |
-
inject_fused_attention=False,
|
43 |
-
device=DEVICE,
|
44 |
-
quantize_config=None,
|
45 |
-
disable_exllama=True,
|
46 |
)
|
47 |
|
48 |
|
|
|
7 |
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
8 |
from langchain.vectorstores import Chroma
|
9 |
from pdf2image import convert_from_path
|
10 |
+
from transformers import AutoTokenizer, TextStreamer, pipeline, LlamaForCausalLM
|
11 |
from chatBot.common.pdfToText import loadLatestPdf
|
12 |
from transformers import LlamaTokenizer
|
13 |
from langchain.document_loaders import PyPDFLoader
|
|
|
32 |
|
33 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
|
34 |
|
35 |
+
# model = AutoGPTQForCausalLM.from_quantized(
|
36 |
+
# model_name_or_path,
|
37 |
+
# device_map="auto",
|
38 |
+
# revision="gptq-4bit-128g-actorder_True",
|
39 |
+
# model_basename=model_basename,
|
40 |
+
# use_safetensors=True,
|
41 |
+
# trust_remote_code=True,
|
42 |
+
# inject_fused_attention=False,
|
43 |
+
# device=DEVICE,
|
44 |
+
# quantize_config=None,
|
45 |
+
# )
|
46 |
+
|
47 |
+
model = LlamaForCausalLM.from_pretrained(
|
48 |
model_name_or_path,
|
|
|
|
|
|
|
49 |
use_safetensors=True,
|
|
|
|
|
|
|
|
|
|
|
50 |
)
|
51 |
|
52 |
|