NCA-GENM Question 147
Select 3You are tasked with writing a Python script to preprocess image and text data for a multimodal generative AI model under the supervision of a senior team member. The senior team member instructs you to ensure that the image data is resized to a specific dimension and normalized, and the text data is tokenized properly using a pre-trained tokenizer. Which of the following steps should you include in your script?
- A
Resize all images to the required dimensions using a deep learning library like PyTorch or TensorFlow.
- B
Normalize pixel values of the images to a range of 0 to 1.
- C
Tokenize the text data using a pre-trained tokenizer and convert tokens to numerical input IDs.
- D
Manually write a custom tokenizer for the text data instead of using a pre-trained one.
- E
Skip resizing the images as the model will handle it during training.
Show answer and explanation
Correct answers: A, B, C
Explanation
To prepare data for a multimodal generative AI model, it is crucial to preprocess both image and text data correctly. Images must be resized and normalized to meet model requirements, and text data should be tokenized using a pre-trained tokenizer to ensure compatibility with the model. These steps ensure the data is in a format that the model can process effectively.
- A. Correct.
This step is necessary to ensure that all images have a consistent dimension, which is required for processing by a multimodal model.
- B. Correct.
Normalizing pixel values ensures that the image data is scaled appropriately, which can improve model performance and training stability.
- C. Correct.
Tokenizing the text data using a pre-trained tokenizer ensures compatibility with the model architecture, as the model expects input IDs derived from the tokenizer.
- D. Incorrect.
Writing a custom tokenizer is unnecessary and inefficient when pre-trained tokenizers are available and optimized for this task.
- E. Incorrect.
Skipping image resizing is incorrect because the model expects images of a specific size as input; resizing should be handled during preprocessing.