replicate / replicate-python

Python client for Replicate
https://replicate.com
Apache License 2.0
742 stars 211 forks source link

Make it hard to not pin a version #69

Closed bfirsh closed 1 year ago

bfirsh commented 1 year ago

The default way of running a prediction should be by selecting a version, not by selecting a model.

We should remove the model.predict() method, and something like this should be the recommended way to run predictions:

replicate.predict(version="27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478", input={...})

This might need syncing up with a future javascript client library. Something that @zeke might be thinking about.

zeke commented 1 year ago

PRs in service of this:

zeke commented 1 year ago

Reopening because there's still stuff to do around this.

zeke commented 1 year ago

@bfirsh @erbridge what if introduced support for a shorthand format for referencing a version?

So instead of:

replicate.predict(version="27b93a2413e7f36cd83da926f3656280b2931564ff050bf9575f1fdf9bcd7478", input={...})

We could do:

replicate.predict(version="stability-ai/stable-diffusion@27b93a", input={...})

This is nicer on the eyes and has the added benefit of making the model name discoverable.

Ben I know you're not keen on using abbreviated SHAs, but maybe in the case where you're scoping it to a specific model your concerns about it go away?

zeke commented 1 year ago

Actually this issue is done. We not only made it hard to pin a version. We made it impossible. ✅

Moving the conversation about API design to a followup issue: https://github.com/replicate/replicate-python/issues/72