Find a model in the registry instead of pasting a URL into a box
CI / test (push) Successful in 1m41s
CI / test (push) Successful in 1m41s
Mirroring anything meant knowing a repository existed, knowing which of its thirty files were the weights, and assembling a resolve URL by hand. The mirror page had a text box for that URL and no way to find one. It now searches Hugging Face and lists a repository's weight files with their sizes and published checksums, each with a button that fills the fetch form. Only weight files. A repository is mostly a README and a tokenizer, and listing those buries the four entries somebody came for. The size shown is the LFS size, not the plain one. For an LFS-stored file — every weights file — the plain field is the size of the pointer, so the other one reports a gigabyte model as 133 bytes, and that is the number somebody would then plan disk against. The source URL is pinned to the commit the listing came from rather than to a branch, so what the mirror fetches is what was on screen. A repository re-uploaded under the same branch otherwise leaves two different sets of weights with identical provenance and no way to tell them apart. The version defaults to that revision for the same reason. The registry's own failures are reported on their own line. It is somebody else's server on the other side of the internet, and it being down says nothing about the mirror — which is what the page is for and has to keep working regardless. With no registry configured there is no search box at all, rather than one that can only time out. Gating decodes from a bool or a string, because the field is documented as the first and is the second in practice: strict decoding fails the whole response, so one gated model would hide the other nineteen in a page of results. And a bug this made obvious: downloads were keyed by model and version, so the second shard of a sharded model was refused as "already fetching" until the first had finished. A fifteen-shard model had to be pulled one file at a time, each waiting on the last. Keyed by file now — which is what the single-flight was ever protecting, since the race is two writers on one .part. A version made of several files reports as the worst of them: it is not present until every shard is, and one shard failing makes the version unusable however many others arrived. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f999ee2fb2
commit
ed530133b6
13 files changed
+894
-22
No files matched your search
@@ -86,7 +86,72 @@ catalog have to spell the same file the same way — two spellings is what makes
|
||||
file that is in use look unreferenced.</p>
|
||||
{{else}}<p class="empty">The mirror is reachable and holds nothing yet.</p>{{end}}
|
||||
|
||||
{{if .HasRegistry}}
|
||||
<h2>Find a model</h2>
|
||||
<form method="get" action="/admin/mirror">
|
||||
<label>Search Hugging Face
|
||||
<input type="text" name="q" value="{{.Query}}" placeholder="qwen2.5 coder gguf"></label>
|
||||
<button type="submit">Search</button>
|
||||
</form>
|
||||
|
||||
{{if .RegistryErr}}
|
||||
{{/* Its own line, not the page's error: the registry is somebody else's server
|
||||
and it being down says nothing about the mirror, which is what this page is
|
||||
for and has to keep working when Hugging Face does not. */}}
|
||||
<p class="note error-row">The registry: {{.RegistryErr}}</p>
|
||||
{{end}}
|
||||
|
||||
{{if .Results}}
|
||||
<table><tr><th>Repository</th><th>Downloads</th><th>Task</th><th></th></tr>
|
||||
{{range .Results}}<tr>
|
||||
<td><code>{{.ID}}</code>{{if .Gated.Is}} <span class="opt">gated</span>{{end}}</td>
|
||||
<td class="num">{{compact .Downloads}}</td>
|
||||
<td>{{or .PipelineTag "—"}}</td>
|
||||
<td><a href="/admin/mirror?q={{$.Query}}&repo={{.ID}}">files</a></td>
|
||||
</tr>{{end}}
|
||||
</table>
|
||||
<p class="note">A gated repository needs its terms accepted with a Hugging Face
|
||||
account, and this browses anonymously — the files will list, and fetching one
|
||||
will fail at the mirror. Download it by hand and put it in the mirror
|
||||
directory, or give the mirror a token.</p>
|
||||
{{else if .Query}}{{if not .RegistryErr}}
|
||||
<p class="empty">Nothing matched “{{.Query}}”.</p>
|
||||
{{end}}{{end}}
|
||||
|
||||
{{if .Repo}}
|
||||
<h3>{{.Repo.ID}} <span class="opt">at {{.Repo.ShortRevision}}</span></h3>
|
||||
{{if .RepoFiles}}
|
||||
<table>
|
||||
<tr><th>File</th><th>Size</th><th>Published checksum</th><th></th></tr>
|
||||
{{range .RepoFiles}}<tr>
|
||||
<td><code>{{.Path}}</code></td>
|
||||
<td class="num">{{bytes .Bytes}}</td>
|
||||
<td>{{if .SHA256}}<code title="{{.SHA256}}">{{slice .SHA256 0 12}}</code>{{else}}—{{end}}</td>
|
||||
<td>
|
||||
<form method="post" action="/admin/mirror/fetch" class="inline">
|
||||
<input type="hidden" name="csrf" value="{{$.CSRF}}">
|
||||
<input type="hidden" name="source" value="{{.Source}}">
|
||||
<input type="hidden" name="file" value="{{.Path}}">
|
||||
<input type="text" name="model" value="{{.Model}}" size="24">
|
||||
<input type="text" name="version" value="{{.Version}}" size="10">
|
||||
<button type="submit">Fetch</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>{{end}}
|
||||
</table>
|
||||
<p class="note">Only the weights are listed; a repository is mostly a README and
|
||||
a tokenizer. The source URL is pinned to <code>{{.Repo.ShortRevision}}</code>
|
||||
rather than to a branch, so what arrives is what is listed here even if the
|
||||
branch moves in between — and the checksum above is what the registry publishes,
|
||||
to compare with what the mirror computes once it has the file.</p>
|
||||
{{else}}
|
||||
<p class="empty">No weight files in {{.Repo.ID}}.</p>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
<h2>Fetch a model</h2>
|
||||
<p class="note">By hand, for anything the search does not reach.</p>
|
||||
<form method="post" action="/admin/mirror/fetch">
|
||||
<input type="hidden" name="csrf" value="{{.CSRF}}">
|
||||
<label>Source URL
|
||||
|
||||
Reference in new issue
Block a user