input_images must be a zip file error when running a training with a file handle

Creating a Flux LoRA training failed with input_images must be a zip file even though the uploaded file was a valid zip. Maintainer mattt found the cause in how file uploads pass filenames: when you hand the client a file handle, the filename was not being sent correctly, so the model's validation logic rejected it. The fix shipped in replicate-python 0.32.1 via PR #343. The reporter confirmed upgrading fixed it. As a workaround, uploading the zip to S3 or R2 and passing the URL also works.

The input_images must be a zip file error on a valid zip comes from the client not passing the filename when you give it an open file handle, which broke the model's .zip extension check. Upgrade to replicate-python 0.32.1 or later, which carries the fix from PR #343. If you cannot upgrade, upload the zip to S3 or R2 and pass the URL as the input instead. The reporter confirmed 0.32.1 resolved it. Source: https://github.com/replicate/replicate-python/issues/338

Source: https://github.com/replicate/replicate-python/issues/338