File size: 3,031 Bytes
c61c435
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
MODEL_INFO = {
    "name": "Neural Cellular Automata",
    "short_name": "NCA",
    "category": "Cellular Automata",
    "description": "Learns local cellular update rules that grow images from a single living seed.",
    "supports_training": True,
    "supports_generation": True,
    "order": 10,
}

TRAINING_SETTINGS = {
    "training_mode": {
        "label": "Training mode",
        "type": "choice",
        "options": ["Single target", "Dataset average (experimental)"],
        "default": "Single target",
    },
    "target_image": {"label": "Target image", "type": "file", "default": ""},
    "epochs": {"label": "Training steps", "type": "int", "default": 500, "min": 1, "max": 100000},
    "batch_size": {"type": "int", "default": 8, "min": 1, "max": 128},
    "learning_rate": {"type": "float", "default": 0.001, "min": 0.0000001},
    "resolution": {"label": "Target resolution", "type": "choice", "options": [32, 64, 128], "default": 64},
    "cell_channels": {"type": "int", "default": 16, "min": 4, "max": 64},
    "hidden_size": {"type": "int", "default": 128, "min": 16, "max": 512},
    "min_growth_steps": {"type": "int", "default": 64, "min": 1, "max": 512},
    "max_growth_steps": {"type": "int", "default": 96, "min": 1, "max": 1024},
    "stable_growth": {"label": "Stable growth training", "type": "bool", "default": False},
    "stable_max_growth_steps": {"label": "Stable maximum growth steps", "type": "int", "default": 160, "min": 1, "max": 2048},
    "fire_rate": {"label": "Update probability", "type": "slider", "default": 0.5, "min": 0.05, "max": 1.0, "resolution": 0.05},
    "random_seed": {"type": "int", "default": 42},
    "mixed_precision": {"type": "bool", "default": True},
    "device": {"type": "choice", "options": ["auto", "cuda", "cpu"], "default": "auto"},
    "preview_every": {"label": "Preview every N steps", "type": "int", "default": 10, "min": 1},
    "checkpoint_every": {"label": "Checkpoint every N steps", "type": "int", "default": 50, "min": 1},
    "loss_smoothing_window": {"label": "Loss smoothing window", "type": "int", "default": 25, "min": 1, "max": 1000},
    "fit_mode": {"label": "Image fit", "type": "choice", "options": ["contain", "crop", "stretch"], "default": "contain"},
    "background": {"type": "choice", "options": ["transparent", "white", "black"], "default": "transparent"},
    "horizontal_flip": {"label": "Random horizontal flip", "type": "bool", "default": False},
    "resume_checkpoint": {"label": "Resume checkpoint (optional)", "type": "file", "default": ""},
}

GENERATION_SETTINGS = {
    "growth_steps": {"type": "int", "default": 100, "min": 1, "max": 5000},
    "seed": {"type": "int", "default": -1},
    "fire_rate": {"label": "Update probability", "type": "slider", "default": 0.5, "min": 0.05, "max": 1.0, "resolution": 0.05},
    "animate_growth": {"type": "bool", "default": True},
    "frame_every": {"label": "Save every Nth step", "type": "int", "default": 5, "min": 1},
    "export_gif": {"type": "bool", "default": True},
}