Skip to content
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

Show downloaded models, improve error handling #456

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

cadenmackenzie
Copy link
Contributor

I wanted a way to show which models have already been downloaded. Ultimately, I would like to add the ability to manage those models such as deleting them. Might make more sense in a sidebar where you chose the model and can manage it.

I also added more robust handling of errors in index.html to safely access them as I saw some warnings in the main branch when no errors were set.

In index.js I combined error handling into a single flow for the populateSelector method using response.json() instead of manually parsing. I also added a helper method to set the error to reduce duplicate code. Something I should have done with my last PR.

Open to suggestions on these changes.

@cadenmackenzie
Copy link
Contributor Author

I am seeing now some of the robust error handling was intentional and merged in here. I can change back if that is preferred.

@dtnewman
Copy link
Contributor

+1 on the concept, but this is an issue:

image

@dtnewman
Copy link
Contributor

+1 on the concept, but this is an issue:

image

Oh wait, that's in Safari. It actually works on Chrome and Firefox. Still, should probably fix before merge.

image

@dtnewman
Copy link
Contributor

dtnewman commented Nov 14, 2024

+1 on the concept, but this is an issue:
image

Oh wait, that's in Safari. It actually works on Chrome and Firefox. Still, should probably fix before merge.

image

I fixed these issue in https://github.com/cadenmackenzie/exo/pull/1/files which you can merge into this PR

@cadenmackenzie
Copy link
Contributor Author

Thanks for finding that! I went ahead and merged it in.

Copy link
Contributor

@AlexCheema AlexCheema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What a great idea!
Definitely worthy of a $200 retrospective bounty.

I think the implementation right now is not great -- I'd prefer if we lean on the existing HFShardDownloader since that knows how to do downloads. You might need to add a new abstract method to ShardDownloader something like get_shard_download_status and it should use the same functionality already in hf_helpers.py to check what the percentage completion is.

Also, a few suggest changes to the UI: if the model is partially downloaded (percentage > 0) then display the % next to the model name in the UI.

@cadenmackenzie
Copy link
Contributor Author

Awesome!

Got it working with the suggested changes. Want to do some testing in the morning then will update this PR.

@cadenmackenzie
Copy link
Contributor Author

Added new abstract method in ShardDownloader, implemented get_shard_download_status in HFShardDownloader leaning on get_local_snapshot_dir, get_weight_map, get_allow_patterns helper functions and then checks the percentage of model downloaded for models where local files are found. Removed old function for checking percentage.

Currently shows "downloaded" for fully downloaded models and "X% downloaded" for models not fully downloaded in dropdown.

I don't love how this is being refreshed using the modelPoolInterval because it lags a little for models that are actively being downloaded so might work on how to improve that.

I think it could be worth moving this logic as well as active downloads to a sidebar. I like how active downloads are being shown in the chat when initiated but if we moved that to a sidebar, it could be a centralized place to view all models, choose a model, see activity of downloaded models, and being able to remove local downloads to free up space. Similar to how you can remove local models in LM Studio.

Open to suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants