nemo_rl.data.hf_datasets.clevr#

Module Contents#

Classes#

Functions#

pil_to_base64

Converts a PIL Image object to a base64 encoded string.

format_answer_fromtags

Extract content between tags and strip whitespace.

format_clevr_cogent_dataset

Format the CLEVR-CoGenT dataset into an OpenAI-API-like message log.

prepare_clevr_cogent_dataset

API#

nemo_rl.data.hf_datasets.clevr.pil_to_base64(image: PIL.Image.Image, format: str = 'PNG') str#

Converts a PIL Image object to a base64 encoded string.

Parameters:
  • image – The PIL Image object to convert.

  • format – The image format (e.g., “PNG”, “JPEG”). Defaults to “PNG”.

Returns:

A base64 encoded string representation of the image.

nemo_rl.data.hf_datasets.clevr.format_answer_fromtags(answer: str) str#

Extract content between tags and strip whitespace.

nemo_rl.data.hf_datasets.clevr.format_clevr_cogent_dataset(
example: dict[str, Any],
return_pil: bool = False,
) dict[str, Any]#

Format the CLEVR-CoGenT dataset into an OpenAI-API-like message log.

nemo_rl.data.hf_datasets.clevr.prepare_clevr_cogent_dataset(
split: str = 'trainA',
task_name: Optional[str] = None,
)#
class nemo_rl.data.hf_datasets.clevr.CLEVRCoGenTDataset(
split: str = 'trainA',
prompt_file: Optional[str] = None,
)#

Initialization

Simple wrapper around the CLEVR-CoGenT dataset.

Parameters:
  • split – The split of the dataset to use.

  • prompt_file – The file containing the prompt for the dataset.