-
Notifications
You must be signed in to change notification settings - Fork 2
Add support for HF tag mappings, starting with Flux LoRA #9
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
Conversation
|
I ran this locally and it looks like it worked! ⚡ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this tool!
(+ seems to work according to https://huggingface.co/api/partners/replicate/models and https://huggingface.co/api/models/fofr/flux-80s-cyberpunk?expand[]=inferenceProviderMapping)
src/hf.ts
Outdated
| @@ -1,8 +1,11 @@ | |||
| interface MappingItem { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit-picking here but an interface like that would better describe the 2 only combinations that should be supported
interface ModelMappingItem {
task: string;
hfModel: string;
providerModel: string;
status?: 'live' | 'staging';
}
interface TagFilterMappingItem {
task: string;
providerModel: string;
status?: 'live' | 'staging';
type: 'tag-filter';
tags: string[];
adapterType: 'lora';
}
type MappingItem = ModelMappingItem | TagFilterMappingItem;There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. Updated here: 09e9d7b
e73a3cd to
54d23c0
Compare
This PR updates the `ReplicateTextToImageTask` method to support running arbitrary LoRAs on Replicate. How it works: 1. Detect LoRAs by their tags before inference. 2. Use https://replicate.com/black-forest-labs/flux-dev-lora for inference 3. Use the requested LoRA as the `weights_url` input to the flux-dev-lora model ## Companion PR - replicate/huggingface-model-mappings#9 ## Testing Remove the `skip` from `describe.skip("InferenceClient" ...` in InferenceClient.spec.ts Then: ``` $ pnpx vitest run --config vitest.config.mts -t "Replicate" ``` --------- Co-authored-by: Simon Brandeis <[email protected]> Co-authored-by: célina <[email protected]> Co-authored-by: Lucain <[email protected]>
This PR updates the `ReplicateTextToImageTask` method to support running arbitrary LoRAs on Replicate. How it works: 1. Detect LoRAs by their tags before inference. 2. Use https://replicate.com/black-forest-labs/flux-dev-lora for inference 3. Use the requested LoRA as the `weights_url` input to the flux-dev-lora model ## Companion PR - replicate/huggingface-model-mappings#9 ## Testing Remove the `skip` from `describe.skip("InferenceClient" ...` in InferenceClient.spec.ts Then: ``` $ pnpx vitest run --config vitest.config.mts -t "Replicate" ``` --------- Co-authored-by: Simon Brandeis <[email protected]> Co-authored-by: célina <[email protected]> Co-authored-by: Lucain <[email protected]>
This PR adds support the new HuggingFace tag mappings feature.
Tag mappings allow you to map multiple Hugging Face models to a single Replicate model based on their tags. This is useful when you have a single Replicate model that can handle multiple variations of a model (like different LoRA adapters).
Companion PR in the inference client: