-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] - net::ERR_INSUFFICIENT_RESOURCES Upon Uploading Large Corpus #176
Comments
We are currently uploading with ragna/ragna/_ui/resources/upload.js Lines 1 to 7 in 6209845
My JS knowledge is not what you would call advanced. From a quick Google search, there seems to be no way to limit the number of concurrent requests when using That being said, uploading 2k+ documents seems like an odd use case to begin with. Could you elaborate here to help me understand? A workaround is always to perform the upload manually by hitting the API directly and just use the UI to ask questions. |
LoL, I thought 2k+ documents was actually kind of small. It's like 1/9th of what I'm dealing with right now. I'm just trying to get Ragna deployed so my bosses can try out different vector stores and LLMs in a user-friendly manner. Anyway, my JS knowledge is also quite weak; however, I remembered a little bit of recursion from CS and, with the help of GPT-4, I was able to write some code that fixes this bug. I've tested it and have gotten 2252 files into Ragna successfully via the file chooser on Chromium. The replacement to function upload(files, token, informationsEndpoint, final_callback) {
const batchSize = 500; // Maximum number of concurrent uploads
let currentIndex = 0; // Tracks the index of the current file to be uploaded
let successfullyUploaded = []; // Array to hold the results
// Function to upload a single batch of files
function uploadBatch() {
// Get the next batch of files based on the current index and batch size
const batch = Array.from(files).slice(currentIndex, currentIndex + batchSize);
currentIndex += batchSize;
// Map over the batch to create an array of upload promises
return Promise.all(
batch.map(file => uploadFile(file, token, informationsEndpoint))
).then(results => {
// Concatenate the results of the current batch to the main array
successfullyUploaded = successfullyUploaded.concat(results);
// If there are more files to upload, recursively call uploadBatch again
if (currentIndex < files.length) {
return uploadBatch();
} else {
// If all files are uploaded, invoke the final callback with the results
final_callback(successfullyUploaded);
}
});
}
// Start uploading the first batch
uploadBatch().catch(error => {
console.error("An error occurred during the upload process", error);
// You might want to call your final callback with an error or partial results
final_callback(successfullyUploaded);
});
} |
Indeed 2k+ documents for RAG is not an issue. It is an issue for the current default use case for Ragna however. Our main focus for the first release was to enable easy experimentation. Meaning you can set parameters like the chunk size and chunk overlap for each chat to compare the results. This requires us to treat everything on a per-chat basis. Meaning, for each chat that you have, you'll need to upload documents and they will be embedded. This is not feasible for 2k+ documents. However, your use case seems to be: "I have a large corpus of documents. I want to upload them once and later on only select a few or potentially all of them for questioning." Is that correct? If so, you could trade in some of flexibility, i.e. the ability to configure stuff on the per-chat basis, to make it work. Still, we need to implement a few things to have a good UX for this:
That is not an easy, but certainly a valid use case. In fact we had an offline request for this scenario already. |
I think you've summarized things well. The main use-case is to compare various LLM/Vector combinations, where Vector is kind of both the storage mechanism and the embedding (Aside: I think they're more concerned about embedding performance than storage performance). So, they want to experiment as follows:
To mimic this setup, I was just going to create X*Y independent conversations by re-uploading the data each time and letting them try out the various combinations. Obviously, being able to upload a corpus once and then instantiate conversations off of it would be ideal, but I don't think I have the time or inclination to customize Ragna that much right now. |
What I would do for your use case right now, is to hit the API directly to upload the documents and embed them and afterwards hand the UI over to your bosses. We have the In case you are using a non-memory queue, I would also start the worker (and in turn the API) manually. This gives you control over the number of worker threads. So basically you want |
You might want to chime in on #191 in that case. |
Hey, @pmeier, I'll chime in on #191 in a bit. FYI, |
Sorry, yeah, it needs to be single Lines 167 to 182 in 4962665
Lines 122 to 134 in 4962665
|
…helmed causing the Ragna UI to hang (Quansight#176)
Bug description
Ragna UI hangs while attempting to upload 2261 documents via the file chooser.
How to reproduce the bug?
Versions and dependencies used
Anything else?
It seems like this might be a known bug in Chrome/Chromium that has to do with making too many requests at once.
See also:
https://scratch.mit.edu/discuss/m/topic/88418/
The text was updated successfully, but these errors were encountered: