Class: Gsplat::Training::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/gsplat/training/config.rb

Overview

Trainer hyperparameters matching the upstream simple trainer defaults.

Constant Summary collapse

DEFAULTS =

Default training, optimizer, evaluation, and output options.

{
  max_steps: 30_000,
  batch_size: 1,
  sh_degree: 3,
  sh_degree_interval: 1_000,
  ssim_lambda: 0.2,
  init_opacity: 0.1,
  init_scale: 1.0,
  means_lr: 1.6e-4,
  means_lr_final: 1.6e-6,
  scales_lr: 5e-3,
  quats_lr: 1e-3,
  opacities_lr: 5e-2,
  sh0_lr: 2.5e-3,
  shN_lr: 1.25e-4,
  opacity_reg: 0.0,
  scale_reg: 0.0,
  eval_steps: [7_000, 30_000],
  save_steps: [7_000, 30_000],
  log_every: 100,
  random_background: false,
  near_plane: 0.01,
  far_plane: 1e10,
  tile_size: 16,
  rasterize_mode: "classic",
  model_type: :three_d,
  output_dir: "results",
  seed: 42
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Config

rubocop:enable Naming/MethodName

Raises:

  • (ArgumentError)


48
49
50
51
52
53
54
55
56
57
# File 'lib/gsplat/training/config.rb', line 48

def initialize(**options)
  unknown = options.keys - DEFAULTS.keys
  raise ArgumentError, "unknown trainer options: #{unknown.join(', ')}" unless unknown.empty?

  DEFAULTS.merge(options).each do |name, value|
    value = value.dup if value.is_a?(Array)
    instance_variable_set(:"@#{name}", value)
  end
  validate!
end

Instance Attribute Details

#batch_sizeObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def batch_size
  @batch_size
end

#eval_stepsObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def eval_steps
  @eval_steps
end

#far_planeObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def far_plane
  @far_plane
end

#init_opacityObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def init_opacity
  @init_opacity
end

#init_scaleObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def init_scale
  @init_scale
end

#log_everyObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def log_every
  @log_every
end

#max_stepsObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def max_steps
  @max_steps
end

#means_lrObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def means_lr
  @means_lr
end

#means_lr_finalObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def means_lr_final
  @means_lr_final
end

#model_typeObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def model_type
  @model_type
end

#near_planeObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def near_plane
  @near_plane
end

#opacities_lrObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def opacities_lr
  @opacities_lr
end

#opacity_regObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def opacity_reg
  @opacity_reg
end

#output_dirObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def output_dir
  @output_dir
end

#quats_lrObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def quats_lr
  @quats_lr
end

#random_backgroundObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def random_background
  @random_background
end

#rasterize_modeObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def rasterize_mode
  @rasterize_mode
end

#save_stepsObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def save_steps
  @save_steps
end

#scale_regObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def scale_reg
  @scale_reg
end

#scales_lrObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def scales_lr
  @scales_lr
end

#seedObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def seed
  @seed
end

#sh0_lrObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def sh0_lr
  @sh0_lr
end

#sh_degreeObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def sh_degree
  @sh_degree
end

#sh_degree_intervalObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def sh_degree_interval
  @sh_degree_interval
end

#shN_lrObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def shN_lr
  @shN_lr
end

#ssim_lambdaObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def ssim_lambda
  @ssim_lambda
end

#tile_sizeObject (readonly)

rubocop:disable Naming/MethodName



39
40
41
# File 'lib/gsplat/training/config.rb', line 39

def tile_size
  @tile_size
end

Instance Method Details

#to_hHash{Symbol=>Object}

Returns an independent hash suitable for checkpoint metadata.

Returns:

  • (Hash{Symbol=>Object})


62
63
64
# File 'lib/gsplat/training/config.rb', line 62

def to_h
  DEFAULTS.keys.to_h { |name| [name, public_send(name)] }
end