Get Started
Requirements
The main requirements for sparse_caption are as follows:
python
pytorch
sentencepiece
torchvision
The full list of required packages can be found requirements_base.txt and requirements.txt.
Dependency Versions
The exact dependency versions that are tested can be found in requirements_dev_base.txt and requirements_dev.txt.
Possible {pycocotools} installation issues
One might run into issues related to
numpyorcythonwhen importingpycocotools.To resolve it, either:
Install
numpyandcythonprior to installingpycocotoolsMaybe try
pycocotools-fixinstead
This issue may lead to GitHub CI failing, if a different
numpyversion is reinstalled afterpycocotoolsis built
Installation and Setup
Docker
Setup using Docker is the most convenient.
Run
docker build -t <YOUR_TAG> -f Dockerfile .to build the image.Run the command below to launch a container. Change
<YOUR_DATASET_PATH>to your desired path. All dataset files will be placed inside<YOUR_DATASET_PATH>.docker run -it \ --gpus all \ --ipc=host \ -v .:/workspace \ -v <YOUR_DATASET_PATH>:/datasets \ -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY \ --rm <YOUR_TAG>
In the container, run
bash /workspace/scripts/dataset/setup.shto perform dataset download, pre-processing, and feature extraction.Done.
Anaconda
Windows
On Windows, you might need to install “Microsoft C++ Build Tools” in order to build
pycocotools, by downloading from this link.Tick the options as shown:

These commands should install the required packages:
conda install h5py matplotlib pandas Pillow scipy seaborn tqdm # conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch conda install pytorch torchvision torchaudio cpuonly -c pytorch conda install -c pytorch torchtext conda install -c fastai sentencepiece conda install -c conda-forge tensorboard six # For dev, optional conda install pytest conda install -c conda-forge black doc8 myst-parser sphinx sphinx-autobuild sphinx_rtd_theme
Install Java 8.
Done.