Important
You are viewing the NeMo 2.0 documentation. This release introduces significant changes to the API and a new library, NeMo Run. We are currently porting all features from NeMo 1.0 to 2.0. For documentation on previous versions or features not yet available in 2.0, please refer to the NeMo 24.07 documentation.
Framework Inference#
For CLIP models, our inference script calculates CLIP similarity scores between a given image and a list of provided texts.
To enable the inference stage with a CLIP model, configure the configuration files:
In the
defaultssection ofconf/config.yaml, update thefw_inferencefield to point to the desired CLIP configuration file. For example, if you want to use theclip/clip_similarityconfiguration, change thefw_inferencefield toclip/clip_similarity.
defaults:
- fw_inference: clip/clip_similarity
...
In the
stagesfield ofconf/config.yaml, make sure thefw_inferencestage is included. For example,
stages:
- fw_inference
...
Configure
image_pathandtextsfields ofconf/fw_inference/clip/clip_similarity.yaml. Setimage_pathto the path of the image for inference, and provide a list of texts for thetextsfield.
Remarks:
To load a pretrained checkpoint for inference, set the
restore_from_pathfield in themodelsection to the path of the pretrained checkpoint in.nemoformat inconf/fw_inference/clip/clip_similarity.yaml. By default, this field links to the.nemoformat checkpoint located in the CLIP training checkpoints folder.