text
stringlengths
1
93.6k
parser.add_argument('--cla_weight', type = float,
help = "weight of generator's loss against classifier")
parser.add_argument('--dis_weight', type = float,
help = "weight of generator's loss against discriminator")
parser.add_argument('--rec_weight', type = float,
help = 'weight of reconstruction loss')
parser.add_argument('--match_weight', type = float,
help = 'weight of content matching loss')
parser.add_argument('--cla_fake', choices = ['true', 'false'],
help = "add NLU of fake samples to classifier's loss")
parser.add_argument('--dis_br_weight', type = float,
help = "weight of discriminator's batch regularization loss")
parser.add_argument('--cla_br_weight', type = float,
help = "weight of classifier's batch regularization loss")
parser.add_argument('--gen_br_weight', type = float,
help = "weight of generator's batch regularization loss")
parser.add_argument('--transform_penalty', type = float,
help = "weight of penalty of bad spatial transformation grid")
#training
parser.add_argument('--lr', type = float,
help = 'learning rate')
parser.add_argument('--sty_lr', type = float,
help = 'learning rate of style codes')
parser.add_argument('--lr_ramp', type = int,
help = 'ramp up lr from 0 in the first few iterations')
parser.add_argument('--force_dis', type = float,
help = 'keep training discriminator until its loss is lower than threshold')
parser.add_argument('--force_cla', type = float,
help = 'keep training classifier until its loss is lower than threshold')
parser.add_argument('--augment', choices = ['true', 'false'],
help = 'enable discriminator and classifier augmentation')
parser.add_argument('--max_angle', type = float,
help = 'maximum rotation angle')
parser.add_argument('--max_scale', type = float,
help = 'maximum scale')
parser.add_argument('--min_margin', type = float,
help = 'minimum distance of center of crop to image border')
parser.add_argument('--content_dropout', type = float,
help = 'base of exponential nested dropout of content code')
parser.add_argument('--style_dropout', type = float,
help = 'base of exponential nested dropout of style code')
parser.add_argument('--batch_size', type = int,
help = 'batch size')
parser.add_argument('--nloader', type = int,
help = 'number of loaders')
parser.add_argument('--niter', type = int,
help = 'number of iterations')
parser.add_argument('--save_iter', type = int,
help = 'interval of saving the latest model')
parser.add_argument('--checkpoint_iter', type = int,
help = 'interval of saving a separate checkpoint')
parser.add_argument('--log_iter', type = int,
help = 'interval of saving logs')
parser.add_argument('--visualize_iter', type = int,
help = 'interval of saving generated samples')
parser.add_argument('--visualize_size', type = int, nargs = 2,
help = 'size of visualization grid')
parser.add_argument('--device',
help = 'device (torch device string)')
options = process_options(parser.parse_args())
stage_classes = {
'stage1' : trainers.Stage1Trainer,
'stage2' : trainers.Stage2Trainer,
'classifier' : trainers.ClassifierTrainer,
'gan' : trainers.GANTrainer,
'encode' : FullDatasetEncoder
}
stage_classes[options.cmd](options).run()
# <FILESEP>
import os
import torch
from datasets import load_dataset, load_from_disk, Dataset, DatasetDict
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
BitsAndBytesConfig,
TrainingArguments,
)
from peft import LoraConfig
from trl import DPOTrainer
import sys
import argparse
from threads import finetune_prompts_dpo
import pandas as pd