fix(examples): migrate global-temperature animation generator to TimesFM 2.5 - #465
Open
ihubanov wants to merge 1 commit into
Open
fix(examples): migrate global-temperature animation generator to TimesFM 2.5#465ihubanov wants to merge 1 commit into
ihubanov wants to merge 1 commit into
Conversation
…sFM 2.5 generate_animation_data.py was missed by 6ed1d8a, which migrated the rest of the example. It still calls the removed v1 API and fails on the first model load: AttributeError: module 'timesfm' has no attribute 'TimesFmHparams' Port it to from_pretrained + ForecastConfig + forecast(horizon=...) and drop the frequency indicator, which 2.5 removed. Also correct the quantile column mapping. Index 0 is the mean, so q10/q20/q80 /q90 are at 1/2/8/9, not 0/1/7/8. The old mapping stored the mean in the q10 slot, which left the lower band crossing above q20 in the committed data (q10=1.2482 > q20=1.1407); it is correctly ordered now (1.1231 < 1.1614). Regenerate animation_data.json and the two artifacts derived from it. Refs google-research#423
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@googlebot I signed it! |
This was referenced Aug 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
generate_animation_data.pystill uses the v1 API that 2.5 removed, so it dies on the first model load:6ed1d8a migrated
run_forecast.pyandvisualize_forecast.pyfor this example but left this script behind. The GIF and HTML still build only becauseoutput/animation_data.jsonis committed; delete it and the animation cannot be rebuilt.Changes
TimesFM_2p5_200M_torch.from_pretrained+model.compile(ForecastConfig(...)), matchingrun_forecast.pyin the same directory.horizonexplicitly toforecast()and dropfreq=[0], since 2.5 has no frequency indicator.The quantile bug is visible in the committed output. The band labelled
q10was actually the mean, so it sat aboveq20:Verification
Ran the example end to end on CPU (Python 3.13, torch 2.13.0+cpu):
q10 <= q20 <= q80 <= q90, no NaN.run_forecast.py'sforecast_output.jsonexactly on the point forecast and every quantile. That cross-check was impossible before, since the two scripts targeted different model versions.animation_data.jsonand the two artifacts derived from it.forecast_output.csv,forecast_output.jsonandforecast_visualization.pngare left untouched. Re-running only perturbs them around the 7th decimal, so there is no reason to churn them here.Not covered here
examples/anomaly-detection/detect_anomalies.pyhas the same v1 API problem.examples/covariates-forecasting/demo_covariates.pyis already handled by docs(examples): update covariates demo API snippet to TimesFM 2.5 #445.README.mdstill documents the v1 API and claims the 2.5 PyTorch checkpoint fails to load, which is no longer accurate.Happy to fold any of those in if you would prefer a single PR.
Refs #423