Imageomics / pybioclip

Python package that simplifies using the BioCLIP foundation model.
MIT License
18 stars 3 forks source link

Adds Dockerfile + release container building #40

Closed johnbradley closed 2 months ago

johnbradley commented 2 months ago

Command to build the container for pybioclip:

docker build --platform=linux/amd64 --build-arg="PYBIOCLIP_VERSION=1.0.0" -t pybioclip .

Adds GitHub action config to build the docker container on release.

johnbradley commented 2 months ago

I plan on creating a subsequent issue/PR with to update the README. I have quite a few notes for Docker but the README is already rather long. My plan for that future work is to move the details out into the wiki and link to it from the README.

johnbradley commented 2 months ago

The image is 5.6 G in docker but somehow the apptainer image is 2.9 G. The docker image works on windows using the GPU (docker run --gpus all ...). Since docker doesn't support Mac GPU you can only use the cpu on Macs with docker. The apptainer image works on OSC with a GPU (using apptainer run --nv ...).

johnbradley commented 2 months ago

I tested and you can push an apptainer image to ghcr.io. However it will replace any existing docker. The GitHub UI also is wrong after pushing an apptainer(oras) image telling users to use docker to pull/run.

johnbradley commented 2 months ago

Given a Ursus-arctos.jpeg file in the current directory you can run the docker container like this:

docker run --platform linux/amd64 -v $(pwd):/home/bcuser -it pybioclip bioclip predict Ursus-arctos.jpeg

The first time you run it will download and cache the bioclip files in a .cache folder in your current directory(whatever is mounted into /home/bcuser).