Skip to content
Snippets Groups Projects
Quentin LECA's avatar
Quentin LECA authored
Merging Branch

See merge request !1
3bb28875
History

Cheese Classification challenge

This code is the model of Quentin and Rebecca

Installation

Cloning the repo:

git clone git@github.com:quentin.leca/cheese_classification_challenge.git
cd cheese_classification_challenge

Install dependencies:

conda create -n cheese_challenge python=3.10
conda activate cheese_challenge
pip install -r requirements.txt

Using this code

Training

To train your model you can run

python train.py

This will save a checkpoint in checkpoints with the name of the experiment you have. Careful, if you use the same exp name it will get overwritten

to change experiment name, you can do

python train.py experiment_name=new_experiment_name

Generating datasets

You can generate datasets with the following command

python generate.py

To use the complexs prompts with adjectives, you need to enable it in the config file configs/generate/config.yaml

IP-Adpater

The IP-Adapter structure was created and trained with the following project : https://github.com/tencent-ailab/IP-Adapter To generate a dataset with the IP-Adapter you need to place the image you want to use in the folder /dataset/IPAdapter_generate. You can find the corresponding config file in configs/generate/dataset_generator/ipadapter_prompts.yaml

You can then run the following command:

python generate_IP_Adapter.py dataset_generator=your_new_generator

Test model

You can use the test_model method to test your model with the following command:

python test_model.py experiment_name=new_experiment_name

VRAM issues

If you have vram issues either use smaller diffusion models (SD 1.5) or try CPU offloading (much slower). For example for sdxl lightning you can do

python generate.py image_generator.use_cpu_offload=true

Create submition

To create a submition file, you can run

python create_submition.py experiment_name="name_of_the_exp_you_want_to_score" model=config_of_the_exp

Make sure to specify the name of the checkpoint you want to score and to have the right model config. Make sure to specify if you want to use OCR or not in the config file