Spaces:
Running
on
Zero
Running
on
Zero
| ## **1. Composition Generation script** | |
| ### **Running the Script** | |
| Use the following command: | |
| ```bash | |
| python generate_compositions.py --config path/to/config.json --create_grids | |
| ``` | |
| ### Parameters | |
| - `--config`: Path to the configuration JSON file. | |
| - `--create_grids`: (Optional) Enable grid creation for visualization of the results. | |
| ### Configuration File | |
| The configuration file should be a JSON file containing the following keys: | |
| ### Explanation of Config Keys | |
| - `input_dir_base`: Path to the directory containing the base images. | |
| - `input_dirs_concepts`: List of paths to directories containing concept images. | |
| - `all_embeds_paths`: List of `.npy` files containing precomputed embeddings for the concepts. The order should match `input_dirs_concepts`. | |
| - `ranks`: List of integers specifying the rank for each concept’s projection matrix. The order should match `input_dirs_concepts`. | |
| - `output_base_dir`: Path to store the generated images. | |
| - `prompt` (optional): Additional text prompt. | |
| - `scale` (optional): Scale parameter passed to IP Adapter. | |
| - `seed` (optional): Random seed. | |
| - `num_samples` (optional): Number of images to generate per combination. | |
| ## 2. Text Embeddings Script | |
| This repository also includes a script for generating text embeddings using CLIP. The script takes a CSV file containing text descriptions and outputs a `.npy` file with the corresponding embeddings. | |
| ### Running the Script | |
| Use the following command: | |
| ```bash | |
| python generate_text_embeddings.py --input_csv path/to/descriptions.csv --output_file path/to/output.npy --batch_size 100 --device cuda:0 | |
| ``` | |
| ### Parameters | |
| - `--input_csv`: Path to the input CSV file containing text descriptions. | |
| - `--output_file`: Path to save the output `.npy` file. | |
| - `--batch_size`: (Optional) Batch size for processing embeddings (default: 100). | |
| - `--device`: (Optional) Device to run the model on. | |