Spaces:
Paused
Paused
CPU/GPU support
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +1 -0
- app.py +13 -7
- assets/pngs/pg_0001.png +3 -0
- assets/pngs/pg_0002.png +3 -0
- assets/pngs/pg_0003.png +3 -0
- assets/pngs/pg_0004.png +3 -0
- assets/pngs/pg_0005.png +3 -0
- assets/pngs/pg_0006.png +3 -0
- assets/pngs/pg_0007.png +3 -0
- assets/pngs/pg_0008.png +3 -0
- assets/pngs/pg_0009.png +3 -0
- assets/pngs/pg_0010.png +3 -0
- assets/pngs/pg_0013.png +3 -0
- assets/pngs/pg_0014.png +3 -0
- assets/pngs/pg_0015.png +3 -0
- assets/pngs/pg_0016.png +3 -0
- assets/pngs/pg_0017.png +3 -0
- assets/pngs/pg_0018.png +3 -0
- assets/pngs/pg_0019.png +3 -0
- assets/pngs/pg_0020.png +3 -0
- assets/pngs/pg_0021.png +3 -0
- assets/pngs/pg_0033.png +3 -0
- assets/pngs/pg_0034.png +3 -0
- assets/pngs/pg_0035.png +3 -0
- assets/pngs/pg_0036.png +3 -0
- assets/pngs/pg_0037.png +3 -0
- assets/pngs/pg_0038.png +3 -0
- assets/pngs/pg_0039.png +3 -0
- assets/pngs/pg_0040.png +3 -0
- assets/pngs/pg_0041.png +3 -0
- assets/pngs/pg_0042.png +3 -0
- assets/pngs/pg_0043.png +3 -0
- assets/pngs/pg_0044.png +3 -0
- assets/pngs/pg_0045.png +3 -0
- assets/pngs/pg_0046.png +3 -0
- assets/pngs/pg_0047.png +3 -0
- assets/pngs/pg_0048.png +3 -0
- assets/pngs/pg_0049.png +3 -0
- assets/pngs/pg_0050.png +3 -0
- assets/pngs/pg_0051.png +3 -0
- assets/pngs/pg_0052.png +3 -0
- assets/pngs/pg_0053.png +3 -0
- assets/pngs/pg_0054.png +3 -0
- assets/pngs/pg_0055.png +3 -0
- assets/pngs/pg_0056.png +3 -0
- assets/pngs/pg_0057.png +3 -0
- assets/pngs/pg_0058.png +3 -0
- assets/pngs/pg_0059.png +3 -0
- assets/pngs/pg_0060.png +3 -0
- assets/pngs/pg_0061.png +3 -0
.gitattributes
CHANGED
@@ -324,3 +324,4 @@ assets/pdfs/pg_0197.pdf filter=lfs diff=lfs merge=lfs -text
|
|
324 |
assets/pdfs/pg_0243.pdf filter=lfs diff=lfs merge=lfs -text
|
325 |
assets/pdfs/pg_0205.pdf filter=lfs diff=lfs merge=lfs -text
|
326 |
assets/pdfs/pg_0228.pdf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
324 |
assets/pdfs/pg_0243.pdf filter=lfs diff=lfs merge=lfs -text
|
325 |
assets/pdfs/pg_0205.pdf filter=lfs diff=lfs merge=lfs -text
|
326 |
assets/pdfs/pg_0228.pdf filter=lfs diff=lfs merge=lfs -text
|
327 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -1,7 +1,9 @@
|
|
1 |
# TODO: return all pages used to form answer
|
|
|
|
|
|
|
2 |
|
3 |
import torch
|
4 |
-
from transformers import BitsAndBytesConfig
|
5 |
from llama_index.llms.huggingface import HuggingFaceLLM
|
6 |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
7 |
from llama_index.core import SimpleDirectoryReader
|
@@ -36,12 +38,16 @@ def messages_to_prompt(messages):
|
|
36 |
|
37 |
def load_RAG_pipeline():
|
38 |
# LLM
|
39 |
-
quantization_config =
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
45 |
|
46 |
llm = HuggingFaceLLM(
|
47 |
model_name="HuggingFaceH4/zephyr-7b-alpha",
|
|
|
1 |
# TODO: return all pages used to form answer
|
2 |
+
# TODO: question samples
|
3 |
+
# TEST: with and without GPU instance
|
4 |
+
# TODO: visual questions on page image (in same app)?
|
5 |
|
6 |
import torch
|
|
|
7 |
from llama_index.llms.huggingface import HuggingFaceLLM
|
8 |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
9 |
from llama_index.core import SimpleDirectoryReader
|
|
|
38 |
|
39 |
def load_RAG_pipeline():
|
40 |
# LLM
|
41 |
+
quantization_config = {} # dirty fix for CPU/GPU support
|
42 |
+
if torch.cuda.is_available():
|
43 |
+
from transformers import BitsAndBytesConfig
|
44 |
+
|
45 |
+
quantization_config = BitsAndBytesConfig(
|
46 |
+
load_in_4bit=True,
|
47 |
+
bnb_4bit_compute_dtype=torch.float16,
|
48 |
+
bnb_4bit_quant_type="nf4",
|
49 |
+
bnb_4bit_use_double_quant=True,
|
50 |
+
)
|
51 |
|
52 |
llm = HuggingFaceLLM(
|
53 |
model_name="HuggingFaceH4/zephyr-7b-alpha",
|
assets/pngs/pg_0001.png
ADDED
Git LFS Details
|
assets/pngs/pg_0002.png
ADDED
Git LFS Details
|
assets/pngs/pg_0003.png
ADDED
Git LFS Details
|
assets/pngs/pg_0004.png
ADDED
Git LFS Details
|
assets/pngs/pg_0005.png
ADDED
Git LFS Details
|
assets/pngs/pg_0006.png
ADDED
Git LFS Details
|
assets/pngs/pg_0007.png
ADDED
Git LFS Details
|
assets/pngs/pg_0008.png
ADDED
Git LFS Details
|
assets/pngs/pg_0009.png
ADDED
Git LFS Details
|
assets/pngs/pg_0010.png
ADDED
Git LFS Details
|
assets/pngs/pg_0013.png
ADDED
Git LFS Details
|
assets/pngs/pg_0014.png
ADDED
Git LFS Details
|
assets/pngs/pg_0015.png
ADDED
Git LFS Details
|
assets/pngs/pg_0016.png
ADDED
Git LFS Details
|
assets/pngs/pg_0017.png
ADDED
Git LFS Details
|
assets/pngs/pg_0018.png
ADDED
Git LFS Details
|
assets/pngs/pg_0019.png
ADDED
Git LFS Details
|
assets/pngs/pg_0020.png
ADDED
Git LFS Details
|
assets/pngs/pg_0021.png
ADDED
Git LFS Details
|
assets/pngs/pg_0033.png
ADDED
Git LFS Details
|
assets/pngs/pg_0034.png
ADDED
Git LFS Details
|
assets/pngs/pg_0035.png
ADDED
Git LFS Details
|
assets/pngs/pg_0036.png
ADDED
Git LFS Details
|
assets/pngs/pg_0037.png
ADDED
Git LFS Details
|
assets/pngs/pg_0038.png
ADDED
Git LFS Details
|
assets/pngs/pg_0039.png
ADDED
Git LFS Details
|
assets/pngs/pg_0040.png
ADDED
Git LFS Details
|
assets/pngs/pg_0041.png
ADDED
Git LFS Details
|
assets/pngs/pg_0042.png
ADDED
Git LFS Details
|
assets/pngs/pg_0043.png
ADDED
Git LFS Details
|
assets/pngs/pg_0044.png
ADDED
Git LFS Details
|
assets/pngs/pg_0045.png
ADDED
Git LFS Details
|
assets/pngs/pg_0046.png
ADDED
Git LFS Details
|
assets/pngs/pg_0047.png
ADDED
Git LFS Details
|
assets/pngs/pg_0048.png
ADDED
Git LFS Details
|
assets/pngs/pg_0049.png
ADDED
Git LFS Details
|
assets/pngs/pg_0050.png
ADDED
Git LFS Details
|
assets/pngs/pg_0051.png
ADDED
Git LFS Details
|
assets/pngs/pg_0052.png
ADDED
Git LFS Details
|
assets/pngs/pg_0053.png
ADDED
Git LFS Details
|
assets/pngs/pg_0054.png
ADDED
Git LFS Details
|
assets/pngs/pg_0055.png
ADDED
Git LFS Details
|
assets/pngs/pg_0056.png
ADDED
Git LFS Details
|
assets/pngs/pg_0057.png
ADDED
Git LFS Details
|
assets/pngs/pg_0058.png
ADDED
Git LFS Details
|
assets/pngs/pg_0059.png
ADDED
Git LFS Details
|
assets/pngs/pg_0060.png
ADDED
Git LFS Details
|
assets/pngs/pg_0061.png
ADDED
Git LFS Details
|