diff --git a/cog_test_train.sh b/cog_test_train.sh index 742c7ee..d19e9d6 100644 --- a/cog_test_train.sh +++ b/cog_test_train.sh @@ -7,6 +7,6 @@ cog predict --gpus $GPU_ID \ -i concept_mode="face" \ -i sd_model_version="sdxl" \ -i max_train_steps="360" \ - -i caption_model="gpt4-v" \ + -i caption_model="blip" \ -i debug="False" \ -i seed="0" \ No newline at end of file diff --git a/predict.py b/predict.py index a7f3b62..882074c 100755 --- a/predict.py +++ b/predict.py @@ -86,10 +86,6 @@ class Predictor(BasePredictor): description="Number of steps between saving checkpoints. Set to very very high number to disable checkpointing, because you don't need intermediate checkpoints.", default=10000, ), - is_lora: bool = Input( - description="Whether to use LoRA training. If set to False, will use full fine tuning", - default=True, - ), unet_lr: float = Input( description="final learning rate of unet (after warmup)", default=0.001, @@ -144,15 +140,13 @@ class Predictor(BasePredictor): train_batch_size=train_batch_size, max_train_steps=max_train_steps, checkpointing_steps=checkpointing_steps, - is_lora=is_lora, - prodigy_d_coef=prodigy_d_coef, ti_lr=ti_lr, + unet_lr=unet_lr, lora_rank=lora_rank, caption_model=caption_model, n_tokens=n_tokens, verbose=verbose, debug=debug, - text_encoder_lora_optimizer=text_encoder_lora_optimizer, freeze_ti_after_completion_f=freeze_ti_after_completion_f, token_warmup_steps=token_warmup_steps ) diff --git a/trainer/preprocess.py b/trainer/preprocess.py index 6b367af..be58c11 100755 --- a/trainer/preprocess.py +++ b/trainer/preprocess.py @@ -521,7 +521,14 @@ def gpt4_v_caption_dataset( } response = requests.post("https://api.openai.com/v1/chat/completions", headers=headers, json=payload) - return index, response.json()["choices"][0]["message"]["content"] + + try: + result = response.json()["choices"][0]["message"]["content"] + except: + print(response.json()) + result = "" + + return index, result with concurrent.futures.ThreadPoolExecutor(max_workers=batch_size) as executor: future_to_index = {executor.submit(fetch_caption, i, img): i for i, img in enumerate(images) if captions[i] is None} diff --git a/trainer/utils/utils.py b/trainer/utils/utils.py index 843b933..a088c09 100755 --- a/trainer/utils/utils.py +++ b/trainer/utils/utils.py @@ -37,6 +37,8 @@ def replace_in_string(s, replacements): return s def fix_prompt(prompt: str): + if not prompt: + return prompt # Remove extra commas and spaces, and fix space before punctuation prompt = re.sub(r"\s+", " ", prompt) # Replace multiple spaces with a single space prompt = re.sub(r",,", ",", prompt) # Replace double commas with a single comma diff --git a/training_args_face.json b/training_args_face.json index 499d3ef..4c4260a 100644 --- a/training_args_face.json +++ b/training_args_face.json @@ -1,7 +1,7 @@ { "output_dir": "lora_models/xander_best", - "sd_model_version": "sd15", - "lora_training_urls": "/home/rednax/Documents/datasets/people/xander", + "sd_model_version": "sdxl", + "lora_training_urls": "https://storage.googleapis.com/public-assets-xander/A_workbox/lora_training_sets/xander_5.zip", "concept_mode": "face", "seed": 0, "resolution": 512,