xuebinqin / DIS

This is the repo for our new project Highly Accurate Dichotomous Image Segmentation
Apache License 2.0
2.27k stars 270 forks source link

Add Replicate demo and API #55

Open ArielReplicate opened 2 years ago

ArielReplicate commented 2 years ago

Hey @xuebinqin! πŸ‘‹

Thank you for uploading the code and trained networks. It works easily and is very usefull.

This pull request makes it possible to run your model inside a Docker environment, which makes it easier for other people to run it. We're using an open source tool called Cog to make this process easier.

This also means we can make a web page where other people can run your model! View it here: https://replicate.com/arielreplicate/dichotomous_image_segmentation

Replicate also have an API, so people can easily run your model from their code:

import replicate
model = replicate.models.get("[arielreplicate/dichotomous_image_segmentation]")
model.predict(...)

Claim your page here so you can edit it, and we'll feature it on our website and tweet about it too. We will also change the name of the the model from _"arielreplicate/dichotomous_imagesegmentation" to _"xuebinqin/dichotomous_imagesegmentation"

In case you're wondering who I am, I'm from Replicate, where we're trying to make machine learning reproducible. We got frustrated that we couldn't run all the really interesting ML work being done. So, we're going round implementing models we like. 😊

DengPingFan commented 2 years ago

Hey @xuebinqin! πŸ‘‹

Thank you for uploading the code and trained networks. It works easily and is very usefull.

This pull request makes it possible to run your model inside a Docker environment, which makes it easier for other people to run it. We're using an open source tool called Cog to make this process easier.

This also means we can make a web page where other people can run your model! View it here: https://replicate.com/arielreplicate/dichotomous_image_segmentation

Replicate also have an API, so people can easily run your model from their code:

import replicate
model = replicate.models.get("[arielreplicate/dichotomous_image_segmentation]")
model.predict(...)

Claim your page here so you can edit it, and we'll feature it on our website and tweet about it too. We will also change the name of the the model from _"arielreplicate/dichotomous_imagesegmentation" to _"xuebinqin/dichotomous_imagesegmentation"

In case you're wondering who I am, I'm from Replicate, where we're trying to make machine learning reproducible. We got frustrated that we couldn't run all the really interesting ML work being done. So, we're going round implementing models we like. 😊

Hi,

The output messages are: Output CUDA out of memory. Tried to allocate 16.00 MiB (GPU 0; 14.76 GiB total capacity; 13.48 GiB already allocated; 7.75 MiB free; 13.49 GiB reserved in total by PyTorch)

Maybe it needs to remove some files dynamically.

Best,

ArielReplicate commented 1 year ago

Hi @DengPingFan, Sorry for the very late reply. It seems to work now on Replicate.com. Can you check again and tell me if you'r still getting this error?

radi-cho commented 1 year ago

The error occurs after multiple successful generations. Something is probably adding up over time.

radi-cho commented 1 year ago

@ArielReplicate https://github.com/ArielReplicate/DIS/pull/1 could optimize inference.

ArielReplicate commented 1 year ago

Yes I see the crash after few trials. Thanks @radi-cho I think using no_grad will help but probably wont solve the memory leak right? @DengPingFan can you help on this? The inference code in the commit is quite simple. Where could the memory leak come from?

radi-cho commented 1 year ago

There is another version of this model on Replicate, which doesn't seem to have a memory leak. (However, it is slower to cold start and inference because of the added support for multiple additional file formats.) https://replicate.com/pratos/dis-v1