wandb / weave

Weave is a toolkit for developing AI-powered applications, built by Weights & Biases.
https://wandb.me/weave
Apache License 2.0
659 stars 49 forks source link

fix(weave): Defer ref zero-ing until save time #2127

Open andrewtruong opened 1 month ago

andrewtruong commented 1 month ago

Resolves:

This PR defers ref zeroing until save time (instead of immediately on mutations), which has a few effects:

  1. It allows anything dependent on the parent ref (like an OpRef) to be de-ref'd even after the object is mutated
  2. It now means that looking at the ref alone is not sufficient to tell if it's fresh or stale. You must also look at _is_dirty. In future, a helper method to check "freshness" of a ref may be useful.

Ref-zeroing already happens here:

circle-job-mirror[bot] commented 1 month ago

Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=a22854da0db0adf7723bd91dfe3a9653251343e1