Skip to content

app: create projects and download base models - #57

Merged
setoelkahfi merged 2 commits into
developmentfrom
feature/app-new-project
Nov 18, 2026
Merged

setoelkahfi merged 2 commits into
developmentfrom
feature/app-new-project

Conversation

@setoelkahfi

Copy link
Copy Markdown
Collaborator

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

  • New project (form on the Projects page): where the model will be published (org/name) and a base model from the same catalog the terminal UI offers, with its size and whether it is downloaded.
  • Base model card on a project page: shows where the model is, or a Download button with the current file's progress and a Cancel button.
  • The progress bar 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 downloaded. I saw this in the running app and fixed it here.
  • "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. A file only gets its real name once it is whole, so a cancelled download never counts.
  • models::base_model_dir also finds a model kept next to the projects, like ~/.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.

Testing

  • fmt, clippy with -D warnings, cargo test --locked and the no-default-features check pass for the CLI and the desktop crate (34 desktop tests).
  • In the running app against the real Hugging Face: the form lists the catalog with its download state. Starting a download shows file progress. A connection timeout shows as an error with the Download button back. Cancel stops the transfer: the cache stopped growing and the button returned with no error.
  • An ignored library test cancels a real download of Qwen3-0.6B and checks the half-written model is not complete.
  • Not checked: a download that runs to the end, creating a project through the form, and anything in a sandboxed build. In the sandbox the model cache is the shared App Group folder, which I have not verified from inside it.

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 .tmp file and retrying starts that file again.

Base is development. It does not depend on #56.

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>
@setoelkahfi setoelkahfi self-assigned this Nov 18, 2026
@setoelkahfi
setoelkahfi requested a review from paydii November 18, 2026 08:03

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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>

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

@setoelkahfi
setoelkahfi merged commit 2dcdb19 into development Nov 18, 2026
7 checks passed
@setoelkahfi
setoelkahfi deleted the feature/app-new-project branch November 18, 2026 09:44
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.

2 participants