Skip to content

Commit

Permalink
Add a --no-optimize-images
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGross committed Nov 6, 2024
1 parent 2e1d241 commit ccea571
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions notebooks_jason/max_of_K_all_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@
default=False,
help="Only optimize images, then quit",
)
parser.add_argument(
"--optimize-images",
action=BooleanOptionalAction,
default=True,
help="Optimize images",
)
parser.add_argument(
"--individual-plots",
action=BooleanOptionalAction,
Expand Down Expand Up @@ -281,6 +287,7 @@
N_THREADS: Optional[int] = cli_args.n_threads
DISPLAY_PLOTS: bool = False # @param {type:"boolean"}
SAVE_PLOTS: bool = cli_args.plots
OPTIMIZE_IMAGES: bool = cli_args.optimize_images
RENDERER: Optional[str] = "png" # @param ["png", None]
PLOT_WITH: Literal["plotly", "matplotlib"] = ( # @param ["plotly", "matplotlib"]
"matplotlib"
Expand Down Expand Up @@ -416,8 +423,8 @@ def optimize_pngs(errs: list[Exception] = []):
from gbmi.exp_max_of_n.plot import (
EVOU_max_minus_diag_logit_diff,
attention_difference_over_gap,
display_basic_interpretation,
compute_basic_interpretation_axis_limits,
display_basic_interpretation,
display_EQKE_SVD_analysis,
hist_attention_difference_over_gap,
hist_EVOU_max_minus_diag_logit_diff,
Expand Down Expand Up @@ -4118,7 +4125,7 @@ def texify(s: Optional[str]) -> Optional[str]:
del latex_figures
gc.collect()
# %%
if SAVE_PLOTS:
if SAVE_PLOTS and OPTIMIZE_IMAGES:
optimize_pngs()

print_and_raise_errs()
Expand Down

0 comments on commit ccea571

Please sign in to comment.