Repository Analysis

google-research/timesfm

TimesFM (Time Series Foundation Model) is a pretrained time-series foundation model developed by Google Research for time-series forecasting.

21.1 Moderate AI signal View on GitHub
21.1
Adjusted Score
21.1
Raw Score
100%
Time Factor
2026-05-19
Last Push
20,351
Stars
Python
Language
29,840
Lines of Code
82
Files
266
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 28MEDIUM 73LOW 165

Pattern Findings

266 matches across 12 categories. Click a row to expand file-level details.

Decorative Section Separators66 hits · 246 pts
SeverityFileLineSnippet
MEDIUMtests/test_configs.py37# ---------------------------------------------------------------------------
MEDIUMtests/test_configs.py39# ---------------------------------------------------------------------------
MEDIUMtests/test_configs.py99# ---------------------------------------------------------------------------
MEDIUMtests/test_configs.py101# ---------------------------------------------------------------------------
MEDIUMtests/test_configs.py131# ---------------------------------------------------------------------------
MEDIUMtests/test_configs.py133# ---------------------------------------------------------------------------
MEDIUMtests/test_configs.py180# ---------------------------------------------------------------------------
MEDIUMtests/test_configs.py182# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_utils.py35# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_utils.py37# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_utils.py181# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_utils.py183# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_utils.py304# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_utils.py306# ---------------------------------------------------------------------------
MEDIUMtests/test_base_utils.py32# ---------------------------------------------------------------------------
MEDIUMtests/test_base_utils.py34# ---------------------------------------------------------------------------
MEDIUMtests/test_base_utils.py94# ---------------------------------------------------------------------------
MEDIUMtests/test_base_utils.py96# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_layers.py32# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_layers.py34# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_layers.py145# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_layers.py147# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_layers.py202# ---------------------------------------------------------------------------
MEDIUMtests/test_torch_layers.py204# ---------------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py45# ---------------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py47# ---------------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py93# ---------------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py95# ---------------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py167# ---------------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py169# ---------------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py192 # -----------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py194 # -----------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py294 # -----------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py296 # -----------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py386# ---------------------------------------------------------------------------
MEDIUM…casting/examples/anomaly-detection/detect_anomalies.py388# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py52# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py54# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py139# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py141# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py183# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py185# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py194 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py196 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py206 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py208 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py219 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py221 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py237 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py239 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py247 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py249 # ------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py313# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py315# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py399# ---------------------------------------------------------------------------
MEDIUM…mesfm-forecasting/examples/finetuning/finetune_lora.py401# ---------------------------------------------------------------------------
MEDIUMtimesfm-forecasting/scripts/check_system.py31# ---------------------------------------------------------------------------
MEDIUMtimesfm-forecasting/scripts/check_system.py33# ---------------------------------------------------------------------------
MEDIUMtimesfm-forecasting/scripts/check_system.py69# ---------------------------------------------------------------------------
MEDIUMtimesfm-forecasting/scripts/check_system.py71# ---------------------------------------------------------------------------
6 more matches not shown…
Cross-Language Confusion24 hits · 161 pts
SeverityFileLineSnippet
HIGH…recasting/examples/global-temperature/generate_html.py403 ...Array(nActual).fill(null),
HIGH…recasting/examples/global-temperature/generate_html.py411 dataUsed.push(step.historical_values[i]);
HIGH…recasting/examples/global-temperature/generate_html.py413 dataUsed.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py413 dataUsed.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py427 if (forecastIdx >= 0 && forecastIdx < nForecast) {{
HIGH…recasting/examples/global-temperature/generate_html.py428 q90Lower.push(step.q10[forecastIdx]);
HIGH…recasting/examples/global-temperature/generate_html.py429 q90Upper.push(step.q90[forecastIdx]);
HIGH…recasting/examples/global-temperature/generate_html.py430 q80Lower.push(step.q20[forecastIdx]);
HIGH…recasting/examples/global-temperature/generate_html.py431 q80Upper.push(step.q80[forecastIdx]);
HIGH…recasting/examples/global-temperature/generate_html.py433 q90Lower.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py433 q90Lower.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py434 q90Upper.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py434 q90Upper.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py435 q80Lower.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py435 q80Lower.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py436 q80Upper.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py436 q80Upper.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py448 if (forecastIdx >= 0 && forecastIdx < nForecast) {{
HIGH…recasting/examples/global-temperature/generate_html.py449 forecastData.push(step.point_forecast[forecastIdx]);
HIGH…recasting/examples/global-temperature/generate_html.py451 forecastData.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py451 forecastData.push(null);
HIGH…recasting/examples/global-temperature/generate_html.py227 let chart = null;
HIGH…recasting/examples/global-temperature/generate_html.py229 let playInterval = null;
HIGH…recasting/examples/global-temperature/generate_html.py275 data: [...Array(animationData.actual_data.dates.length).fill(null), ...finalStep.point_forec
Hyper-Verbose Identifiers64 hits · 78 pts
SeverityFileLineSnippet
LOWv1/experiments/extended_benchmarks/utils.py124 def _transform_quantiles_to_levels(quantiles: List[float]) -> List[int]:
LOWv1/experiments/extended_benchmarks/utils.py132 def _create_dir_if_not_exists(directory: str):
LOWv1/experiments/extended_benchmarks/utils.py136 def _transform_gluonts_instance_to_df(
LOWv1/experiments/extended_benchmarks/utils.py151 def _transform_gluonts_dataset_to_df(
LOWv1/experiments/extended_benchmarks/utils.py193 def fcst_from_level_to_quantiles(
LOWv1/experiments/extended_benchmarks/utils.py232 def evaluate_from_predictions(
LOWv1/experiments/baselines/timegpt_pipeline.py37def maybe_convert_col_to_datetime(
LOWv1/tests/test_data_loader.py9def test_train_gen_respects_batch_size_when_permute_is_false(tmp_path: Path) -> None:
LOWv1/tests/test_timesfm.py48def test_timesfm_forecast_on_df(
LOWv1/src/timesfm/pytorch_patched_decoder.py146def get_large_negative_number(dtype: torch.dtype) -> torch.Tensor:
LOWv1/src/adapter/utils.py281def _get_adapter_weight_params(
LOWv1/src/adapter/utils.py417def _initialize_adapter_params(
LOWtests/test_configs.py45 def test_defaults_match_safe_inference_settings(self):
LOWtests/test_configs.py63 def test_frozen_prevents_mutation(self):
LOWtests/test_configs.py73 def test_replace_creates_independent_copy(self):
LOWtests/test_configs.py86 def test_equality_is_structural(self):
LOWtests/test_configs.py92 def test_inequality_on_any_field_difference(self):
LOWtests/test_configs.py107 def test_frozen_prevents_mutation(self):
LOWtests/test_configs.py118 def test_activation_accepts_all_valid_literals(self):
LOWtests/test_configs.py139 def test_model_dims_must_be_divisible_by_num_heads(self):
LOWtests/test_configs.py160 def test_stacked_config_composes_correctly(self):
LOWtests/test_configs.py188 def test_frozen_prevents_mutation(self):
LOWtests/test_torch_utils.py43 def test_single_batch_matches_numpy(self):
LOWtests/test_torch_utils.py66 def test_incremental_accumulation_matches_full_computation(self):
LOWtests/test_torch_utils.py99 def test_masked_elements_excluded_from_statistics(self):
LOWtests/test_torch_utils.py119 def test_all_masked_yields_zero_stats(self):
LOWtests/test_torch_utils.py137 def test_batched_computation_independent(self):
LOWtests/test_torch_utils.py163 def test_constant_input_yields_zero_sigma(self):
LOWtests/test_torch_utils.py189 def test_forward_then_reverse_is_identity(self):
LOWtests/test_torch_utils.py206 def test_forward_produces_correct_normalization(self):
LOWtests/test_torch_utils.py217 def test_reverse_produces_correct_denormalization(self):
LOWtests/test_torch_utils.py228 def test_zero_sigma_does_not_produce_nan(self):
LOWtests/test_torch_utils.py244 def test_near_zero_sigma_guarded_by_tolerance(self):
LOWtests/test_torch_utils.py289 def test_negative_values_handled_correctly(self):
LOWtests/test_torch_utils.py325 def test_key_value_shape_consistency(self):
LOWtests/test_base_utils.py40 def test_no_nans_returns_unchanged(self):
LOWtests/test_base_utils.py46 def test_strips_leading_nans_only(self):
LOWtests/test_base_utils.py59 def test_no_leading_nan_with_internal_nans(self):
LOWtests/test_base_utils.py66 def test_single_valid_element(self):
LOWtests/test_base_utils.py72 def test_all_nans_returns_full_array(self):
LOWtests/test_base_utils.py102 def test_no_nans_returns_identical(self):
LOWtests/test_base_utils.py108 def test_interpolates_single_interior_nan(self):
LOWtests/test_base_utils.py114 def test_interpolates_multiple_interior_nans(self):
LOWtests/test_base_utils.py120 def test_extrapolates_trailing_nans(self):
LOWtests/test_base_utils.py128 def test_extrapolates_leading_nans(self):
LOWtests/test_base_utils.py144 def test_preserves_non_nan_values(self):
LOWtests/test_base_utils.py154 def test_interpolation_is_monotone_for_monotone_input(self):
LOWtests/test_base_utils.py163 def test_single_non_nan_fills_all_gaps(self):
LOWtests/test_torch_layers.py66 def test_residual_connection_nonzero(self):
LOWtests/test_torch_layers.py93 def test_all_activations_produce_valid_output(self, activation):
LOWtests/test_torch_layers.py108 def test_invalid_activation_raises(self):
LOWtests/test_torch_layers.py121 def test_gradient_flows_through_both_paths(self):
LOWtests/test_torch_layers.py153 def test_output_shape_preserved(self):
LOWtests/test_torch_layers.py160 def test_zero_scale_produces_zeros(self):
LOWtests/test_torch_layers.py173 def test_unit_scale_preserves_rms_magnitude(self):
LOWtests/test_torch_layers.py192 def test_no_nan_on_zero_input(self):
LOWtests/test_torch_layers.py235 def test_fourier_components_bounded(self):
LOW…casting/examples/anomaly-detection/detect_anomalies.py121def detect_forecast_anomalies(
LOWsrc/timesfm/timesfm_2p5/timesfm_2p5_flax.py59def _create_stacked_transformers(
LOWsrc/timesfm/timesfm_2p5/timesfm_2p5_flax.py76def _apply_stacked_transformers(
4 more matches not shown…
Over-Commented Block46 hits · 46 pts
SeverityFileLineSnippet
LOWrequirements.txt1# This file was autogenerated by uv via the following command:
LOWrequirements.txt21httpx==0.28.1
LOWrequirements.txt41tqdm==4.67.1
LOWv1/README.md221
LOWv1/experiments/extended_benchmarks/utils.py1# Copyright 2024 Google LLC
LOWv1/experiments/extended_benchmarks/run_timesfm.py1# Copyright 2024 Google LLC
LOWv1/experiments/extended_benchmarks/run_timegpt.py1# Copyright 2024 Google LLC
LOWv1/experiments/baselines/__init__.py1# Copyright 2024 Google LLC
LOWv1/experiments/baselines/timegpt_pipeline.py1# Copyright 2024 Google LLC
LOWv1/experiments/long_horizon_benchmarks/run_eval.py1# Copyright 2024 The Google Research Authors.
LOWv1/tests/test_timesfm.py1# Copyright 2024 The Google Research Authors.
LOWv1/peft/finetune.py1# Copyright 2024 The Google Research Authors.
LOWv1/src/timesfm/patched_decoder.py1# Copyright 2024 Google LLC
LOWv1/src/timesfm/timesfm_torch.py1# Copyright 2024 Google LLC
LOWv1/src/timesfm/xreg_lib.py1# Copyright 2024 Google LLC
LOWv1/src/timesfm/timesfm_jax.py1# Copyright 2024 Google LLC
LOWv1/src/timesfm/data_loader.py1# Copyright 2024 The Google Research Authors.
LOWv1/src/timesfm/pytorch_patched_decoder.py1# Copyright 2024 Google LLC
LOWv1/src/timesfm/time_features.py1# Copyright 2024 The Google Research Authors.
LOWv1/src/timesfm/__init__.py1# Copyright 2024 Google LLC
LOWv1/src/timesfm/timesfm_base.py1# Copyright 2024 Google LLC
LOWv1/src/adapter/dora_layers.py1# Copyright 2024 The Google Research Authors.
LOWv1/src/adapter/__init__.py1# Copyright 2024 Google LLC
LOWv1/src/adapter/lora_layers.py1# Copyright 2024 The Google Research Authors.
LOWv1/src/adapter/utils.py1# Copyright 2024 The Google Research Authors.
LOWtests/test_configs.py1# Copyright 2025 Google LLC
LOWtests/test_torch_utils.py1# Copyright 2025 Google LLC
LOWtests/test_base_utils.py1# Copyright 2025 Google LLC
LOWtests/test_torch_layers.py1# Copyright 2025 Google LLC
LOW…forecasting/examples/global-temperature/run_example.sh1#!/bin/bash
LOWsrc/timesfm/configs.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/__init__.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/timesfm_2p5/timesfm_2p5_torch.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/timesfm_2p5/timesfm_2p5_flax.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/timesfm_2p5/timesfm_2p5_base.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/torch/dense.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/torch/util.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/torch/__init__.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/torch/transformer.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/torch/normalization.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/utils/xreg_lib.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/flax/dense.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/flax/util.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/flax/__init__.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/flax/transformer.py1# Copyright 2025 Google LLC
LOWsrc/timesfm/flax/normalization.py1# Copyright 2025 Google LLC
Unused Imports28 hits · 28 pts
SeverityFileLineSnippet
LOWv1/experiments/extended_benchmarks/run_timegpt.py19
LOWv1/experiments/baselines/timegpt_pipeline.py18
LOWv1/src/timesfm/__init__.py19
LOWv1/src/timesfm/__init__.py19
LOWv1/src/timesfm/__init__.py19
LOWv1/src/timesfm/__init__.py19
LOWv1/src/timesfm/__init__.py28
LOWv1/src/timesfm/__init__.py29
LOWv1/src/timesfm/__init__.py33
LOWv1/src/adapter/__init__.py17
LOWv1/src/adapter/__init__.py17
LOWv1/src/adapter/__init__.py17
LOWv1/src/adapter/__init__.py18
LOWv1/src/adapter/__init__.py18
LOWv1/src/adapter/__init__.py18
LOWv1/src/finetuning/finetuning_example.py12
LOWv1/src/finetuning/finetuning_example.py17
LOW…ing/examples/covariates-forecasting/demo_covariates.py28
LOW…casting/examples/anomaly-detection/detect_anomalies.py17
LOW…orecasting/examples/global-temperature/run_forecast.py7
LOW…recasting/examples/global-temperature/generate_html.py9
LOW…ting/examples/global-temperature/visualize_forecast.py14
LOW…examples/global-temperature/generate_animation_data.py11
LOW…orecasting/examples/global-temperature/generate_gif.py8
LOWtimesfm-forecasting/scripts/forecast_csv.py21
LOWtimesfm-forecasting/scripts/check_system.py16
LOWtimesfm-forecasting/scripts/check_system.py28
LOWsrc/timesfm/__init__.py17
Docstring Block Structure4 hits · 20 pts
SeverityFileLineSnippet
HIGHv1/src/timesfm/timesfm_torch.py80Forecasts on a list of time series. Args: inputs: list of time series forecast contexts. Each context time se
HIGHv1/src/timesfm/timesfm_jax.py247Forecasts on a list of time series. Args: inputs: list of time series forecast contexts. Each context time se
HIGHv1/src/timesfm/timesfm_base.py322Forecasts on a list of time series. Args: inputs: list of time series forecast contexts. Each context time se
HIGHv1/src/timesfm/timesfm_base.py356Forecasts on a list of time series. Args: inputs: list of time series forecast contexts. Each context time se
Self-Referential Comments6 hits · 17 pts
SeverityFileLineSnippet
MEDIUMv1/experiments/extended_benchmarks/utils.py155 with multiprocessing.Pool(os.cpu_count()) as pool: # Create a process pool
MEDIUMv1/src/timesfm/patched_decoder.py68 # Create a range array for indexing
MEDIUMv1/src/timesfm/patched_decoder.py185 # Create a mask where P is 0
MEDIUMv1/src/timesfm/pytorch_patched_decoder.py92 # Create a mask where padding is 0
MEDIUMsrc/timesfm/timesfm_2p5/timesfm_2p5_torch.py331 # Create an instance of the model wrapper class.
MEDIUMsrc/timesfm/timesfm_2p5/timesfm_2p5_flax.py466 # Create an instance of the model wrapper class.
Deep Nesting14 hits · 14 pts
SeverityFileLineSnippet
LOWv1/experiments/extended_benchmarks/utils.py104
LOWv1/src/timesfm/xreg_lib.py193
LOWv1/src/timesfm/xreg_lib.py392
LOWv1/src/timesfm/timesfm_base.py53
LOWv1/src/timesfm/timesfm_base.py347
LOWv1/src/adapter/utils.py43
LOWv1/src/adapter/utils.py200
LOWv1/src/adapter/utils.py281
LOWv1/src/adapter/utils.py417
LOWtimesfm-forecasting/scripts/forecast_csv.py144
LOWtimesfm-forecasting/scripts/check_system.py127
LOWtimesfm-forecasting/scripts/check_system.py174
LOWtimesfm-forecasting/scripts/check_system.py384
LOWsrc/timesfm/utils/xreg_lib.py210
Excessive Try-Catch Wrapping7 hits · 8 pts
SeverityFileLineSnippet
LOWv1/src/timesfm/__init__.py32except Exception as _:
LOWv1/src/finetuning/finetuning_example.py327 except Exception as e:
MEDIUMv1/src/finetuning/finetuning_example.py328 print(f"Error in process {rank}: {str(e)}")
LOWv1/src/finetuning/finetuning_example.py395 except Exception as e:
LOWtimesfm-forecasting/scripts/forecast_csv.py164 except Exception:
LOWtimesfm-forecasting/scripts/check_system.py167 except Exception:
LOWtimesfm-forecasting/scripts/check_system.py218 except Exception:
Verbosity Indicators3 hits · 7 pts
SeverityFileLineSnippet
LOW…forecasting/examples/global-temperature/run_example.sh26# Step 1: Preflight check
LOW…forecasting/examples/global-temperature/run_example.sh34# Step 2: Run forecast
LOW…forecasting/examples/global-temperature/run_example.sh40# Step 3: Generate visualization
Redundant / Tautological Comments3 hits · 4 pts
SeverityFileLineSnippet
LOWv1/src/timesfm/timesfm_base.py109 if not np.any(nans): # Check if there are any NaNs
LOWtimesfm-forecasting/scripts/check_system.py388 # Check if GPU is available
LOWsrc/timesfm/timesfm_2p5/timesfm_2p5_base.py63 if not np.any(nans): # Check if there are any NaNs
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippet
LOW…forecasting/examples/global-temperature/run_example.sh9# Usage: