Skip to content

[Inference Providers] Send LoRA weights for WaveSpeed tasks - #5318

Open
tomwangcn wants to merge 2 commits into
huggingface:mainfrom
tomwangcn:fix/wavespeed-lora-payload
Open

tomwangcn wants to merge 2 commits into
huggingface:mainfrom
tomwangcn:fix/wavespeed-lora-payload

Conversation

@tomwangcn

@tomwangcn tomwangcn commented Nov 8, 2026 •

Copy link
Copy Markdown

Problem

The WaveSpeed provider never forwards the LoRA adapter advertised by the Hub's inferenceProviderMapping. For live WaveSpeed LoRA mappings — e.g. Pika-Labs/Pika-H3-Flex (image-to-video, adapter="lora") and pablodawson/MiniMax-H3-360-Orbit-LoRA (image-text-to-video) — a Python client silently runs the base model and the requested LoRA has no effect on the output.

@huggingface/inference (JS) handles this in packages/inference/src/providers/wavespeed.ts (WavespeedAITask.preparePayload): when mapping.adapter === "lora" it adds loras: [{ path: mapping.hfModelId, scale: 1 }] to the payload. The Python SDK had no equivalent — wavespeed.py never looks at adapter/adapter_weights_path, unlike fal_ai.py (#3005, #4706) and replicate.py (#3054).

Fix

Add a shared _add_loras on WavespeedAITask, called from both payload builders (text-to-image/text-to-video and image-to-image/image-to-video), mirroring the JS condition and payload shape.

Tests

Two new payload tests in TestWavespeedAIProvider, using real live mapping values:

  • text-to-image with adapter="lora" adds loras: [{"path": "krea/Krea-2-Turbo", "scale": 1}]
  • image-to-video with the live Pika-Labs/Pika-H3-Flex mapping adds the LoRA entry

Both fail on current main (payload has no loras key) and pass with the fix. Full tests/test_inference_providers.py: 178 passed. ruff check / ruff format --check clean.


Note

Low Risk
Scoped change to WaveSpeed payload building with no effect when adapter is not lora; tests lock expected shape.

Overview
WaveSpeed inference payloads now include LoRA adapters when the Hub inferenceProviderMapping sets adapter="lora", matching @huggingface/inference behavior. Previously the Python client omitted loras, so LoRA-mapped models (e.g. image-to-video) ran without the adapter.

A shared _add_loras helper on WavespeedAITask injects loras: [{ "path": <hf_model_id>, "scale": 1 }] into text/image (and inherited video) task payloads. Tests cover text-to-image and image-to-video with real mapping examples.

Reviewed by Cursor Bugbot for commit 6d82f8f. Bugbot is set up for automated code reviews on this repo. Configure here.

tomwangcn and others added 2 commits November 8, 2026 17:49
The WaveSpeed provider never forwarded the LoRA adapter advertised by the
Hub's inferenceProviderMapping, so Python clients of WaveSpeed LoRA
mappings (e.g. Pika-Labs/Pika-H3-Flex, MiniMax H3 LoRAs) silently ran the
base model. Mirror @huggingface/inference (JS), which sends
loras: [{path: hf_model_id, scale: 1}] when mapping.adapter == 'lora'.
@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

This branch has not been deployed

No deployments
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