docs(examples): update covariates demo API snippet to TimesFM 2.5#445
Open
evanclan wants to merge 1 commit into
Open
docs(examples): update covariates demo API snippet to TimesFM 2.5#445evanclan wants to merge 1 commit into
evanclan wants to merge 1 commit into
Conversation
The demonstrate_api() helper in the covariates example prints a snippet titled "TIMESFM COVARIATES API (TimesFM 2.5)" but uses the removed v1 API (timesfm.TimesFmHparams / TimesFmCheckpoint / timesfm.TimesFm), which no longer exists in the installed 2.5 package and raises AttributeError when copy-pasted (see google-research#423). This finishes the v1->2.5 example migration started in 6ed1d8a for the global-temperature example, mirroring that commit's from_pretrained + ForecastConfig loading pattern and noting that the 10 quantile columns are [mean, q10..q90] in 2.5.
|
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. |
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.
Summary
The
demonstrate_api()helper in the covariates example prints a snippet titled "TIMESFM COVARIATES API (TimesFM 2.5)" but shows the removed v1 API. This finishes the v1→2.5 example migration started by the maintainer in6ed1d8a("Update global-temperature example to use TimesFM 2.5 API") and addresses the v1-API breakage reported in #423.Problem
timesfm-forecasting/examples/covariates-forecasting/demo_covariates.py(indemonstrate_api()) prints:But
src/timesfm/__init__.pyonly exportsForecastConfig,TimesFM_2p5_200M_torch, andTimesFM_2p5_200M_flax.TimesFmHparams/TimesFmCheckpoint/TimesFmno longer exist in the 2.5 package, so a user copy-pasting this "2.5" snippet hitsAttributeError: module 'timesfm' has no attribute 'TimesFmHparams'— exactly the class of breakage called out in #423 ("the old v1 API … no longer exists in the installed package").Solution
Replace the loading lines with the real 2.5 API, mirroring the pattern the maintainer used when migrating the sibling example in
6ed1d8a(from_pretrained(...) + model.compile(ForecastConfig(...))). Also corrected the trailing shape comment to note that the 10 quantile columns are[mean, q10, …, q90]in 2.5 (the same column-layout change6ed1d8adocumented), and dropped thehorizon_lenwording that belonged to the v1 hparams object.The
forecast_with_covariates(...)call below was already correct and is unchanged.Out of scope
The same removed-v1-API pattern still appears in
examples/anomaly-detection/detect_anomalies.py,examples/global-temperature/generate_animation_data.py, andexamples/global-temperature/README.md. Those are executable scripts / a generated report whose committed output artifacts would need regenerating with a model run, so I left them out of this docs-only snippet fix to keep the change reviewable. Happy to follow up on them in a separate PR.Test plan
python -m py_compile timesfm-forecasting/examples/covariates-forecasting/demo_covariates.pypasses.TimesFM_2p5_200M_torch,ForecastConfig, andfrom_pretrainedare the current public API insrc/timesfm/__init__.pyand that the new snippet matches6ed1d8a+timesfm-forecasting/references/api_reference.md.Related
Made with Cursor