Skip to content

Commit

Permalink
Pre-upload validating server autograd runs and optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
momchil-flex committed Oct 28, 2024
1 parent 42070df commit 143efcf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/test_plugins/test_invdes.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def make_result(use_emulated_run): # noqa: F811
"""Test running the optimization defined in the ``InverseDesign`` object."""

optimizer = make_optimizer()
optimizer.validate_pre_upload()

return optimizer.run(post_process_fn=post_process_fn)

Expand Down
2 changes: 1 addition & 1 deletion tidy3d/plugins/invdes/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def initial_state(self, parameters: np.ndarray) -> dict:

def validate_pre_upload(self) -> None:
"""Validate the fully initialized optimizer is ok for upload to our servers."""
pass
self.design.simulation.validate_pre_upload()

def display_fn(self, result: InverseDesignResult, step_index: int) -> None:
"""Default display function while optimizing."""
Expand Down
1 change: 1 addition & 0 deletions tidy3d/web/api/autograd/autograd.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ def _run_primitive(
)

else:
sim_combined.validate_pre_upload()
sim_original = sim_original.updated_copy(simulation_type="autograd_fwd", deep=False)
run_kwargs["simulation_type"] = "autograd_fwd"
run_kwargs["sim_fields_keys"] = list(sim_fields.keys())
Expand Down

0 comments on commit 143efcf

Please sign in to comment.