Leon-Sander/Local-Multimodal-AI-Chat

load INSTRUCTOR_Transformer max_seq_length 512

Closed this issue · 22 comments

Error when loading PDF....( drag and drop or through browse for file.
"load INSTRUCTOR_Transformer
max_seq_length 512........"

This text should be there, is there an actual error message, or what is your problem?

I had a bug of chroma-hnswlib which depends by chromadb, i did a downgrade of the chromadb package to 0.4.2 and it did the trick.

Could you elaborate on what the actual bug was? Did it just not index the pdf files or did you get an error message?
This might help someone else.

Tenía un insecto de croma-hnswlib que depende del cromatodb, hice una rebaja de la degradación del paquete de cromadb a 0.4.2 e hizo el truco.

Explain it better please

Yes, there is a few bugs with pdf feature :

  1. reinstall sentence-transformers (pip install sentence-transformers==2.2.2 )
  2. you should downgrade Chromadb to 0.4.3 (pip install chromadb==0.4.3)
  3. there is a code bugs not sure how to fix it: @Leon-Sander
    - when you upload a pdf file => will proses it looks ok
    - once you sending your questions/prompts and click enter the pdf that you have uploading will be disappear =>
    means you can NOT chat with the pdf, also the pdf toggle above set to true after you click to send button.
    if anyone fix the code bugs ping me :))

Use Case:
if the user toggle Pdf chat on, means can chat with hover.pdf that we have on the application
if the user upload pdf should stay there on pdf sessions to have chat with.

@B7-9414

3. there is a code bugs not sure how to fix it: @Leon-Sander
   - when you upload a pdf file => will proses it looks ok
   - once you sending your questions/prompts and click enter the pdf that you have uploading will be disappear =>
   means you can NOT chat with the pdf, also the pdf toggle above set to true after you click to send button.
   if anyone fix the code bugs ping me :))

This is intended and no bug. After uploading the pdf, it gets ingested into the vectordb, there is zero reason for the pdf to still be there. If it would still be there, then it would trigger the upload function again and again, populating your vectordb with the same document over and over. And obviously, since you just uploaded a pdf, you would want to chat with it, therefore the pdf toggle is set to true.
So all pdfs you uploaded over time are inside the vectordb, you can chat with them at any time if the pdf toggle is true.
If the pdf toggle is false, you chat with the model without pdf access.

Solution to @joaquindev23 in #23

@Leon-Sander
I have tested that out won’t ingested into the vectordb when you upload the pdf file. you can just upload/drop it manually to pdfs folder then toggle it on/True.

also, if you toggle this off still you can chat with the pdf Even though, when hit clear caches and refresh the page. we should clear it from streamlit UI setting.

@B7-9414
In my case it gets ingested into the vectordb, thats how I designed the code. Also dropping the pdf in the folder does nothing since I didn't program it to read the pdf folder while running.

also, if you toggle this off still you can chat with the pd

I just changed the code, so that toggling the pdf chat off also clears the cache, now it should work.

@Leon-Sander
As you see when you I upload a pdf file has some content about Bassam's info. the toggle will set to on/True and the bassam pdf file I have upload will disappear once I send the question. mean while i have healthcare pdf file under pdfs folder as shown.

when ask/send a questions about Bassam pdf which I have upload won't gave an answer cuz, is NOT in the vector db.
when I ask questions about healthcare related it to the pdf which I have it locally under pdfs folder. will return the valid answer which means its stored in vector db.

1
2

@B7-9414 It seems that you made some changes to the code, maybe that's the reason.

Without seeing your code version or a video demonstration, I can't comprehend you problem since at my end it works exactly as intended.

@Leon-Sander
I have re clone the main branch without changed anything. still the same issue :(( I have tried to fix that could not !! plz test that from your end! ty

@B7-9414 Just cloned the repo and tested it again, here the command line output when I drag in a pdf in the streamlit frontend, as you can see, the adding worked. The pdf contained my resume, so information which the model could not know beforehand.
Then I asked a question, and the pdf chain got loaded and answered my question with contents from the pdf.
Works like a charm, no problems.

image

@Leon-Sander
yes, I have the something but, when you ask questions about the pdf you have uploaded it won't get a valid answer. we may need to to have another chain to handle that , rather than one.

then, try to add it locally under pdfs folder and toggle it on u will get a valid answer .

@B7-9414 The problem might be the way your pdf files are structured. I provided the hover pdf in this repository, please add it in the frontend and then ask "what is the HoVer dataset about?". If you get an answer, it worked, and your problem probably lies in your pdf files.

image
it gives me this error while returning answer to my chat?

image

although these run fine like I am getting all the print

@B7-9414

3. there is a code bugs not sure how to fix it: @Leon-Sander
   - when you upload a pdf file => will proses it looks ok
   - once you sending your questions/prompts and click enter the pdf that you have uploading will be disappear =>
   means you can NOT chat with the pdf, also the pdf toggle above set to true after you click to send button.
   if anyone fix the code bugs ping me :))

This is intended and no bug. After uploading the pdf, it gets ingested into the vectordb, there is zero reason for the pdf to still be there. If it would still be there, then it would trigger the upload function again and again, populating your vectordb with the same document over and over. And obviously, since you just uploaded a pdf, you would want to chat with it, therefore the pdf toggle is set to true. So all pdfs you uploaded over time are inside the vectordb, you can chat with them at any time if the pdf toggle is true. If the pdf toggle is false, you chat with the model without pdf access.

Hi Leon, I am still learning so forgive me if this is a silly question but is the vectordb stored in the vram or is it stored on the drive and loaded based on the context of the question? I assume the former but I can see the VRAM getting maxed out if the ingested data is a library vs a smaller set of files and was hoping there was a way to implement the latter.

What are your thoughts on mass ingested file storage?

@JTMarsh556 vectordb is stored on the drive, and document search is performed in RAM. If you have enough RAM you can have a vectordb with a large amount of text ingested.

VRAM is used if the models are loaded on GPU.

Thank you. That clarified things for me. I appreciate you taking the time to explain that to me.