Skip to content

Conversation

Leguark
Copy link
Member

@Leguark Leguark commented Sep 24, 2025

TL;DR

Improved weights caching behavior by recalculating weights when hash mismatch occurs instead of raising an error, and added automatic cache directory initialization.

What changed?

  • Modified the behavior in interpolate_scalar_field to recalculate weights when a hash mismatch is detected instead of raising a "Cache is corrupted" error
  • Added automatic initialization of the weights cache directory in the compute_model function by calling WeightCache.initialize_cache_dir()
  • Added the necessary import for WeightCache in the model_api.py file

How to test?

  1. Run a model with caching enabled
  2. Modify the model parameters and run again to trigger a hash mismatch
  3. Verify that the model recalculates weights instead of raising an error
  4. Check that the cache directory is automatically created when running a model

Why make this change?

This change improves the user experience by making the caching system more robust. Instead of failing with an error when cached weights don't match the current model configuration, the system now gracefully recalculates the weights. Additionally, automatic cache directory initialization prevents errors that could occur if the directory doesn't exist.

@Leguark Leguark changed the title [BUG] Fix corrupted cache handling and ensure proper initialization of weight cache directory [FIX] Reuse weights calculation instead of raising error on hash mismatch Sep 24, 2025
@Leguark Leguark marked this pull request as ready for review September 24, 2025 11:59
@Leguark Leguark force-pushed the opt_tri_II branch 2 times, most recently from 405b77a to 08cb9cc Compare September 25, 2025 08:31
@Leguark Leguark force-pushed the minor_bugs branch 2 times, most recently from 5095d60 to 13e61df Compare September 25, 2025 08:36
Copy link
Member Author

Leguark commented Sep 25, 2025

Merge activity

  • Sep 25, 8:42 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Sep 25, 8:50 AM UTC: Graphite rebased this pull request as part of a merge.
  • Sep 25, 8:51 AM UTC: @Leguark merged this pull request with Graphite.

@Leguark Leguark changed the base branch from opt_tri_II to graphite-base/27 September 25, 2025 08:46
@Leguark Leguark changed the base branch from graphite-base/27 to main September 25, 2025 08:48
@Leguark Leguark merged commit a7fa2df into main Sep 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant