explainers-by-googlers / prompt-api

A proposal for a web API for prompting browser-provided language models
Creative Commons Attribution 4.0 International
206 stars 13 forks source link

Post-download progress #4

Open domenic opened 3 months ago

domenic commented 3 months ago

In cases where the model is not currently available, the API gives notifications of download progress. This is meant to allow a user experience that displays a progress bar or similar.

However, in our prototyping in Chrome at least, there are other steps after the download: e.g. decompressing the model, and verifying the download. These can take some time (on the order of seconds). Should the API allow monitoring these steps, so as to let sites display their progress?

Let's keep this issue open to see if people run into this issue in practice when trying to build good user experiences. If so, we'll brainstorm what kind of API would be good to expose.

MuraraAllan commented 2 months ago

I had this for around 1 minute on after-download with 16GB DDR4 i5 11 4GB VRAM GTX1060 Giving the difference inbetween hardware performances, would be very hard for a UX to estimate something meaningfull such as "ETA".

Also considering user onboarding process and stuff, probably everything will be settled after they interact with the UX. Or just got hold on a loading AI stuff.

% is always confusing for me as a user. I'd prefer to know if I can use or not only.

I don't think we need to know the exact moment of the process in detail. The model is already available or not seems to provide enough info to a final user.

yeikel16 commented 2 months ago

Hi, the download-progress section describe in the README is only a idea or is the next step?

domenic commented 2 months ago

Hi, the download-progress section describe in the README is only a idea or is the next step?

I don't understand this question or its relationship to this issue.

yeikel16 commented 2 months ago

I don't understand this question or its relationship to this issue.

Sorry if I don't explain myself well, I mean than in the README there is a section that refers to the download progress of the model. I would like to know if this issue is related with this task.

Download progress

In cases where the model needs to be downloaded as part of creation, you can monitor the download progress (e.g. in order to show your users a progress bar) using code such as the following:

const session = await ai.assistant.create({
monitor(m) {
m.addEventListener("downloadprogress", e => {
console.log(`Downloaded ${e.loaded} of ${e.total} bytes.`);
});
}
});

If the download fails, then downloadprogress events will stop being emitted, and the promise returned by create() will be rejected with a "NetworkError" DOMException.

domenic commented 2 months ago

This issue is specifically about post-download progress, not download progress. I think the original issue explains that pretty well.