Repository navigation
app: create projects and download base models - #57
Conversation
A project needs a base model on disk before anything can train, and the app could neither make a project nor fetch a model. It now does both. New project asks for where the model will be published (org/name) and a base model from the catalog the terminal UI offers. A project page has a Base model card that shows where the model is, or a Download button with the current file's progress and a Cancel button. Progress follows the file being fetched, not the file count: a model is ten small files and one of over a gigabyte, so a bar counted in files sat near 60% with almost nothing in. "Downloaded" now means the weights are all there. models::is_complete checks config.json, tokenizer.json and either model.safetensors or every shard the index names, and a file only gets its real name once it is whole, so a cancelled download never counts. base_model_dir also finds a model kept next to the projects, as in ~/.onde/base/Qwen3-1.7B, which the cache lookup alone missed. Only catalog models can be downloaded from the app, repo ids are checked before they become paths, and a second download of the same model is refused. Checked in the running app against the real Hugging Face: the form lists the catalog with its download state, the card shows a download and a connection timeout as an error with the button back, and Cancel stops the transfer (the cache stopped growing). A library test cancels a real download of Qwen3-0.6B and checks the half-written model is not complete. Not checked: a download that finishes, and creating a project through the form. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.7.10 <noreply@sigit.si> Co-Authored-By: OndeCode v1.1.2 <noreply@ondeinference.com>
There was a problem hiding this comment.
This change adds the first slice of the Fine-tune tab: creating a project from the Projects page (repo id + a base model picked from the terminal UI's catalog) and downloading that base model from the project page. On the Rust side, desktop/base_models.rs builds the catalog view and creates projects (validating both ids before anything becomes a path), commands/base_models.rs exposes four Tauri commands with download progress streamed over an ipc Channel, and state_downloads.rs tracks in-flight downloads by repo id so a second download is refused and one can be cancelled. In the CLI crate, models::is_complete defines "downloaded" as config + tokenizer + all weights (single file or every shard named by the index, so .tmp files never count), and base_model_dir now also finds a complete model under base/ next to the projects folder. The React side adds NewProjectForm, BaseModelCard (progress bar tracks the current file's bytes, not file count), and the ipc/type plumbing. Tests cover completeness rules, the base/ lookup, and an ignored network test for cancellation. The main thing to look at is the download bookkeeping in commands/base_models.rs — the begin/finish lifecycle has a small cross-talk window after a cancel.
Automated review by siGit Code Review · commit df15bdc · see the review dashboard
Cancelling a download removes its entry at once, and the cancelled handler then wakes up and called finish by model name. If the user had started the model again in between, finish removed the new download's entry. That defeated the one-download guard and left the new transfer impossible to cancel. Each download now has a ticket, and finish only clears the entry when the ticket is still the one on record. A project page opened while a download ran showed a Download button again, because the card only knew about downloads it started itself. It now asks the backend, shows that the download is going on in the background, offers Cancel, and refreshes when it ends. Progress from before the page was opened is not available. A failure to load the base model list was swallowed, so the card claimed the model was not in the app's list. It now says the list could not be loaded and shows the error. Checked in the running app: leaving a download and reopening the project shows it in progress, and Cancel from there stops the transfer. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.7.10 <noreply@sigit.si> Co-Authored-By: OndeCode v1.1.2 <noreply@ondeinference.com>
There was a problem hiding this comment.
This diff addresses all three open review threads. The ticket-based Downloads map fixes the race where a cancelled download's handler could unregister a replacement: begin now returns a Ticket, and finish only removes the entry if the ticket matches. A new base_download_running command and resumed state in BaseModelCard handle the remount case where a download started before the card was shown. The catalog-load error is now surfaced instead of swallowed. New tests cover the ticket race and the finish-with-matching-ticket path.
Automated review by siGit Code Review · commit ebc4195 · changes since df15bdc · see the review dashboard
A project needs a base model on disk before anything can train, and the app could neither make a project nor fetch a model. This adds both. It is the first of three changes for the Fine-tune tab (next: runs and live charts, then sweeps), and it stands alone.
What changed
org/name) and a base model from the same catalog the terminal UI offers, with its size and whether it is downloaded.models::is_completechecksconfig.json,tokenizer.jsonand eithermodel.safetensorsor every shard the index names. A file only gets its real name once it is whole, so a cancelled download never counts.models::base_model_diralso finds a model kept next to the projects, like~/.onde/base/Qwen3-1.7B, which the cache lookup alone missed.Testing
-D warnings,cargo test --lockedand the no-default-features check pass for the CLI and the desktop crate (34 desktop tests).Notes
The download that timed out stalled at about 1 MB on my network, so a stalled transfer currently fails with a timeout rather than resuming. It leaves a
.tmpfile and retrying starts that file again.Base is
development. It does not depend on #56.