You don't need to run the prompts generation codes as we already provide the generated prompts and can be downloaded from this link.
However, we provide also all the generation codes in this folder, where you can run it as follows:
We adopted LAION fast retrieval tool to retrieve training data (Nearest Neighbours) from LAION with text prompts.
python retrieve.py --file_path path/to/prompt --save_path path/to/prompt_with_img
And save the training data clip embedding with CLIP
model, preprocess = clip.load('ViT-B/32', device=device)
image = Image.open(image_path).convert('RGB')
inputs = preprocess(images=image, return_tensors="pt").to(device, torch.float16)
with torch.no_grad():
gen_image_embd = model.encode_image(inputs).half()
Run our prompt generation file with the desired arguments:
1) Your openai.api_key
2) The desired num of generated prompts # e.g., 1000
3) The desired skill # e.g., "bias"
For instance:
python chatGPT_inference.py [your openai_api_key] 3000 "counting"