Skip to main content

Visual Learning Lab utility files and pipelines

Project description

vllpy

This is a package with common utility functions, files and pipelines for the Visual Learning Lab. This package uses python>=3.11.

It is recommended you create a conda environment to start using this package but this step is optional. To do so, run the commands below:

conda create -n vislearnlabpy python=3.12
conda activate vislearnlabpy

Then, activate the environment and simply install vislearnlabpy and CLIP by running the commands below in your terminal.

pip install --upgrade vislearnlabpy
pip install git+https://github.com/openai/CLIP.git

You may also have to install PyTorch manually, ensuring that you have the right version but the right version may also be installed by default with CLIP. To install the right version of PyTorch on the Tversky server, run:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Here is as an example of how to generate a CSV file with embeddings from a list of images in a directory. You can also use this to generate npy files and doc files by changing the output type in the command below, and generate the embeddings from a CSV file instead by using input_file instead of input_dir

python embedding_generator.py --input_dir examples/input --output_path examples/output --output_type csv --overwrite --model_name clip

Here is an example of how to generate npy files for embeddings from a list of images within subdirectories in a folder on Tversky using the dinov3-babyview model. For certain models, you will need a HuggingFace account and a HuggingFace access token. Set HF_TOKEN=xxxx in a .env file in the main directory of your project to be able to access restricted models. Also note that by default, npy files are generated in parallel using Ray with all available GPUs. To use specific GPUs, like the first and second GPUs for example, try using export CUDA_VISIBLE_DEVICES=0,1 Ideally run this command in a (tmux window)[https://www.redhat.com/en/blog/introduction-tmux-linux] if you have a large input directory.

python embedding_generator.py --input_dir /labs/vislearnlab/data/THINGS-dataset/object_images --output_path /labs/vislearnlab/data/THINGS-dataset/things_embeddings --output_type npy --overwrite --model_name clip --subdirs --batch_size 1000 --ray_temp_dir /Scratch/tmp/ray

For more detailed examples, please look at the demo in the Jupyter notebooks within the examples folder.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vislearnlabpy-0.0.4.2.tar.gz (54.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vislearnlabpy-0.0.4.2-py3-none-any.whl (61.9 kB view details)

Uploaded Python 3

File details

Details for the file vislearnlabpy-0.0.4.2.tar.gz.

File metadata

  • Download URL: vislearnlabpy-0.0.4.2.tar.gz
  • Upload date:
  • Size: 54.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for vislearnlabpy-0.0.4.2.tar.gz
Algorithm Hash digest
SHA256 da5c54ab57a503951a5489fa51f2b26fe95f1279e2815e029fda3b5e640b7f58
MD5 eec13c994a6417676d2bc556d5dd7fa4
BLAKE2b-256 bb6ee42144563d4461785ba629640fd5cf67a306c0f259f12dff40b34b1723a6

See more details on using hashes here.

File details

Details for the file vislearnlabpy-0.0.4.2-py3-none-any.whl.

File metadata

File hashes

Hashes for vislearnlabpy-0.0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 efc50c8a7d0cc88f39ea6254ce6ae6b007334359fa971273c65cffa8b704b4bf
MD5 eef7f34bab12b24dad230919b5066ac4
BLAKE2b-256 2dab86c597239fce975e96b1a4aa46c205e8b8c815176babe72711b88855b5e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page