Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,35 +1,12 @@
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
-
"""AdvancedRAG_CrossEncoder_Reranker_Zephyr7bAlpha_.ipynb
|
3 |
-
|
4 |
-
Automatically generated by Colaboratory.
|
5 |
-
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/1cpw-00tHts6d-z-yRAwu8SDPD6calQvB
|
8 |
-
"""
|
9 |
-
|
10 |
-
pip install -q pypdf
|
11 |
-
pip install -q python-dotenv
|
12 |
-
pip install -q llama-index
|
13 |
-
pip install -q gradio
|
14 |
-
pip install einops
|
15 |
-
pip install accelerate
|
16 |
-
pip install sentence-transformers
|
17 |
-
pip install cohere
|
18 |
-
pip install --upgrade huggingface_hub
|
19 |
-
|
20 |
-
CMAKE_ARGS="-DLLAMA_CUBLAS=on" FORCE_CMAKE=1 pip install llama-cpp-python --no-cache-dir
|
21 |
-
|
22 |
from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
|
23 |
from llama_index.llms import HuggingFaceLLM
|
24 |
import torch
|
|
|
|
|
25 |
|
26 |
documents = SimpleDirectoryReader("/content/data").load_data()
|
27 |
|
28 |
-
#intialize our custom LLM
|
29 |
-
import torch
|
30 |
-
|
31 |
-
from llama_index.llms import LlamaCPP
|
32 |
-
from llama_index.llms.llama_utils import messages_to_prompt, completion_to_prompt
|
33 |
llm = LlamaCPP(
|
34 |
# You can pass in the URL to a GGML model to download it automatically
|
35 |
model_url='https://huggingface.co/TheBloke/zephyr-7B-alpha-GGUF/resolve/main/zephyr-7b-alpha.Q5_K_M.gguf',
|
|
|
1 |
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
from llama_index import VectorStoreIndex, SimpleDirectoryReader, ServiceContext
|
3 |
from llama_index.llms import HuggingFaceLLM
|
4 |
import torch
|
5 |
+
from llama_index.llms import LlamaCPP
|
6 |
+
from llama_index.llms.llama_utils import messages_to_prompt, completion_to_prompt
|
7 |
|
8 |
documents = SimpleDirectoryReader("/content/data").load_data()
|
9 |
|
|
|
|
|
|
|
|
|
|
|
10 |
llm = LlamaCPP(
|
11 |
# You can pass in the URL to a GGML model to download it automatically
|
12 |
model_url='https://huggingface.co/TheBloke/zephyr-7B-alpha-GGUF/resolve/main/zephyr-7b-alpha.Q5_K_M.gguf',
|