Skip to content

Commit ab0b7f4

Browse files
committed
polish the divider
1 parent 46c97c8 commit ab0b7f4

5 files changed

Lines changed: 19 additions & 13 deletions

File tree

src/_training/train.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function train_model(model, opt_state, train_dl, val_dl, output_dim;
132132
vprintln(VERBOSITY_NORMAL, "Starting training for up to $max_epochs epochs...")
133133
vprintln(VERBOSITY_NORMAL, "Early stopping: patience=$patience, min_delta=$min_delta")
134134
vprintln(VERBOSITY_NORMAL, "Batch size: $(train_dl.batchsize), Total batches per epoch: $(length(train_dl))")
135-
vprintln(VERBOSITY_NORMAL, "-" ^ 50)
135+
vprintln(VERBOSITY_NORMAL, hrule(50))
136136
end
137137

138138
for epoch in 1:max_epochs
@@ -163,7 +163,7 @@ function train_model(model, opt_state, train_dl, val_dl, output_dim;
163163
aggregated_r2, best_r2)
164164
model.training[] = true # Back to training mode
165165

166-
vprintln(VERBOSITY_VERBOSE, "-" ^ 50)
166+
vprintln(VERBOSITY_VERBOSE, hrule(50))
167167

168168
should_stop && break
169169
end

src/final_and_code/_helpers.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ end
4141

4242
"""Train final model and load best weights. Returns: (trained_model, stats)"""
4343
function _train_final_model!(setup, dl_train, dl_test; max_epochs=50, patience=10, print_every=100)
44-
print_phase_banner(VERBOSITY_QUIET, "🎯 FINAL MODEL TRAINING (train+val combined)")
44+
print_phase_banner(VERBOSITY_QUIET, "🎯 FINAL MODEL TRAINING (train+val combined)")
4545
best_state, stats = train_model(setup.model, setup.opt_state, dl_train, dl_test, setup.Ydim;
4646
max_epochs, patience, print_every, test_set=true, compiled_loss=setup.compiled_loss)
4747

src/final_and_code/train_code_processor.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function train_code_processor(model, dataloader, proc_wrap;
3333
processor, opt_state = _init_processor(proc_wrap, model.hp, use_hard_mask, seed)
3434

3535
# Print header
36-
print_phase_banner(VERBOSITY_QUIET, "🔧 CODE PROCESSOR TRAINING")
36+
print_phase_banner(VERBOSITY_QUIET, "🔧 CODE PROCESSOR TRAINING")
3737
vprintln(VERBOSITY_NORMAL, "Arch: $(proc_wrap.arch_type), use_hard_mask: $use_hard_mask")
3838
vprintln(VERBOSITY_NORMAL, "Seed: $seed, Epochs: $max_epochs")
3939

@@ -49,10 +49,10 @@ function train_code_processor(model, dataloader, proc_wrap;
4949
end
5050

5151
# Print summary
52-
vprintln(VERBOSITY_QUIET, "-" ^ 60)
52+
vprintln(VERBOSITY_QUIET, hrule())
5353
vprintln(VERBOSITY_QUIET, "Code processor training complete!")
5454
vprintln(VERBOSITY_QUIET, "Final loss: $(round(loss_history[end], digits=6))")
55-
vprintln(VERBOSITY_QUIET, "-" ^ 60)
55+
vprintln(VERBOSITY_QUIET, hrule())
5656

5757
return processor, loss_history
5858
end

src/tune/tuning.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function tune_hyperparameters(raw_data, create_model::Function;
1515
print_every=100, save_folder=nothing, use_cuda=true,
1616
loss_spec=(loss=Flux.mse, agg=StatsBase.mean), model_kwargs...)
1717

18-
print_phase_banner(VERBOSITY_QUIET, "🔍 HYPERPARAMETER TUNING — $n_trials trials")
18+
print_phase_banner(VERBOSITY_QUIET, "🔍 HYPERPARAMETER TUNING — $n_trials trials")
1919

2020
results = DataFrame(seed=Int[], best_r2=DEFAULT_FLOAT_TYPE[], val_loss=DEFAULT_FLOAT_TYPE[], num_params=Int[])
2121
best_r2, best_model, best_seed, best_batch = -Inf, nothing, nothing, nothing

src/verbosity.jl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,24 @@ function vprint(level::Integer, args...)
8080
nothing
8181
end
8282

83+
# Continuous horizontal rule (U+2500). A run of these renders as one unbroken
84+
# line, unlike the gappy ASCII hyphen. Used for banners and section dividers.
85+
hrule(width::Integer=60) = "" ^ width
86+
8387
"""
8488
print_phase_banner(level, title; width=60)
8589
86-
Print a centered, full-width banner bounded by long-dash rules announcing a
87-
high-level phase (e.g. tuning, final training, code-processor training).
88-
Gated by `level` exactly like [`vprintln`](@ref); defaults to a banner width
89-
of `width` characters and is preceded by a blank line so it stands out.
90+
Print a centered, full-width banner bounded by continuous horizontal rules
91+
(see [`hrule`](@ref)) announcing a high-level phase (e.g. tuning, final
92+
training, code-processor training). Gated by `level` exactly like
93+
[`vprintln`](@ref); the banner is `width` columns wide and is preceded by a
94+
blank line so it stands out. Centering uses `textwidth`, so titles containing
95+
double-width glyphs (emoji) still land in the middle.
9096
"""
9197
function print_phase_banner(level::Integer, title::AbstractString; width::Integer=60)
9298
_should_log(level) || return nothing
93-
rule = "-" ^ width
94-
pad = max(0, (width - length(title)) ÷ 2)
99+
rule = hrule(width)
100+
pad = max(0, (width - textwidth(title)) ÷ 2)
95101
println()
96102
println(rule)
97103
println(" " ^ pad, title)

0 commit comments

Comments
 (0)