File size: 3,127 Bytes
ead5029
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
general:
  name: NR-1layer-basic-v1    #identity: g_mc_point_neutron_intconv_standard_L1_InputQDq_size1024
  root_dir: null
  
dset:
  cls: ReflectivityDataLoader
  prior_sampler:
    cls: SubpriorParametricSampler
    kwargs:
      param_ranges:
        thicknesses: [1., 1500.]
        roughnesses: [0., 60.]
        slds: [-8., 16.]
        r_scale: [0.9, 1.1]
        log10_background: [-10.0, -4.0]
      bound_width_ranges:
        thicknesses: [1.0e-2, 1500.]
        roughnesses: [1.0e-2, 60.]
        slds: [1.0e-2, 5.]
        r_scale: [1.0e-3, 0.2]
        log10_background: [1.0e-2, 6.0]
      shift_param_config:
        r_scale: true
        log10_background: true
      model_name: standard_model
      max_num_layers: 1
      constrained_roughness: true
      max_thickness_share: 0.5
      logdist: false
      scale_params_by_ranges: false
      scaled_range: [-1., 1.]
      device: 'cuda'
      
  q_generator:
    cls: MaskedVariableQ
    kwargs:
      q_min_range: [0.001, 0.02]
      q_max_range: [0.05, 0.4]
      n_q_range: [50, 256]
      mode: 'mixed' # 'equidistant', 'random', 'mixed'
      shuffle_mask: False
      total_thickness_constraint: True
      min_points_per_fringe: 4
      device: 'cuda'

  intensity_noise:
    cls: GaussianExpIntensityNoise
    kwargs:
      relative_errors: [0.01, 0.3]
      add_to_context: true

  smearing:
    cls: Smearing
    kwargs:
      sigma_range: [0.01, 0.12]
      gauss_num: 17
      share_smeared: 1.0
      
  curves_scaler:
    cls: LogAffineCurvesScaler
    kwargs:
      weight: 0.2
      bias: 1.0
      eps: 1.0e-10

model:
  network:
    cls: NetworkWithPriors
    pretrained_name: null
    device: 'cuda'
    kwargs:
      embedding_net_type: 'integral_conv'
      embedding_net_kwargs:
        z_num: [64, 128, 256]
        z_range: [0., 0.41]
        dim_embedding: 256
        in_dim: 1
        num_blocks: 4
        kernel_coef: 16
        use_layer_norm: true
        conv_dims: [32, 64, 128]
      pretrained_embedding_net: null
      dim_out: 7
      dim_conditioning_params: 1
      layer_width: 1024
      num_blocks: 8
      repeats_per_block: 2
      residual: true
      use_batch_norm: true
      use_layer_norm: false
      mlp_activation: 'gelu'
      dropout_rate: 0.0 
      tanh_output: false
      conditioning: 'film'
      concat_condition_first_layer: false
       
training:
  trainer_cls: PointEstimatorTrainer
  num_iterations: 300000
  batch_size: 4096
  lr: 1.0e-3
  grad_accumulation_steps: 1
  clip_grad_norm_max: null
  update_tqdm_freq: 1
  optimizer: AdamW
  trainer_kwargs:
    train_with_q_input: false
    condition_on_q_resolutions: true
    rescale_loss_interval_width: true
    use_l1_loss: true
    optim_kwargs:
      betas: [0.9, 0.999]
      weight_decay: 0.0005
  callbacks:
    save_best_model:
      enable: true
      freq: 500
    lr_scheduler:
      cls: CosineAnnealingWithWarmup
      kwargs:
        min_lr: 1.0e-6
        warmup_iters: 500
        total_iters: 300000