This message was deleted.
# ask-for-help
s
This message was deleted.
c
I’m thinking about building a BentoML demo project for this actually!
I haven’t got a chance to try it myself tho, but would love to chat
s
@James-Andrew Sarmiento @Chaoyu I've implemented a version of SAM for the masks generation but unfortunately, I am running into a weird issue where the service works if I run it locally but starts failing silently once I containerize it. Any further tips appreciated since I am out of ideas here. Below are the
bentofile.yaml
and
service.py
I am using for this The error I am getting is the server disconnect after a few seconds into the request. Nothing more in
--debug
mode, it just fails silently and server restarts. ah, and also two rather annoying hacks I had to put in place for it to work. • My image shape is (550, 512, 3) (W, H, C) it works fine with pytorch but I have to setup
max_batch_size
to 1000 because bentoml thinks the first dim is the batch dim (àla tensorflow) • The return value of SAM is a list of dict containing all info about the objects masks found in the image, and nested in there are numpy array for the segmentation values. This list is thus not JSON serializable, hence my conversion .., but I have to do it back again on the receiving side. There is obviously a better version I am not aware of as of now. Thanks for reading
The `service.py``
the `bentofile.yaml``
~service: "service:sam_masks" labels: owner: "PLACEHOLDER" stage: dev include: - "*.py" docker: system_packages: - git - libgl1-mesa-glx - libglib2.0-0 python: packages: - torch - torchvision - numpy - opencv-python - git+https://github.com/facebookresearch/segment-anything.git~
If I do : $ bentoml serve service.py It works and the processing of my image takes about 45 seconds
UPDATE: it actually works as long as you allow docker sufficient resources I currently have 12Gb Memory and 2Gb Swap configured
🙌 1
c
@Sylvain LeBeux that’s great to see! we were actually thinking about building an official demo project for SAM, along with a couple other example projects we are building. would you be interested in helping to contribute this?
s
Hi @Chaoyu. Sure ! I'd be glad to help at my own level, let me know what it would entail so we could further discuss the process. Cheers !
t
@Floris Alexandrou Some insight into deploying SAM
🙌 1
c
@Sylvain LeBeux let’s chat!
s
@Chaoyu Sorry, I was on vacation last week ...
t
Hi @Sylvain LeBeux! Our Head of Engineering @Sean actually put together this example to deploy "Segment Anything". We're likely going to promote it in the coming weeks, but thought you might be interested in a sneak peak
s
Hi @Tim Liu. Sure, let me know of the details and I'll be happy to comment or help
t
@Sylvain LeBeux Whoops, so sorry, I actually forgot to include the link 😂 https://github.com/yuqwu/Replace-Anything
s
Thanks
Nice, you actually merged SAM with stable-diffusion ! There are definitely some features I was missing, such as cuda computation. Thanks a lot for sharing and nice job @Sean!
🙏 1
Funny enough, I just stumbled upon this a few minutes ago, I guessed you would find it interesting https://github.com/IDEA-Research/Grounded-Segment-Anything
👀 1