Add ModelRegistry.repoOverrides so mirrored repos can be resolved - #824
Open
omachala wants to merge 1 commit into
Open
Add ModelRegistry.repoOverrides so mirrored repos can be resolved#824omachala wants to merge 1 commit into
omachala wants to merge 1 commit into
Conversation
baseURL repoints only the registry host, but repository paths come from the hardcoded Repo enum, so a mirror hosted under a different owner on the same registry cannot be reached. repoOverrides maps upstream repo paths to alternates and is applied in both apiModels and resolveModel, so listing and downloading can never diverge. Matching is longest-prefix, which covers the Repo cases that carry a subpath. Unmapped repositories resolve upstream unchanged, so a partial mirror is safe. Defaults to an empty map: upstream behaviour is unchanged.
Author
|
Hi @BrandonWeng 👋 just to let you know, I am around if you have any questions or any feedback.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
baseURLalready lets you point FluidAudio at a different registry host. What it does not let you do is point at a different owner, because the repository paths come from theRepoenum and those are baked in asFluidInference/....That gap shows up as soon as you mirror the models. We ship FluidAudio in an iOS app, and we want the model downloads our users trigger to come from a namespace we control, so we can read the release notes and test a new build before it reaches anyone. Setting
baseURLto our own Hugging Face org does not get us there, since the path still saysFluidInference/. Editing the enum does, but it has 82 cases and you add to it regularly, so we would be rebasing on every release.A map felt like the smaller change:
Applied in both places that build a repo URL,
apiModelsandresolveModel, so listing and downloading can never point at different repos. Matching is longest-prefix, which picks up the cases carrying a subpath likeparakeet-realtime-eou-120m-coreml/160ms. Anything unmapped resolves upstream unchanged, so a partial mirror is safe and new models you add keep working with nobody touching their config.The default is an empty dictionary, so behavior is byte-identical unless someone sets it. It follows the same
nonisolated(unsafe)static pattern as_customBaseURLdirectly above it.Tests cover the no-op case, redirect through both call sites, fall-through for unmapped repos, subpath mapping, longest-prefix precedence, and composition with a custom
baseURL.Happy to rename it or change the matching rule if you would rather it behaved differently. We are running this in a fork either way, so there is no pressure on your side.
Disclosure: the code and this description were written in cooperation with AI coding agents.