Add new ML inference examples for image and video generation#28
Add new ML inference examples for image and video generation#28
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 30f894a9dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pipe = FluxPipeline.from_pretrained( | ||
| "black-forest-labs/FLUX.1-schnell", | ||
| torch_dtype=torch.bfloat16, | ||
| ) | ||
| pipe.enable_model_cpu_offload() |
There was a problem hiding this comment.
Cache the FLUX pipeline instead of recreating it per request
generate_image rebuilds FluxPipeline on every call, so each request pays full model initialization/offload cost instead of reusing a warm worker. In practice this can turn steady-state requests into repeated cold starts (large latency spikes and higher timeout risk) once traffic exceeds a single call, even though the endpoint is configured to keep workers warm.
Useful? React with 👍 / 👎.
| # ADA_24 gives us an RTX 4090-class GPU with 24GB — plenty of room. | ||
| gpu_config = LiveServerless( | ||
| name="02_02_flux_schnell", | ||
| gpus=[GpuGroup.AMPERE_80], |
There was a problem hiding this comment.
Use the intended GPU class for the FLUX worker
This worker is documented as fitting on ADA_24, but the config requests GpuGroup.AMPERE_80. That mismatch makes the example harder to run in environments that only expose 24GB GPUs and unnecessarily raises cost/capacity requirements, which can leave deployments unschedulable despite the model's stated VRAM profile.
Useful? React with 👍 / 👎.
Summary
Notes
Validation