This is a repo for the NLP class project (Retrieval-augmented generation).
The main instruction following: https://github.com/forrestbao/nlp-class/blob/master/projects.md
Dongyoun Kim, Daeun Kim
# line: 124 - adding {'text': node.text} in upload.py
vectors=[(node.metadata['file_name'][:2]+node.metadata['page_label'], emb, {'text': node.text}) for node, emb in zip(nodes,embedding)],
namespace=self.name_space)
Build the Retrieval-augmented generation (RAG)
.
|-- documents/ # documentation files (Every input have to store it in doucments)
|-- demos/
| README.md
|-- demos/ # videos demos
| upload.py
| query.py
| requirement.txt
| README.md
Task: Build a GUI app for all steps above. Include README file and a short video demo to show the usage and completion of your GUI app.
funix gui.py
#line 47 -
#Enter the API keys for accessing Pipecone
os.environ["PINECONE_API_KEY"] = 'xxxxxx..' #Enter YOUR KEY
os.environ["PINECONE_ENV"] = "gcp-starter" #Enter YOUR environment in Pipecone(DB)
Task: March 20: PDF upload and indexing via command line done. Include README file and a short video demo to show the usage and completion of your command line tool. e.g., python upload.py --pdf_file=example.pdf to add one PDF file each time.
Read the file : Load and read pdf file + pre-processing for replacing consecutive spaces, newlines and tabs in the file.
Chunk: This project chunks the pdf file based on the sentence - chunk size and chunk overlap
Embedding: This project use a simple embedding model (bge-small-en-v1.5) from hugging face. Because the OpenAI API (GPT) is subject to rate limitation error.
Upload(Upsert) the data
parser = argparse.ArgumentParser(description= 'Process the pdf file for uploading the file to Pinecone (Vector DB)')
parser.add_argument('--file_name', type=str, default= None, help='A path of input file')
parser.add_argument('--chunck_size', type=int, default=200, help='Enter the chunck size over 100 range')
parser.add_argument('--chunck_overlap', type=float, default=0.25, help='The portion of the overlap chunks: 25% = 0.25 range[0,1]')
parser.parse_args()
The file have to store in 'documents' folder.
>>> python upload.py --file_name sample.pdf
>>> python upload.py --name_space test_case --chunck_size 100 --chunk_overlap 0.20 # overlap = 100*0.2 = 20.
'--file_name': [Optional] Enter the PDF file name. The file have to store in 'documents/'. If do not enter it, the code will Reads the files in the documents folder
>>> python upload.py --file_name sample.pdf
'--chunk_size': [Optional] Enter the chunk size as integer. The default is 200
>>> python upload.py --chunk_size 100
'--chunk_overlap': [Optional] Enter the ratio of chunk overlap ranging [0,1]. The default is 0.25
>>> python upload.py --chunck_overlap 0.25
Task: Answer generation based on user queries via command line finish. Include README file and a short video demo to show the usage and completion of your query tool. e.g., python query.py --question="What is the meaning of life?" to get an answer.
llama-2-13b-chat.Q4_0.gguf parser.add_argument('--question', type=str, default= None, required=True, help='A query')
parser.add_argument('--top_k', type=int, default=5, help='top_k')
>>> python query.py --question "What is the attention model?"
>>> python query.py --question "What is the attention model?" --top_k 8
14 commits
10 commits
Python
100.0%
This is a repo for the NLP class project (Retrieval-augmented generation).
The main instruction following: https://github.com/forrestbao/nlp-class/blob/master/projects.md
Dongyoun Kim, Daeun Kim
# line: 124 - adding {'text': node.text} in upload.py
vectors=[(node.metadata['file_name'][:2]+node.metadata['page_label'], emb, {'text': node.text}) for node, emb in zip(nodes,embedding)],
namespace=self.name_space)
Build the Retrieval-augmented generation (RAG)
.
|-- documents/ # documentation files (Every input have to store it in doucments)
|-- demos/
| README.md
|-- demos/ # videos demos
| upload.py
| query.py
| requirement.txt
| README.md
Task: Build a GUI app for all steps above. Include README file and a short video demo to show the usage and completion of your GUI app.
funix gui.py
#line 47 -
#Enter the API keys for accessing Pipecone
os.environ["PINECONE_API_KEY"] = 'xxxxxx..' #Enter YOUR KEY
os.environ["PINECONE_ENV"] = "gcp-starter" #Enter YOUR environment in Pipecone(DB)
Task: March 20: PDF upload and indexing via command line done. Include README file and a short video demo to show the usage and completion of your command line tool. e.g., python upload.py --pdf_file=example.pdf to add one PDF file each time.
Read the file : Load and read pdf file + pre-processing for replacing consecutive spaces, newlines and tabs in the file.
Chunk: This project chunks the pdf file based on the sentence - chunk size and chunk overlap
Embedding: This project use a simple embedding model (bge-small-en-v1.5) from hugging face. Because the OpenAI API (GPT) is subject to rate limitation error.
Upload(Upsert) the data
parser = argparse.ArgumentParser(description= 'Process the pdf file for uploading the file to Pinecone (Vector DB)')
parser.add_argument('--file_name', type=str, default= None, help='A path of input file')
parser.add_argument('--chunck_size', type=int, default=200, help='Enter the chunck size over 100 range')
parser.add_argument('--chunck_overlap', type=float, default=0.25, help='The portion of the overlap chunks: 25% = 0.25 range[0,1]')
parser.parse_args()
The file have to store in 'documents' folder.
>>> python upload.py --file_name sample.pdf
>>> python upload.py --name_space test_case --chunck_size 100 --chunk_overlap 0.20 # overlap = 100*0.2 = 20.
'--file_name': [Optional] Enter the PDF file name. The file have to store in 'documents/'. If do not enter it, the code will Reads the files in the documents folder
>>> python upload.py --file_name sample.pdf
'--chunk_size': [Optional] Enter the chunk size as integer. The default is 200
>>> python upload.py --chunk_size 100
'--chunk_overlap': [Optional] Enter the ratio of chunk overlap ranging [0,1]. The default is 0.25
>>> python upload.py --chunck_overlap 0.25
Task: Answer generation based on user queries via command line finish. Include README file and a short video demo to show the usage and completion of your query tool. e.g., python query.py --question="What is the meaning of life?" to get an answer.
llama-2-13b-chat.Q4_0.gguf parser.add_argument('--question', type=str, default= None, required=True, help='A query')
parser.add_argument('--top_k', type=int, default=5, help='top_k')
>>> python query.py --question "What is the attention model?"
>>> python query.py --question "What is the attention model?" --top_k 8
14 commits
10 commits
Python
100.0%