← Về thư mục
tests/timesfm-forecasting/test_scripts.py
- usage · function · L59-L63 — def usage(free_gb: float)
- report_with_gpu · function · L66-L71 — def report_with_gpu(value: str, status: str = "pass") -> check_system.SystemReport
- ModelProfileTests · class · L74-L104 — class ModelProfileTests(unittest.TestCase)
- test_the_three_documented_checkpoints_are_offered · method · L75-L76 — def test_the_three_documented_checkpoints_are_offered(self) -> None
- test_each_profile_points_at_its_published_hugging_face_repo · method · L78-L87 — def test_each_profile_points_at_its_published_hugging_face_repo(self) -> None: # A wrong repo id is a 404 at download time, long after the check passed.
- test_the_five_hundred_million_model_asks_for_the_most_memory · method · L89-L95 — def test_the_five_hundred_million_model_asks_for_the_most_memory(self) -> None: # v2.0 is 500M parameters against 200M for the other two.
- test_no_profile_recommends_less_than_it_requires · method · L97-L104 — def test_no_profile_recommends_less_than_it_requires(self) -> None
- RamCheckTests · class · L107-L148 — class RamCheckTests(unittest.TestCase)
- check · method · L110-L113 — def check(self, total: float, available: float = 4.0)
- test_below_the_minimum_fails_and_explains_the_consequence · method · L115-L118 — def test_below_the_minimum_fails_and_explains_the_consequence(self) -> None
- test_exactly_the_minimum_warns_rather_than_failing · method · L120-L122 — def test_exactly_the_minimum_warns_rather_than_failing(self) -> None: # 8 GB is enough to load the model, just not comfortably.
- test_just_under_the_recommendation_still_warns · method · L124-L127 — def test_just_under_the_recommendation_still_warns(self) -> None
- test_exactly_the_recommendation_passes · method · L129-L130 — def test_exactly_the_recommendation_passes(self) -> None
- test_the_reported_value_carries_both_totals · method · L132-L135 — def test_the_reported_value_carries_both_totals(self) -> None
- test_the_smaller_model_passes_where_the_larger_one_fails · method · L137-L148 — def test_the_smaller_model_passes_where_the_larger_one_fails(self) -> None: # 4 GB: below v2.0's 8 GB minimum, but at v2.5's recommendation.
- DiskCheckTests · class · L151-L179 — class DiskCheckTests(unittest.TestCase)
- test_less_free_space_than_the_weights_need_fails · method · L154-L158 — def test_less_free_space_than_the_weights_need_fails(self) -> None
- test_exactly_enough_space_passes · method · L160-L162 — def test_exactly_enough_space_passes(self) -> None
- test_the_cache_directory_is_where_the_space_is_measured · method · L164-L172 — def test_the_cache_directory_is_where_the_space_is_measured(self) -> None: # The advice is "set HF_HOME to a larger volume", so that variable has # to be what the check actually looks at.
- test_an_absent_cache_directory_falls_back_to_the_home_volume · method · L174-L179 — def test_an_absent_cache_directory_falls_back_to_the_home_volume(self) -> None
- PythonCheckTests · class · L182-L199 — class PythonCheckTests(unittest.TestCase)
- interpreter · method · L184-L185 — def interpreter(major: int, minor: int)
- test_the_documented_minimum_of_three_ten_passes · method · L187-L189 — def test_the_documented_minimum_of_three_ten_passes(self) -> None
- test_three_nine_fails_and_states_the_requirement · method · L191-L195 — def test_three_nine_fails_and_states_the_requirement(self) -> None
- test_a_newer_interpreter_passes · method · L197-L199 — def test_a_newer_interpreter_passes(self) -> None
- PackageCheckTests · class · L202-L223 — class PackageCheckTests(unittest.TestCase)
- test_an_installed_package_reports_its_version · method · L203-L209 — def test_an_installed_package_reports_its_version(self) -> None
- test_a_missing_package_warns_instead_of_failing · method · L211-L216 — def test_a_missing_package_warns_instead_of_failing(self) -> None: # The whole point is to run this before installing TimesFM, so a missing # package must not make the report fail and block the workflow.
- test_a_package_without_a_version_is_still_installed · method · L218-L223 — def test_a_package_without_a_version_is_still_installed(self) -> None
- GpuCheckTests · class · L226-L267 — class GpuCheckTests(unittest.TestCase)
- torch_module · method · L228-L240 — def torch_module(*, cuda: bool, mps: bool = False, vram_gb: float = 24.0)
- test_a_cuda_device_is_reported_with_its_vram · method · L242-L247 — def test_a_cuda_device_is_reported_with_its_vram(self) -> None
- test_apple_silicon_passes_without_a_vram_figure · method · L249-L255 — def test_apple_silicon_passes_without_a_vram_figure(self) -> None: # MPS uses unified memory, so there is no separate VRAM to report.
- test_no_accelerator_warns_because_cpu_still_works · method · L257-L261 — def test_no_accelerator_warns_because_cpu_still_works(self) -> None
- test_torch_missing_entirely_warns_rather_than_raising · method · L263-L267 — def test_torch_missing_entirely_warns_rather_than_raising(self) -> None
- BatchSizeTests · class · L270-L326 — class BatchSizeTests(unittest.TestCase)
- gpu_batch · method · L271-L274 — def gpu_batch(self, vram_gb: float) -> int
- cpu_batch · method · L276-L279 — def cpu_batch(self, ram_gb: float) -> int
- mps_batch · method · L281-L284 — def mps_batch(self, ram_gb: float) -> int
- test_the_vram_tiers_are_the_documented_ladder · method · L286-L290 — def test_the_vram_tiers_are_the_documented_ladder(self) -> None
- test_each_tier_boundary_is_inclusive_from_below · method · L292-L297 — def test_each_tier_boundary_is_inclusive_from_below(self) -> None: # 23.9 GB must not be treated as a 24 GB card.
- test_the_recommendation_never_decreases_as_vram_grows · method · L299-L302 — def test_the_recommendation_never_decreases_as_vram_grows(self) -> None: # A non-monotonic ladder would hand a smaller card the larger batch.
- test_an_unparseable_vram_figure_falls_back_to_a_safe_batch · method · L304-L306 — def test_an_unparseable_vram_figure_falls_back_to_a_safe_batch(self) -> None
- test_cpu_only_hosts_are_sized_by_system_memory · method · L308-L312 — def test_cpu_only_hosts_are_sized_by_system_memory(self) -> None
- test_cpu_recommendations_never_decrease_as_memory_grows · method · L314-L316 — def test_cpu_recommendations_never_decrease_as_memory_grows(self) -> None
- test_unified_memory_hosts_are_sized_by_system_memory · method · L318-L321 — def test_unified_memory_hosts_are_sized_by_system_memory(self) -> None
- test_every_recommendation_is_a_usable_batch_size · method · L323-L326 — def test_every_recommendation_is_a_usable_batch_size(self) -> None
- ReportTests · class · L329-L404 — class ReportTests(unittest.TestCase)
- run_checks · method · L332-L341 — def run_checks(self, *, total_ram=32.0, modules=None, free_gb=100.0, model="v2.5"): #
modules is patched into sys.modules, so a value of None stands for # "not installed" -- importing it raises ImportError.
- test_a_healthy_cpu_host_passes_in_cpu_mode · method · L343-L348 — def test_a_healthy_cpu_host_passes_in_cpu_mode(self) -> None
- test_a_cuda_host_is_reported_in_gpu_mode · method · L350-L352 — def test_a_cuda_host_is_reported_in_gpu_mode(self) -> None
- test_an_apple_silicon_host_is_reported_in_mps_mode · method · L354-L358 — def test_an_apple_silicon_host_is_reported_in_mps_mode(self) -> None
- test_too_little_memory_fails_the_whole_report · method · L360-L368 — def test_too_little_memory_fails_the_whole_report(self) -> None
- test_a_full_disk_fails_the_whole_report · method · L370-L375 — def test_a_full_disk_fails_the_whole_report(self) -> None
- test_warnings_alone_do_not_fail_the_report · method · L377-L382 — def test_warnings_alone_do_not_fail_the_report(self) -> None: # No GPU and no timesfm installed: both warn, and the run may proceed.
- test_every_documented_resource_is_checked · method · L384-L389 — def test_every_documented_resource_is_checked(self) -> None
- test_the_json_report_is_serialisable_and_keeps_its_keys · method · L391-L400 — def test_the_json_report_is_serialisable_and_keeps_its_keys(self) -> None: # forecast_csv consumes this dict, and --json is a documented interface.
- test_an_unknown_model_version_is_not_silently_substituted · method · L402-L404 — def test_an_unknown_model_version_is_not_silently_substituted(self) -> None
- CheckResultFormattingTests · class · L407-L423 — class CheckResultFormattingTests(unittest.TestCase)
- test_each_status_gets_its_own_icon · method · L408-L413 — def test_each_status_gets_its_own_icon(self) -> None
- test_the_rendered_line_carries_the_name_value_and_status · method · L415-L423 — def test_the_rendered_line_carries_the_name_value_and_status(self) -> None
- CommandLineTests · class · L426-L456 — class CommandLineTests(unittest.TestCase)
- invoke · method · L429-L436 — def invoke(self, *arguments)
- test_the_json_output_parses_and_names_the_model · method · L438-L445 — def test_the_json_output_parses_and_names_the_model(self) -> None
- test_an_unknown_model_is_rejected_by_the_parser · method · L447-L450 — def test_an_unknown_model_is_rejected_by_the_parser(self) -> None
- test_the_human_report_names_every_check_and_a_verdict · method · L452-L456 — def test_the_human_report_names_every_check_and_a_verdict(self) -> None
- PreflightHandoffTests · class · L459-L486 — class PreflightHandoffTests(unittest.TestCase)
- test_a_failing_report_stops_the_run · method · L462-L475 — def test_a_failing_report_stops_the_run(self) -> None
- test_a_passing_report_hands_over_the_recommended_batch_size · method · L477-L486 — def test_a_passing_report_hands_over_the_recommended_batch_size(self) -> None
- CsvLoadingTests · class · L489-L551 — class CsvLoadingTests(unittest.TestCase)
- setUp · method · L490-L493 — def setUp(self) -> None
- write · method · L495-L498 — def write(self, text: str) -> str
- load · method · L500-L503 — def load(self, path, *args)
- test_numeric_columns_are_detected_and_the_date_column_excluded · method · L505-L516 — def test_numeric_columns_are_detected_and_the_date_column_excluded(self) -> None
- test_a_string_column_is_never_forecast · method · L518-L521 — def test_a_string_column_is_never_forecast(self) -> None
- test_an_explicit_column_list_is_honoured · method · L523-L526 — def test_an_explicit_column_list_is_honoured(self) -> None
- test_a_column_that_does_not_exist_is_dropped_with_a_warning · method · L528-L532 — def test_a_column_that_does_not_exist_is_dropped_with_a_warning(self) -> None
- test_a_missing_date_column_is_reported_and_forgotten · method · L534-L538 — def test_a_missing_date_column_is_reported_and_forgotten(self) -> None
- test_a_csv_with_nothing_numeric_stops_the_run · method · L540-L546 — def test_a_csv_with_nothing_numeric_stops_the_run(self) -> None
- test_naming_no_columns_at_all_falls_back_to_autodetection · method · L548-L551 — def test_naming_no_columns_at_all_falls_back_to_autodetection(self) -> None
- ForecastAssemblyTests · class · L554-L613 — class ForecastAssemblyTests(unittest.TestCase)
- RecordingModel · class · L557-L569 — class RecordingModel
- init · method · L560-L562 — def init(self, horizon: int) -> None
- forecast · method · L564-L569 — def forecast(self, horizon, inputs)
- setUp · method · L571-L583 — def setUp(self) -> None
- test_each_series_is_forecast_and_keyed_by_its_column · method · L585-L588 — def test_each_series_is_forecast_and_keyed_by_its_column(self) -> None
- test_the_quantile_columns_map_to_the_documented_percentiles · method · L590-L598 — def test_the_quantile_columns_map_to_the_documented_percentiles(self) -> None: # TimesFM returns [mean, q0.1 ... q0.9], so the 10th, 50th and 90th # percentiles are columns 1, 5 and 9.
- test_the_bands_are_ordered_from_low_to_high · method · L600-L605 — def test_the_bands_are_ordered_from_low_to_high(self) -> None
- test_gaps_are_dropped_before_the_series_reaches_the_model · method · L607-L613 — def test_gaps_are_dropped_before_the_series_reaches_the_model(self) -> None: # A NaN passed through would poison the whole context window.
- OutputWritingTests · class · L616-L689 — class OutputWritingTests(unittest.TestCase)
- setUp · method · L619-L633 — def setUp(self) -> None
- write_csv · method · L635-L641 — def write_csv(self, frame, date_column)
- test_one_row_per_series_and_step · method · L643-L648 — def test_one_row_per_series_and_step(self) -> None
- test_without_dates_only_the_step_index_is_written · method · L650-L652 — def test_without_dates_only_the_step_index_is_written(self) -> None
- test_a_daily_history_continues_past_its_last_observation · method · L654-L664 — def test_a_daily_history_continues_past_its_last_observation(self) -> None: # Five daily points ending 2024-01-05, horizon 3: the forecast index is # the next three days, not a repeat of the last one.
- test_an_irregular_history_falls_back_to_step_numbers · method · L666-L673 — def test_an_irregular_history_falls_back_to_step_numbers(self) -> None: # No frequency can be inferred from unevenly spaced dates, so the # writer must not invent one.
- test_every_band_column_survives_the_round_trip · method · L675-L681 — def test_every_band_column_survives_the_round_trip(self) -> None
- test_the_json_output_keeps_the_series_names_and_bands · method · L683-L689 — def test_the_json_output_keeps_the_series_names_and_bands(self) -> None