Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class TrainingConfig:
|
| 2 |
+
image_size = 128 # the generated image resolution
|
| 3 |
+
train_batch_size = 16
|
| 4 |
+
eval_batch_size = 16 # how many images to sample during evaluation
|
| 5 |
+
num_epochs = 10000
|
| 6 |
+
gradient_accumulation_steps = 1
|
| 7 |
+
learning_rate = 1e-4
|
| 8 |
+
lr_warmup_steps = 500
|
| 9 |
+
save_image_epochs = 50
|
| 10 |
+
save_model_epochs = 50
|
| 11 |
+
mixed_precision = "fp16" # `no` for float32, `fp16` for automatic mixed precision
|
| 12 |
+
output_dir = "semana1-bw-1" # the model name locally and on the HF Hub
|
| 13 |
+
|
| 14 |
+
push_to_hub = True # whether to upload the saved model to the HF Hub
|
| 15 |
+
hub_private_repo = False
|
| 16 |
+
overwrite_output_dir = True # overwrite the old model when re-running the notebook
|
| 17 |
+
seed = 22
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
preprocess = transforms.Compose(
|
| 21 |
+
[
|
| 22 |
+
transforms.Resize((config.image_size, config.image_size)),
|
| 23 |
+
transforms.Grayscale(),
|
| 24 |
+
# transforms.RandomHorizontalFlip(),
|
| 25 |
+
transforms.RandomRotation(4),
|
| 26 |
+
transforms.ToTensor(),
|
| 27 |
+
transforms.Normalize([0.5], [0.5]),
|
| 28 |
+
]
|
| 29 |
+
)
|