Repository Analysis

Lightning-AI/pytorch-lightning

Pretrain, finetune ANY AI model of ANY size on 1 or 10,000+ GPUs with zero code changes.

27.7 Moderate AI signal View on GitHub

Analysis Overview

This report presents the forensic synthetic code analysis of Lightning-AI/pytorch-lightning, a Python project with 31,237 GitHub stars. SynthScan v2.0 examined 151,972 lines of code across 758 source files, recording 3563 pattern matches distributed across 17 syntactic categories. The overall adjusted score of 27.7 places this repository in the Moderate AI signal band.

The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).

27.7
Adjusted Score
27.7
Raw Score
100%
Time Factor
2026-07-14
Last Push
31.2K
Stars
Python
Language
152.0K
Lines of Code
758
Files
3.6K
Pattern Hits
2026-07-14
Scan Date
0.13
HC Hit Rate

What These Metrics Mean

Adjusted Score
Primary synthetic code indicator. Raw score normalised per 1,000 lines of code and multiplied by the temporal discount factor. This is the definitive comparative metric — use it to rank repositories by AI authorship density.
Raw Score
The unmodified sum of all severity-weighted, context-multiplied pattern match scores before temporal discounting. Reflects the absolute signal strength independent of when the repository was last active.
Time Factor
The temporal discount multiplier (0–100%) applied to the raw score. Repositories last updated before ChatGPT's launch (Nov 2022) receive a 5% factor. Full signal is only assigned to repositories active in the post-adoption era (Jan 2024+).
Pattern Hits
Total count of individual pattern matches across all files and categories. A high hit count with a low score may indicate a very large codebase with isolated AI snippets; a low count with a high score indicates dense, concentrated AI signatures.
HC Hit Rate
High+Critical pattern hits per file, averaged across the repository. This orthogonal signal catches repositories where a few files are densely packed with high-severity AI tells — a strong indicator even when the normalised score appears moderate due to codebase size.
Lines of Code / Files
Total lines and files analysed. The scanner examines 94 file extensions. These denominators are used to normalise the score, enabling fair comparison between repositories of vastly different sizes.

Score History

This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.

Severity Breakdown

Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.

CRITICAL 10HIGH 86MEDIUM 137LOW 3330

Directory Score Breakdown

This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.

Pattern Findings

The scanner identified 3563 distinct pattern matches across 17 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.

Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.

Hyper-Verbose Identifiers2179 hits · 2120 pts
SeverityFileLineSnippetContext
LOWtests/parity_fabric/conftest.py21def reset_deterministic_algorithm():CODE
LOWtests/parity_fabric/test_parity_simple.py128def test_parity_single_device(precision, accelerator):CODE
LOWtests/tests_fabric/test_connector.py270def test_precision_and_precision_plugin_raises():CODE
LOWtests/tests_fabric/test_connector.py277def test_interactive_compatible_dp_strategy_gpu(_, __, monkeypatch):CODE
LOWtests/tests_fabric/test_connector.py284def test_interactive_compatible_strategy_ddp_fork(monkeypatch):CODE
LOWtests/tests_fabric/test_connector.py319def test_strategy_choice_multi_node_gpu(_, strategy, strategy_class, devices):CODE
LOWtests/tests_fabric/test_connector.py324def test_num_nodes_input_validation():CODE
LOWtests/tests_fabric/test_connector.py332def test_cuda_accelerator_can_not_run_on_system(_):CODE
LOWtests/tests_fabric/test_connector.py382def test_accelerator_gpu_with_devices(devices, strategy_class):CODE
LOWtests/tests_fabric/test_connector.py390def test_accelerator_auto_with_devices_gpu():CODE
LOWtests/tests_fabric/test_connector.py396def test_set_devices_if_none_cpu():CODE
LOWtests/tests_fabric/test_connector.py402def test_unsupported_strategy_types_on_cpu_and_fallback():CODE
LOWtests/tests_fabric/test_connector.py448def test_strategy_choice_gpu_str(strategy, strategy_class):CODE
LOWtests/tests_fabric/test_connector.py453def test_device_type_when_strategy_instance_cpu_passed():CODE
LOWtests/tests_fabric/test_connector.py460def test_device_type_when_strategy_instance_gpu_passed():CODE
LOWtests/tests_fabric/test_connector.py467def test_validate_precision_type(precision):CODE
LOWtests/tests_fabric/test_connector.py776def test_gpu_accelerator_backend_choice(expected_accelerator_flag, expected_accelerator_class):CODE
LOWtests/tests_fabric/test_connector.py784def test_gpu_accelerator_backend_choice_cuda(*_):CODE
LOWtests/tests_fabric/test_connector.py793def test_gpu_accelerator_backend_choice_mps(*_: object) -> object:CODE
LOWtests/tests_fabric/test_connector.py801def test_gpu_accelerator_no_gpu_backend_found_error(*_):CODE
LOWtests/tests_fabric/test_connector.py884def test_precision_selection_model_parallel(_, precision, raises):CODE
LOWtests/tests_fabric/test_connector.py890def test_bitsandbytes_precision_cuda_required(monkeypatch):CODE
LOWtests/tests_fabric/test_connector.py899def test_strategy_str_passed_being_case_insensitive(_, strategy, strategy_cls):CODE
LOWtests/tests_fabric/test_connector.py81def test_accelerator_choice_tpu(accelerator, devices, tpu_available, monkeypatch):CODE
LOWtests/tests_fabric/test_connector.py95def test_strategy_choice_ddp_on_cpu():CODE
LOWtests/tests_fabric/test_connector.py100def _test_strategy_choice_ddp_and_cpu(ddp_strategy_class):CODE
LOWtests/tests_fabric/test_connector.py124def test_custom_cluster_environment_in_slurm_environment(_):CODE
LOWtests/tests_fabric/test_connector.py133 def creates_processes_externally(self) -> bool:CODE
LOWtests/tests_fabric/test_connector.py247def test_fallback_from_ddp_spawn_to_ddp_on_cluster(_, __, env_vars, expected_environment):CODE
LOWtests/tests_fabric/test_connector.py257def test_interactive_incompatible_backend_error(_, monkeypatch):CODE
LOWtests/tests_fabric/test_connector.py300def test_invalid_ddp_strategy_with_mps(accelerator, strategy, strategy_class):CODE
LOWtests/tests_fabric/test_connector.py346def test_tpu_accelerator_can_not_run_on_system(_):CODE
LOWtests/tests_fabric/test_connector.py353def test_accelerator_invalid_type_devices(_, device_count):CODE
LOWtests/tests_fabric/test_connector.py371def test_accelerator_cpu_with_devices(devices, strategy_class):CODE
LOWtests/tests_fabric/test_connector.py415def test_invalid_accelerator_choice():CODE
LOWtests/tests_fabric/test_connector.py421def test_invalid_strategy_choice(invalid_strategy):CODE
LOWtests/tests_fabric/test_connector.py433def test_strategy_choice_cpu_str(strategy, strategy_class):CODE
LOWtests/tests_fabric/test_connector.py491def test_precision_conversion(patch1, patch2, precision, expected_precision, should_warn):CODE
LOWtests/tests_fabric/test_connector.py504def test_multi_device_default_strategy():CODE
LOWtests/tests_fabric/test_connector.py513def test_strategy_choice_ddp_spawn_cpu():CODE
LOWtests/tests_fabric/test_connector.py524def test_strategy_choice_ddp_fork_in_interactive():CODE
LOWtests/tests_fabric/test_connector.py536def test_strategy_choice_ddp_fork_cpu():CODE
LOWtests/tests_fabric/test_connector.py558def test_strategy_choice_ddp_spawn(*_):CODE
LOWtests/tests_fabric/test_connector.py570def test_strategy_choice_ddp_slurm(_, strategy, job_name, expected_env):CODE
LOWtests/tests_fabric/test_connector.py606def test_strategy_choice_ddp_torchelastic(*_):CODE
LOWtests/tests_fabric/test_connector.py627def test_torchelastic_priority_over_slurm(*_):CODE
LOWtests/tests_fabric/test_connector.py648def test_strategy_choice_ddp_kubeflow(*_):CODE
LOWtests/tests_fabric/test_connector.py667def test_strategy_choice_ddp_cpu_kubeflow():CODE
LOWtests/tests_fabric/test_connector.py689def test_strategy_choice_ddp_cpu_slurm(strategy):CODE
LOWtests/tests_fabric/test_connector.py699def test_unsupported_tpu_choice(_, tpu_available):CODE
LOWtests/tests_fabric/test_connector.py715def test_connector_with_tpu_accelerator_instance(tpu_available, monkeypatch):CODE
LOWtests/tests_fabric/test_connector.py729def test_devices_auto_choice_mps():CODE
LOWtests/tests_fabric/test_connector.py741def test_parallel_devices_in_strategy_conflict_with_accelerator(parallel_devices, accelerator):CODE
LOWtests/tests_fabric/test_connector.py757def test_plugin_only_one_instance_for_one_type(plugins, expected):CODE
LOWtests/tests_fabric/test_connector.py764def test_passing_zero_and_empty_list_to_devices_flag(accelerator, devices):CODE
LOWtests/tests_fabric/test_connector.py812def test_ddp_fork_on_unsupported_platform(_, __, strategy):CODE
LOWtests/tests_fabric/test_connector.py861def test_precision_selection_amp_ddp(strategy, devices, is_custom_plugin, plugin_cls):CODE
LOWtests/tests_fabric/test_connector.py915def test_precision_from_environment(_, precision, expected):CODE
LOWtests/tests_fabric/test_connector.py938def test_accelerator_strategy_from_environment(accelerator, strategy, expected_accelerator, expected_strategy):CODE
LOWtests/tests_fabric/test_connector.py953def test_devices_from_environment(*_):CODE
2119 more matches not shown…
Over-Commented Block509 hits · 498 pts
SeverityFileLineSnippetContext
LOW.codecov.yml1# Copyright The Lightning AI team.COMMENT
LOW.pre-commit-config.yaml1# Copyright The Lightning AI team.COMMENT
LOWpyproject.toml1# Copyright The Lightning AI team.COMMENT
LOW.readthedocs.yml1# Copyright The Lightning AI team.COMMENT
LOWsetup.py1#!/usr/bin/env pythonCOMMENT
LOWtests/parity_fabric/test_parity_ddp.py1# Copyright The Lightning AI team.COMMENT
LOWtests/parity_fabric/conftest.py1# Copyright The Lightning AI team.COMMENT
LOWtests/parity_fabric/models.py1# Copyright The Lightning AI team.COMMENT
LOWtests/parity_fabric/run_standalone_tasks.sh1#!/bin/bashCOMMENT
LOWtests/parity_fabric/utils.py1# Copyright The Lightning AI team.COMMENT
LOWtests/parity_fabric/test_parity_simple.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/test_connector.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/conftest.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/test_fabric.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/test_wrappers.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/test_cli.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/loggers/test_tensorboard.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/loggers/test_csv.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/accelerators/test_mps.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/accelerators/test_registry.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/accelerators/test_cpu.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/accelerators/test_xla.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/accelerators/test_cuda.py1# Copyright The Lightning AI team.COMMENT
LOW…sts/tests_fabric/plugins/environments/test_kubeflow.py1# Copyright The Lightning AI team.COMMENT
LOW…ts/tests_fabric/plugins/environments/test_lightning.py1# Copyright The Lightning AI team.COMMENT
LOW…tests_fabric/plugins/environments/test_torchelastic.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/environments/test_lsf.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/environments/test_xla.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/environments/test_slurm.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/environments/test_mpi.py1# Copyright The Lightning AI team.COMMENT
LOW…ts_fabric/plugins/precision/test_double_integration.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/precision/test_amp.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/precision/test_half.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/precision/test_fsdp.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/precision/test_double.py1# Copyright The Lightning AI team.COMMENT
LOW…ts_fabric/plugins/precision/test_transformer_engine.py1# Copyright The Lightning AI team.COMMENT
LOW…ts/tests_fabric/plugins/precision/test_bitsandbytes.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/precision/test_deepspeed.py1# Copyright The Lightning AI team.COMMENT
LOW…tests_fabric/plugins/precision/test_xla_integration.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/plugins/precision/test_xla.py1# Copyright The Lightning AI team.COMMENT
LOW…fabric/plugins/precision/test_deepspeed_integration.py1# Copyright The Lightning AI team.COMMENT
LOW…tests_fabric/plugins/precision/test_amp_integration.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_registry.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_xla_fsdp.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_strategy.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_fsdp.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_ddp.py1# Copyright The Lightning AI team.COMMENT
LOW…s/tests_fabric/strategies/test_xla_fsdp_integration.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_dp.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_deepspeed.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_xla.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_model_parallel.py1# Copyright The Lightning AI team.COMMENT
LOW…/tests_fabric/strategies/test_deepspeed_integration.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_single_device.py1# Copyright The Lightning AI team.COMMENT
LOW…s_fabric/strategies/test_model_parallel_integration.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_ddp_integration.py1# Copyright The Lightning AI team.COMMENT
LOWtests/tests_fabric/strategies/test_fsdp_integration.py1# Copyright The Lightning AI team.COMMENT
LOW…_fabric/strategies/launchers/test_subprocess_script.py1# Copyright The Lightning AI team.COMMENT
LOW…ts_fabric/strategies/launchers/test_multiprocessing.py1# Copyright The Lightning AI team.COMMENT
LOW…rategies/launchers/test_multiprocessing_integration.py1# Copyright The Lightning AI team.COMMENT
449 more matches not shown…
Unused Imports382 hits · 378 pts
SeverityFileLineSnippetContext
LOWtests/tests_pytorch/accelerators/test_cpu.py9CODE
LOWtests/tests_pytorch/strategies/test_ddp_integration.py24CODE
LOWtests/tests_pytorch/utilities/test_imports.py31CODE
LOW…ests_pytorch/utilities/test_deepspeed_model_summary.py19CODE
LOWtests/tests_pytorch/helpers/__init__.py1CODE
LOWtests/tests_pytorch/helpers/__init__.py1CODE
LOWtests/tests_pytorch/helpers/__init__.py1CODE
LOWtests/tests_pytorch/helpers/__init__.py1CODE
LOWtests/tests_pytorch/helpers/__init__.py7CODE
LOW…s_pytorch/trainer/logging_/test_distributed_logging.py18CODE
LOWrequirements/pytorch/check-avail-extras.py2CODE
LOWrequirements/pytorch/check-avail-extras.py3CODE
LOWrequirements/pytorch/check-avail-extras.py4CODE
LOWrequirements/pytorch/check-avail-extras.py5CODE
LOWrequirements/pytorch/check-avail-extras.py6CODE
LOWdocs/source-pytorch/conf.py17CODE
LOWdocs/source-fabric/conf.py13CODE
LOWexamples/fabric/reinforcement_learning/rl/utils.py11CODE
LOWexamples/fabric/reinforcement_learning/rl/utils.py11CODE
LOWsrc/lightning/__init__.py16CODE
LOWsrc/lightning/__init__.py17CODE
LOWsrc/lightning/__init__.py18CODE
LOWsrc/lightning/__init__.py19CODE
LOWsrc/lightning/__init__.py20CODE
LOWsrc/lightning/__init__.py21CODE
LOWsrc/lightning/__init__.py21CODE
LOWsrc/lightning/__init__.py22CODE
LOWsrc/lightning/fabric/fabric.py79CODE
LOWsrc/lightning/fabric/__init__.py35CODE
LOWsrc/lightning/fabric/__init__.py36CODE
LOWsrc/lightning/fabric/__init__.py38CODE
LOWsrc/lightning/fabric/__init__.py41CODE
LOWsrc/lightning/fabric/__init__.py10CODE
LOWsrc/lightning/fabric/__init__.py12CODE
LOWsrc/lightning/fabric/__init__.py14CODE
LOWsrc/lightning/fabric/loggers/__init__.py13CODE
LOWsrc/lightning/fabric/loggers/__init__.py14CODE
LOWsrc/lightning/fabric/loggers/__init__.py15CODE
LOWsrc/lightning/fabric/accelerators/__init__.py16CODE
LOWsrc/lightning/fabric/accelerators/__init__.py17CODE
LOWsrc/lightning/fabric/accelerators/__init__.py17CODE
LOWsrc/lightning/fabric/accelerators/__init__.py18CODE
LOWsrc/lightning/fabric/accelerators/__init__.py20CODE
LOWsrc/lightning/fabric/plugins/__init__.py14CODE
LOWsrc/lightning/fabric/plugins/__init__.py15CODE
LOWsrc/lightning/fabric/plugins/__init__.py16CODE
LOWsrc/lightning/fabric/plugins/__init__.py17CODE
LOWsrc/lightning/fabric/plugins/__init__.py18CODE
LOWsrc/lightning/fabric/plugins/__init__.py19CODE
LOWsrc/lightning/fabric/plugins/__init__.py20CODE
LOWsrc/lightning/fabric/plugins/__init__.py21CODE
LOWsrc/lightning/fabric/plugins/__init__.py22CODE
LOWsrc/lightning/fabric/plugins/__init__.py23CODE
LOWsrc/lightning/fabric/plugins/__init__.py24CODE
LOWsrc/lightning/fabric/plugins/__init__.py25CODE
LOWsrc/lightning/fabric/plugins/__init__.py26CODE
LOWsrc/lightning/fabric/plugins/environments/__init__.py14CODE
LOWsrc/lightning/fabric/plugins/environments/__init__.py15CODE
LOWsrc/lightning/fabric/plugins/environments/__init__.py16CODE
LOWsrc/lightning/fabric/plugins/environments/__init__.py17CODE
322 more matches not shown…
Cross-File Repetition63 hits · 315 pts
SeverityFileLineSnippetContext
HIGHtests/parity_fabric/conftest.py0ensures that torch determinism settings are reset before the next test runs.STRING
HIGHtests/tests_fabric/conftest.py0ensures that torch determinism settings are reset before the next test runs.STRING
HIGHtests/tests_pytorch/conftest.py0ensures that torch determinism settings are reset before the next test runs.STRING
HIGHtests/tests_fabric/loggers/test_tensorboard.py0verify that manual versioning works for string versions, e.g. '2020-02-05-162402'.STRING
HIGHtests/tests_fabric/loggers/test_csv.py0verify that manual versioning works for string versions, e.g. '2020-02-05-162402'.STRING
HIGHtests/tests_pytorch/loggers/test_tensorboard.py0verify that manual versioning works for string versions, e.g. '2020-02-05-162402'.STRING
HIGHtests/tests_pytorch/loggers/test_csv.py0verify that manual versioning works for string versions, e.g. '2020-02-05-162402'.STRING
HIGH…sts/tests_fabric/plugins/environments/test_kubeflow.py0test the default attributes when no environment variables are set.STRING
HIGH…ts/tests_fabric/plugins/environments/test_lightning.py0test the default attributes when no environment variables are set.STRING
HIGH…tests_fabric/plugins/environments/test_torchelastic.py0test the default attributes when no environment variables are set.STRING
HIGHtests/tests_fabric/plugins/environments/test_xla.py0test the default attributes when no environment variables are set.STRING
HIGHtests/tests_fabric/plugins/environments/test_slurm.py0test the default attributes when no environment variables are set.STRING
HIGHtests/tests_fabric/plugins/environments/test_mpi.py0test the default attributes when no environment variables are set.STRING
HIGHtests/tests_fabric/strategies/test_xla_fsdp.py0test that the strategy returns the expected values depending on whether we're in the main process or not.STRING
HIGHtests/tests_fabric/strategies/test_xla.py0test that the strategy returns the expected values depending on whether we're in the main process or not.STRING
HIGHtests/tests_pytorch/strategies/test_xla.py0test that the strategy returns the expected values depending on whether we're in the main process or not.STRING
HIGHtests/tests_fabric/strategies/test_strategy.py0test that the module under configure_model gets moved to the right device and dtype.STRING
HIGHtests/tests_pytorch/strategies/test_common.py0test that the module under configure_model gets moved to the right device and dtype.STRING
HIGHtests/tests_fabric/strategies/test_ddp.py0test that the module under configure_model gets moved to the right device and dtype.STRING
HIGH…s_fabric/strategies/test_model_parallel_integration.py0test that the module under configure_model gets moved to the right device and dtype.STRING
HIGHtests/tests_fabric/strategies/test_fsdp_integration.py0test that the module under configure_model gets moved to the right device and dtype.STRING
HIGHtests/tests_pytorch/strategies/test_fsdp.py0test that the module under configure_model gets moved to the right device and dtype.STRING
HIGHtests/tests_pytorch/strategies/test_ddp.py0test that the module under configure_model gets moved to the right device and dtype.STRING
HIGH…_pytorch/strategies/test_model_parallel_integration.py0test that the module under configure_model gets moved to the right device and dtype.STRING
HIGHtests/tests_fabric/strategies/test_fsdp.py0test that the strategy does not accept storage options for saving checkpoints.STRING
HIGHtests/tests_pytorch/strategies/test_fsdp.py0test that the strategy does not accept storage options for saving checkpoints.STRING
HIGHtests/tests_fabric/strategies/test_deepspeed.py0test that the strategy does not accept storage options for saving checkpoints.STRING
HIGHtests/tests_fabric/strategies/test_model_parallel.py0test that the strategy does not accept storage options for saving checkpoints.STRING
HIGHtests/tests_pytorch/strategies/test_model_parallel.py0test that the strategy does not accept storage options for saving checkpoints.STRING
HIGHtests/tests_fabric/strategies/test_fsdp.py0test that the strategy validates the contents at the checkpoint path.STRING
HIGHtests/tests_fabric/strategies/test_model_parallel.py0test that the strategy validates the contents at the checkpoint path.STRING
HIGHtests/tests_pytorch/strategies/test_fsdp.py0test that the strategy validates the contents at the checkpoint path.STRING
HIGHtests/tests_pytorch/strategies/test_model_parallel.py0test that the strategy validates the contents at the checkpoint path.STRING
HIGHtests/tests_fabric/strategies/test_fsdp.py0test that the timeout gets passed to the ``torch.distributed.init_process_group`` function.STRING
HIGHtests/tests_fabric/strategies/test_ddp.py0test that the timeout gets passed to the ``torch.distributed.init_process_group`` function.STRING
HIGHtests/tests_fabric/strategies/test_model_parallel.py0test that the timeout gets passed to the ``torch.distributed.init_process_group`` function.STRING
HIGHtests/tests_pytorch/strategies/test_fsdp.py0test that the timeout gets passed to the ``torch.distributed.init_process_group`` function.STRING
HIGHtests/tests_pytorch/strategies/test_ddp.py0test that the timeout gets passed to the ``torch.distributed.init_process_group`` function.STRING
HIGHtests/tests_pytorch/strategies/test_model_parallel.py0test that the timeout gets passed to the ``torch.distributed.init_process_group`` function.STRING
HIGHtests/tests_fabric/strategies/test_fsdp.py0regression: a gs:// url must reach the dcp layer uncorrupted (not gs:/).STRING
HIGHtests/tests_fabric/strategies/test_model_parallel.py0regression: a gs:// url must reach the dcp layer uncorrupted (not gs:/).STRING
HIGHtests/tests_pytorch/strategies/test_fsdp.py0regression: a gs:// url must reach the dcp layer uncorrupted (not gs:/).STRING
HIGHtests/tests_pytorch/strategies/test_model_parallel.py0regression: a gs:// url must reach the dcp layer uncorrupted (not gs:/).STRING
HIGH…s/tests_fabric/strategies/test_xla_fsdp_integration.py0test that `move_to_device` does nothing, modelparallel decides which device parameters get moved to which device (shardiSTRING
HIGHtests/tests_fabric/strategies/test_fsdp_integration.py0test that `move_to_device` does nothing, modelparallel decides which device parameters get moved to which device (shardiSTRING
HIGH…s_fabric/strategies/test_model_parallel_integration.py0test that `move_to_device` does nothing, modelparallel decides which device parameters get moved to which device (shardiSTRING
HIGHsrc/lightning/fabric/loggers/tensorboard.py0the directory for this run's tensorboard checkpoint. by default, it is named ``'version_${self.version}'`` but it can beSTRING
HIGHsrc/lightning/pytorch/loggers/litlogger.py0the directory for this run's tensorboard checkpoint. by default, it is named ``'version_${self.version}'`` but it can beSTRING
HIGHsrc/lightning/pytorch/loggers/tensorboard.py0the directory for this run's tensorboard checkpoint. by default, it is named ``'version_${self.version}'`` but it can beSTRING
HIGHsrc/lightning/fabric/plugins/precision/precision.py0this method is called to teardown the training process. it is the right place to release memory and free other resourcesSTRING
HIGHsrc/lightning/fabric/strategies/strategy.py0this method is called to teardown the training process. it is the right place to release memory and free other resourcesSTRING
HIGHsrc/lightning/pytorch/strategies/strategy.py0this method is called to teardown the training process. it is the right place to release memory and free other resourcesSTRING
HIGHsrc/lightning/fabric/strategies/ddp.py0reduces a tensor from several distributed processes to one aggregated tensor. args: tensor: the tensor to sync and reducSTRING
HIGHsrc/lightning/pytorch/strategies/ddp.py0reduces a tensor from several distributed processes to one aggregated tensor. args: tensor: the tensor to sync and reducSTRING
HIGHsrc/lightning/pytorch/strategies/fsdp.py0reduces a tensor from several distributed processes to one aggregated tensor. args: tensor: the tensor to sync and reducSTRING
HIGHsrc/lightning/fabric/strategies/xla_fsdp.py0function to gather a tensor from several distributed processes. args: tensor: tensor to all-gather. group: unused. sync_STRING
HIGHsrc/lightning/fabric/strategies/xla.py0function to gather a tensor from several distributed processes. args: tensor: tensor to all-gather. group: unused. sync_STRING
HIGHsrc/lightning/pytorch/strategies/xla.py0function to gather a tensor from several distributed processes. args: tensor: tensor to all-gather. group: unused. sync_STRING
HIGHsrc/lightning/pytorch/profilers/advanced.py0profiler to check if there are any bottlenecks in your code.STRING
HIGHsrc/lightning/pytorch/profilers/pytorch.py0profiler to check if there are any bottlenecks in your code.STRING
3 more matches not shown…
Decorative Section Separators72 hits · 257 pts
SeverityFileLineSnippetContext
MEDIUMREADME.md142# --------------------------------COMMENT
MEDIUMREADME.md144# --------------------------------COMMENT
MEDIUMREADME.md175# -------------------COMMENT
MEDIUMREADME.md177# -------------------COMMENT
MEDIUMREADME.md181# -------------------COMMENT
MEDIUMREADME.md183# -------------------COMMENT
MEDIUMtests/tests_pytorch/models/test_hparams.py96# -------------------------COMMENT
MEDIUMtests/tests_pytorch/models/test_hparams.py98# -------------------------COMMENT
MEDIUMtests/tests_pytorch/models/test_hparams.py263# -------------------------COMMENT
MEDIUMtests/tests_pytorch/models/test_hparams.py265# -------------------------COMMENT
MEDIUMtests/tests_pytorch/helpers/deterministic_model.py61 # -----------------------------COMMENT
MEDIUMtests/tests_pytorch/helpers/deterministic_model.py63 # -----------------------------COMMENT
MEDIUMtests/tests_pytorch/trainer/flags/test_fast_dev_run.py115 # -----------------------COMMENT
MEDIUMtests/tests_pytorch/trainer/flags/test_fast_dev_run.py117 # -----------------------COMMENT
MEDIUM…ts_pytorch/trainer/logging_/test_train_loop_logging.py49 # -----------COMMENT
MEDIUM…ts_pytorch/trainer/logging_/test_train_loop_logging.py51 # -----------COMMENT
MEDIUM…ts_pytorch/trainer/logging_/test_train_loop_logging.py54 # -----------COMMENT
MEDIUM…ts_pytorch/trainer/logging_/test_train_loop_logging.py56 # -----------COMMENT
MEDIUM…ts_pytorch/trainer/logging_/test_train_loop_logging.py66 # -----------COMMENT
MEDIUM…ts_pytorch/trainer/logging_/test_train_loop_logging.py68 # -----------COMMENT
MEDIUMdocs/source-pytorch/conf.py27# -----------------------COMMENT
MEDIUMdocs/source-pytorch/conf.py29# -----------------------COMMENT
MEDIUMdocs/source-pytorch/conf.py36# -----------------------COMMENT
MEDIUMdocs/source-pytorch/conf.py38# -----------------------COMMENT
MEDIUM…ples/pytorch/domain_templates/semantic_segmentation.py376 # ------------------------COMMENT
MEDIUM…ples/pytorch/domain_templates/semantic_segmentation.py378 # ------------------------COMMENT
MEDIUM…ples/pytorch/domain_templates/semantic_segmentation.py381 # ------------------------COMMENT
MEDIUM…ples/pytorch/domain_templates/semantic_segmentation.py383 # ------------------------COMMENT
MEDIUM…ples/pytorch/domain_templates/semantic_segmentation.py386 # ------------------------COMMENT
MEDIUM…ples/pytorch/domain_templates/semantic_segmentation.py388 # ------------------------COMMENT
MEDIUM…pytorch/domain_templates/generative_adversarial_net.py204 # ------------------------COMMENT
MEDIUM…pytorch/domain_templates/generative_adversarial_net.py206 # ------------------------COMMENT
MEDIUM…pytorch/domain_templates/generative_adversarial_net.py209 # ------------------------COMMENT
MEDIUM…pytorch/domain_templates/generative_adversarial_net.py211 # ------------------------COMMENT
MEDIUM…pytorch/domain_templates/generative_adversarial_net.py217 # ------------------------COMMENT
MEDIUM…pytorch/domain_templates/generative_adversarial_net.py219 # ------------------------COMMENT
MEDIUMsrc/lightning/fabric/plugins/environments/slurm.py76 # -----------------------COMMENT
MEDIUMsrc/lightning/fabric/plugins/environments/slurm.py78 # -----------------------COMMENT
MEDIUMsrc/lightning/fabric/plugins/environments/slurm.py89 # -----------------------COMMENT
MEDIUMsrc/lightning/fabric/plugins/environments/slurm.py91 # -----------------------COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py121 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py123 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py238 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py240 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py290 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py292 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py387 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py389 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py404 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loggers/litlogger.py406 # ──────────────────────────────────────────────────────────────────────────────COMMENT
MEDIUMsrc/lightning/pytorch/loops/training_epoch_loop.py297 # =====================================================================COMMENT
MEDIUMsrc/lightning/pytorch/loops/training_epoch_loop.py302 # =====================================================================COMMENT
MEDIUMsrc/lightning/pytorch/loops/training_epoch_loop.py381 # -----------------------------------------COMMENT
MEDIUMsrc/lightning/pytorch/loops/training_epoch_loop.py383 # -----------------------------------------COMMENT
MEDIUMsrc/lightning/pytorch/loops/training_epoch_loop.py387 # -----------------------------------------COMMENT
MEDIUMsrc/lightning/pytorch/loops/training_epoch_loop.py389 # -----------------------------------------COMMENT
MEDIUMsrc/lightning/pytorch/loops/optimization/automatic.py180 # -------------------COMMENT
MEDIUMsrc/lightning/pytorch/loops/optimization/automatic.py182 # -------------------COMMENT
MEDIUMsrc/lightning/pytorch/loops/optimization/automatic.py187 # ------------------------------COMMENT
MEDIUMsrc/lightning/pytorch/loops/optimization/automatic.py189 # ------------------------------COMMENT
12 more matches not shown…
Self-Referential Comments57 hits · 128 pts
SeverityFileLineSnippetContext
MEDIUM…s_fabric/strategies/test_model_parallel_integration.py455 # Create a FSDP sharded modelCOMMENT
MEDIUM…s_fabric/strategies/test_model_parallel_integration.py469 # Create a raw state-dict checkpoint to test `Fabric.load_raw` tooCOMMENT
MEDIUMtests/tests_fabric/strategies/test_fsdp_integration.py306 # Create a FSDP sharded modelCOMMENT
MEDIUMtests/tests_fabric/strategies/test_fsdp_integration.py325 # Create a raw state-dict checkpoint to test `Fabric.load_raw` tooCOMMENT
MEDIUMtests/tests_fabric/utilities/test_cloud_io.py133 # Create a fake adlfs module so isinstance check worksCOMMENT
MEDIUMtests/tests_pytorch/tuner/test_lr_finder.py811 # Create a simple backbone-head architectureCOMMENT
MEDIUMtests/tests_pytorch/loggers/test_wandb.py656 # Create a config file with the log_model parameter set. This seems necessary to be ableCOMMENT
MEDIUMtests/tests_pytorch/callbacks/test_pruning.py430 # Create a pruning callback that applies both pruning and LTH at epoch 1COMMENT
MEDIUM…_pytorch/strategies/test_model_parallel_integration.py507 # Create a regular model and load the checkpoint into itCOMMENT
MEDIUM…_pytorch/strategies/test_model_parallel_integration.py537 # Create a distributed model and load the checkpoint into itCOMMENT
MEDIUMtests/tests_pytorch/models/test_hparams.py353 instance = super().__call__(*args, **kwargs) # Create the instanceCODE
MEDIUM…ts/tests_pytorch/trainer/flags/test_overfit_batches.py131 # Create a reference train dataloader without shuffling.COMMENT
MEDIUMexamples/fabric/kfold_cv/train_fabric.py105 # Create the Lightning Fabric object. The parameters like accelerator, strategy, devices etc. will be providedCOMMENT
MEDIUMexamples/fabric/tensor_parallel/train.py18 # Define the size of the 2D parallelismCOMMENT
MEDIUMexamples/fabric/tensor_parallel/train.py38 # Define the optimizerCOMMENT
MEDIUMexamples/fabric/image_classifier/train_fabric.py74 # Create the Lightning Fabric object. The parameters like accelerator, strategy, devices etc. will be proidedCOMMENT
MEDIUMexamples/fabric/dcgan/train_torch.py67 # Create the dataloaderCOMMENT
MEDIUMexamples/fabric/dcgan/train_torch.py90 # Create the generatorCOMMENT
MEDIUMexamples/fabric/dcgan/train_torch.py100 # Create the DiscriminatorCOMMENT
MEDIUMexamples/fabric/dcgan/train_fabric.py68 # Create the dataloaderCOMMENT
MEDIUMexamples/fabric/dcgan/train_fabric.py83 # Create the generatorCOMMENT
MEDIUMexamples/fabric/dcgan/train_fabric.py89 # Create the DiscriminatorCOMMENT
MEDIUMexamples/fabric/reinforcement_learning/train_torch.py157 # Define the agent and the optimizer and setup them with DistributedDataParallelCOMMENT
MEDIUMexamples/fabric/reinforcement_learning/train_fabric.py93 # Define the agent and the optimizer and setup them with FabricCOMMENT
MEDIUM…abric/reinforcement_learning/train_fabric_decoupled.py50 # Initialize Fabric objectCOMMENT
MEDIUM…abric/reinforcement_learning/train_fabric_decoupled.py68 # Define the agentCOMMENT
MEDIUM…abric/reinforcement_learning/train_fabric_decoupled.py234 # Define the agent and the optimizer and setup them with FabricCOMMENT
MEDIUM…abric/reinforcement_learning/train_fabric_decoupled.py330 # Create a global group, assigning it to the collective: used by the player to exchangeCOMMENT
MEDIUM…abric/reinforcement_learning/train_fabric_decoupled.py335 # Create a group between rank-0 (player) and rank-1 (trainer), assigning it to the collective:COMMENT
MEDIUM…abric/reinforcement_learning/train_fabric_decoupled.py339 # Create a new group, without assigning it to the collective: in this way the trainers canCOMMENT
MEDIUMexamples/fabric/meta_learning/train_fabric.py62 # Create the Fabric objectCOMMENT
MEDIUMexamples/pytorch/tensor_parallel/train.py51 # Define the size of the 2D parallelismCOMMENT
MEDIUMsrc/lightning/fabric/accelerators/registry.py23 """This class is a Registry that stores information about the Accelerators.STRING
MEDIUMsrc/lightning/fabric/plugins/io/checkpoint_io.py79 """This method is called to teardown the process."""STRING
MEDIUMsrc/lightning/fabric/plugins/precision/precision.py158 """This method is called to teardown the training process.STRING
MEDIUMsrc/lightning/fabric/strategies/registry.py20 """This class is a Registry that stores information about the Training Strategies.STRING
MEDIUMsrc/lightning/fabric/strategies/strategy.py365 """This method is called to teardown the training process.STRING
MEDIUMsrc/lightning/fabric/utilities/types.py53 """This class is used to detect if an object is stateful using `isinstance(obj, _Stateful)`."""STRING
MEDIUMsrc/lightning/fabric/utilities/distributed.py422 # Create a barrier with an 'infinite' timeout (only reliably possible over the GLOO backend)COMMENT
MEDIUMsrc/lightning/fabric/utilities/data.py177 """This function is used to handle the sampler, batch_sampler arguments associated within a DataLoader for its re-STRING
MEDIUMsrc/lightning/pytorch/overrides/distributed.py236 """This class is used to wrap a :class:`torch.utils.data.BatchSampler` and capture its indices."""STRING
MEDIUMsrc/lightning/pytorch/loggers/mlflow.py369 # Create a temporary directory to log on mlflowSTRING
MEDIUMsrc/lightning/pytorch/core/optimizer.py40 """This class is used to wrap the user optimizers and handle properly the backward and optimizer_step logic acrossSTRING
MEDIUMsrc/lightning/pytorch/core/optimizer.py64 """This function is just a helper for advanced users.STRING
MEDIUMsrc/lightning/pytorch/callbacks/pruning.py447 """This function is responsible of sanitizing ``parameters_to_prune`` and ``parameter_names``. IfSTRING
MEDIUMsrc/lightning/pytorch/callbacks/finetuning.py49 r"""This class implements the base logic for writing your own Finetuning Callback.STRING
MEDIUMsrc/lightning/pytorch/callbacks/finetuning.py128 """This function is used to flatten a module or an iterable of modules into a list of its leaf modules (modulesSTRING
MEDIUMsrc/lightning/pytorch/callbacks/finetuning.py227 """This function is used to exclude any parameter which already exists in this optimizer.STRING
MEDIUMsrc/lightning/pytorch/callbacks/lr_monitor.py251 """This function is used the remap the keys if param groups for a given optimizer increased."""STRING
MEDIUMsrc/lightning/pytorch/plugins/io/async_plugin.py86 """This method is called to close the threads."""STRING
MEDIUMsrc/lightning/pytorch/strategies/strategy.py527 """This method is called to teardown the training process.STRING
MEDIUMsrc/lightning/pytorch/profilers/pytorch.py105 """This class is used to override the schedule logic from the profiler and perform recording for bothSTRING
MEDIUMsrc/lightning/pytorch/utilities/data.py238 """This function is used to handle the sampler, batch_sampler arguments associated within a DataLoader for its re-STRING
MEDIUMsrc/lightning/pytorch/loops/fetchers.py87 """This class is used to control batch fetching flow.STRING
MEDIUMsrc/lightning/pytorch/loops/fetchers.py147 """This class is used to return directly the `dataloader_iter` to the ``LightningModule`` training_step for usersSTRING
MEDIUM…lightning/pytorch/trainer/connectors/data_connector.py237 """This function is used to created the distributed sampler injected within the user DataLoader."""STRING
MEDIUM…/pytorch/trainer/connectors/logger_connector/result.py456 """This function is used to iterate over current valid metrics."""STRING
Docstring Block Structure23 hits · 115 pts
SeverityFileLineSnippetContext
HIGHsrc/lightning/fabric/fabric.py377Set up one or more optimizers for accelerated training. Some strategies do not allow setting up model and optimSTRING
HIGHsrc/lightning/fabric/fabric.py536Clip the gradients of the model to a given max value or max norm. Args: module: The module whose paSTRING
HIGHsrc/lightning/fabric/fabric.py734Skip gradient synchronization during backward to avoid redundant communication overhead. Use this context managSTRING
HIGHsrc/lightning/fabric/fabric.py956Launch and initialize all the processes needed for distributed execution. Args: function: Optional STRING
HIGHsrc/lightning/fabric/accelerators/cpu.py81Parses the cpu_cores given in the format as accepted by the ``devices`` argument in the :class:`~lightning.pytorch.tSTRING
HIGHsrc/lightning/fabric/plugins/io/torch_io.py67Loads checkpoint using :func:`torch.load`, with additional handling for ``fsspec`` remote loading of files. ArgSTRING
HIGHsrc/lightning/fabric/strategies/deepspeed.py478Load the contents from a checkpoint and restore the state of the given objects. Args: path: A path STRING
HIGHsrc/lightning/fabric/utilities/logger.py78Flatten hierarchical dict, e.g. ``{'a': {'b': 'c'}} -> {'a/b': 'c'}``. Args: params: Dictionary containing STRING
HIGHsrc/lightning/fabric/utilities/device_parser.py24 Args: gpus: Non-empty list of ints representing which GPUs to use Returns: Designated root GPUSTRING
HIGHsrc/lightning/fabric/utilities/device_parser.py54Parses the GPU IDs given in the format as accepted by the :class:`~lightning.pytorch.trainer.trainer.Trainer`. ArgsSTRING
HIGHsrc/lightning/fabric/utilities/device_parser.py117Checks that each of the GPUs in the list is actually available. Raises a MisconfigurationException if any of the GPUSTRING
HIGHsrc/lightning/pytorch/loggers/comet.py46Track your parameters, metrics, source code and more using `Comet <https://www.comet.com/?utm_source=lightning.pytorSTRING
HIGHsrc/lightning/pytorch/loggers/wandb.py52Log using `Weights and Biases <https://docs.wandb.ai/guides/integrations/lightning>`_. **Installation and set-up** STRING
HIGHsrc/lightning/pytorch/loggers/logger.py106Merge a sequence with dictionaries into one dictionary by aggregating the same keys with some given function. Args:STRING
HIGHsrc/lightning/pytorch/accelerators/cuda.py65Gets stats for the given GPU device. Args: device: GPU device for which to get stats ReturSTRING
HIGHsrc/lightning/pytorch/accelerators/cuda.py123Get GPU stats including memory, fan speed, and temperature from nvidia-smi. Args: device: GPU device for whSTRING
HIGHsrc/lightning/pytorch/callbacks/pruning.py82Model pruning Callback, using PyTorch's prune utilities. This callback is responsible of pruning networks parameSTRING
HIGHsrc/lightning/pytorch/callbacks/model_checkpoint.py51Save the model after every epoch by monitoring a quantity. Every logged metrics are passed to the :class:`~lightningSTRING
HIGHsrc/lightning/pytorch/callbacks/early_stopping.py49Monitor a metric and stop training when it stops improving. Args: monitor: quantity to be monitored. STRING
HIGHsrc/lightning/pytorch/trainer/setup.py185Convert a time interval into seconds. This helper parses different representations of a time interval and normaSTRING
HIGHsrc/lightning/pytorch/trainer/trainer.py651Perform one evaluation epoch over the validation set. Args: model: The model to validate. STRING
HIGHsrc/lightning/pytorch/trainer/trainer.py769Perform one evaluation epoch over the test set. It's separated from fit to make sure you never run on your test STRING
HIGHsrc/lightning/pytorch/trainer/trainer.py888Run inference on your data. This will call the model forward function to compute predictions. Useful to perform STRING
Modern Structural Boilerplate94 hits · 100 pts
SeverityFileLineSnippetContext
LOWtests/tests_pytorch/strategies/test_ddp_integration.py236 def update_main_process_results(self, trainer, extra) -> None:CODE
LOWsrc/lightning/__init__.py24__all__ = [CODE
LOWsrc/lightning/__about__.py32__all__ = [STRING
LOWsrc/lightning/fabric/__init__.py43__all__ = ["Fabric", "seed_everything", "is_wrapped"]CODE
LOWsrc/lightning/fabric/cli.py171def _set_env_variables(args: Namespace) -> None:CODE
LOWsrc/lightning/fabric/connector.py335 def _set_parallel_devices_and_init_accelerator(self) -> None:CODE
LOWsrc/lightning/fabric/connector.py362 def _set_devices_flag_if_auto_passed(self) -> None:CODE
LOWsrc/lightning/fabric/plugins/__init__.py28__all__ = [CODE
LOW…ing/fabric/plugins/environments/cluster_environment.py45 def set_world_size(self, size: int) -> None:CODE
LOW…ing/fabric/plugins/environments/cluster_environment.py53 def set_global_rank(self, rank: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/slurm.py138 def set_world_size(self, size: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/slurm.py146 def set_global_rank(self, rank: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/kubeflow.py61 def set_world_size(self, size: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/kubeflow.py69 def set_global_rank(self, rank: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/mpi.py90 def set_world_size(self, size: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/mpi.py99 def set_global_rank(self, rank: int) -> None:CODE
LOW…/lightning/fabric/plugins/environments/torchelastic.py66 def set_world_size(self, size: int) -> None:CODE
LOW…/lightning/fabric/plugins/environments/torchelastic.py74 def set_global_rank(self, rank: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/lightning.py81 def set_world_size(self, size: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/lightning.py89 def set_global_rank(self, rank: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/lsf.py58 def _set_init_progress_group_env_vars(self) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/lsf.py103 def set_world_size(self, size: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/lsf.py118 def set_global_rank(self, rank: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/xla.py79 def set_world_size(self, size: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/environments/xla.py100 def set_global_rank(self, rank: int) -> None:CODE
LOWsrc/lightning/fabric/plugins/io/__init__.py18__all__ = ["CheckpointIO", "TorchCheckpointIO", "XLACheckpointIO"]CODE
LOWsrc/lightning/fabric/plugins/collectives/__init__.py5__all__ = [CODE
LOWsrc/lightning/fabric/plugins/precision/__init__.py24__all__ = [CODE
LOWsrc/lightning/fabric/strategies/ddp.py234 def _setup_distributed(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/ddp.py246 def _set_world_ranks(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/fsdp.py685 def _setup_distributed(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/fsdp.py698 def _set_world_ranks(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/fsdp.py814def _setup_activation_checkpointing(module: Module, activation_checkpointing_kwargs: dict) -> None:CODE
LOWsrc/lightning/fabric/strategies/deepspeed.py648 def _setup_distributed(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/deepspeed.py675 def _set_node_environment_variables(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/deepspeed.py683 def _set_deepspeed_activation_checkpointing(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/model_parallel.py309 def _setup_distributed(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/model_parallel.py322 def _set_world_ranks(self) -> None:CODE
LOWsrc/lightning/fabric/strategies/model_parallel.py343 def _set_requires_grad_sync(self, requires_grad_sync: bool) -> None:CODE
LOWsrc/lightning/fabric/strategies/launchers/__init__.py18__all__ = [CODE
LOWsrc/lightning/fabric/utilities/__init__.py29__all__ = [CODE
LOWsrc/lightning/fabric/utilities/spike.py142 def _update_stats(self, val: torch.Tensor) -> None:CODE
LOWsrc/lightning/fabric/utilities/seed.py150def _set_rng_states(rng_state_dict: dict[str, Any]) -> None:CODE
LOWsrc/lightning/fabric/utilities/distributed.py376 def set_epoch(self, epoch: int) -> None:CODE
LOWsrc/lightning/fabric/utilities/distributed.py390def _set_num_threads_if_needed(num_processes: int = 1) -> None:CODE
LOWsrc/lightning/fabric/utilities/data.py419def _set_sampler_epoch(dataloader: object, epoch: int) -> None:CODE
LOWsrc/lightning/fabric/utilities/testing/__init__.py3__all__ = ["_runif_reasons"]CODE
LOWsrc/lightning/pytorch/__init__.py34__all__ = ["Trainer", "LightningDataModule", "LightningModule", "Callback", "seed_everything"]CODE
LOWsrc/lightning/pytorch/cli.py775 def _set_seed(self) -> None:CODE
LOWsrc/lightning/pytorch/cli.py846def _set_dict_nested(data: dict, key: str, value: Any) -> None:CODE
LOWsrc/lightning/pytorch/loggers/__init__.py22__all__ = [CODE
LOWsrc/lightning/pytorch/core/saving.py218def update_hparams(hparams: dict, updates: dict) -> None:CODE
LOWsrc/lightning/pytorch/core/__init__.py18__all__ = ["LightningDataModule", "LightningModule"]CODE
LOWsrc/lightning/pytorch/core/mixins/hparams_mixin.py133 def _set_hparams(self, hp: Union[MutableMapping, Namespace, str]) -> None:CODE
LOWsrc/lightning/pytorch/accelerators/__init__.py14__all__ = [CODE
LOWsrc/lightning/pytorch/accelerators/cuda.py56 def set_nvidia_flags(local_rank: int) -> None:CODE
LOWsrc/lightning/pytorch/callbacks/__init__.py37__all__ = [CODE
LOW…/lightning/pytorch/callbacks/progress/tqdm_progress.py464def _update_n(bar: _tqdm, value: int) -> None:CODE
LOWsrc/lightning/pytorch/plugins/__init__.py18__all__ = [CODE
LOWsrc/lightning/pytorch/plugins/io/__init__.py17__all__ = [CODE
34 more matches not shown…
Hallucination Indicators10 hits · 95 pts
SeverityFileLineSnippetContext
CRITICALtests/tests_pytorch/test_cli.py543 assert cli.config.fit.model.class_path.endswith(".BoringCkptPathSubclass")CODE
CRITICAL…s/tests_pytorch/core/test_metric_result_integration.py608 pl.trainer.connectors.logger_connector.result.warning_cache.clear()CODE
CRITICAL…_pytorch/strategies/test_model_parallel_integration.py319 assert self.model.w1.weight.device_mesh.size(0) == 2CODE
CRITICAL…_pytorch/strategies/test_model_parallel_integration.py320 assert self.model.w1.weight.device_mesh.size(1) == 2CODE
CRITICALtests/tests_pytorch/loops/test_loops.py255 assert trainer.fit_loop.epoch_loop.val_loop.batch_progress.state_dict() == expectedCODE
CRITICALsrc/lightning/pytorch/tuner/batch_size_scaling.py409 trainer.fit_loop.epoch_loop.automatic_optimization.optim_progress.reset()CODE
CRITICALsrc/lightning/pytorch/tuner/batch_size_scaling.py411 trainer.fit_loop.epoch_loop.manual_optimization.optim_step_progress.reset()CODE
CRITICALsrc/lightning/pytorch/strategies/ddp.py265 self._model_averager = torch.distributed.algorithms.model_averaging.averagers.PeriodicModelAverager(CODE
CRITICALsrc/lightning/pytorch/trainer/trainer.py1363 self.fit_loop.epoch_loop.val_loop._data_source.is_defined()CODE
CRITICAL…c/lightning/pytorch/trainer/configuration_validator.py65 has_val_loader = trainer.fit_loop.epoch_loop.val_loop._data_source.is_defined()STRING
Deep Nesting77 hits · 76 pts
SeverityFileLineSnippetContext
LOWsetup.py88CODE
LOWtests/tests_fabric/conftest.py85CODE
LOWtests/tests_pytorch/conftest.py142CODE
LOWtests/tests_pytorch/tuner/test_scale_batch_size.py356CODE
LOW…sts/tests_pytorch/callbacks/test_throughput_monitor.py426CODE
LOWtests/tests_pytorch/utilities/test_combined_loader.py472CODE
LOWtests/tests_pytorch/loops/test_loops.py637CODE
LOWtests/tests_pytorch/loops/test_loops.py638CODE
LOWtests/tests_pytorch/trainer/test_trainer.py756CODE
LOW…ests_pytorch/trainer/logging_/test_logger_connector.py40CODE
LOW…ests_pytorch/trainer/logging_/test_logger_connector.py473CODE
LOW.actions/assistant.py58CODE
LOWexamples/fabric/image_classifier/train_torch.py55CODE
LOWexamples/fabric/image_classifier/train_fabric.py73CODE
LOWexamples/fabric/build_your_own_trainer/trainer.py523CODE
LOWexamples/fabric/dcgan/train_torch.py48CODE
LOWexamples/fabric/dcgan/train_fabric.py49CODE
LOWexamples/fabric/reinforcement_learning/train_torch.py110CODE
LOWexamples/fabric/reinforcement_learning/train_fabric.py66CODE
LOW…abric/reinforcement_learning/train_fabric_decoupled.py42CODE
LOW…abric/reinforcement_learning/train_fabric_decoupled.py214CODE
LOW…amples/pytorch/domain_templates/reinforce_learn_ppo.py286CODE
LOWsrc/lightning/fabric/fabric.py1128CODE
LOWsrc/lightning/fabric/cli.py188CODE
LOWsrc/lightning/fabric/connector.py164CODE
LOW…ghtning/fabric/plugins/precision/transformer_engine.py151CODE
LOWsrc/lightning/fabric/strategies/fsdp.py433CODE
LOWsrc/lightning/fabric/strategies/fsdp.py531CODE
LOWsrc/lightning/fabric/strategies/strategy.py406CODE
LOWsrc/lightning/fabric/strategies/model_parallel.py560CODE
LOWsrc/lightning/fabric/utilities/throughput.py566CODE
LOWsrc/lightning/fabric/utilities/logger.py77CODE
LOWsrc/lightning/fabric/utilities/cloud_io.py87CODE
LOWsrc/lightning/fabric/utilities/data.py173CODE
LOWsrc/lightning/fabric/utilities/data.py359CODE
LOWsrc/lightning/pytorch/tuner/batch_size_scaling.py180CODE
LOWsrc/lightning/pytorch/tuner/batch_size_scaling.py235CODE
LOWsrc/lightning/pytorch/tuner/lr_finder.py199CODE
LOWsrc/lightning/pytorch/tuner/tuning.py31CODE
LOWsrc/lightning/pytorch/loggers/wandb.py378CODE
LOWsrc/lightning/pytorch/core/optimizer.py200CODE
LOWsrc/lightning/pytorch/core/optimizer.py250CODE
LOWsrc/lightning/pytorch/core/module.py1140CODE
LOWsrc/lightning/pytorch/core/module.py1181CODE
LOWsrc/lightning/pytorch/core/module.py1510CODE
LOWsrc/lightning/pytorch/callbacks/pruning.py66CODE
LOWsrc/lightning/pytorch/callbacks/pruning.py444CODE
LOWsrc/lightning/pytorch/callbacks/model_checkpoint.py340CODE
LOWsrc/lightning/pytorch/callbacks/finetuning.py113CODE
LOWsrc/lightning/pytorch/callbacks/lr_monitor.py250CODE
LOWsrc/lightning/pytorch/callbacks/early_stopping.py246CODE
LOW…/lightning/pytorch/callbacks/progress/tqdm_progress.py422CODE
LOWsrc/lightning/pytorch/strategies/fsdp.py539CODE
LOWsrc/lightning/pytorch/strategies/fsdp.py601CODE
LOWsrc/lightning/pytorch/profilers/pytorch.py167CODE
LOWsrc/lightning/pytorch/profilers/pytorch.py194CODE
LOWsrc/lightning/pytorch/utilities/model_helpers.py29CODE
LOWsrc/lightning/pytorch/utilities/data.py43CODE
LOWsrc/lightning/pytorch/utilities/data.py62CODE
LOWsrc/lightning/pytorch/utilities/data.py233CODE
17 more matches not shown…
AI Structural Patterns40 hits · 38 pts
SeverityFileLineSnippetContext
LOWtests/tests_pytorch/trainer/test_trainer.py1317CODE
LOW…ests_pytorch/trainer/connectors/test_data_connector.py263CODE
LOWexamples/fabric/build_your_own_trainer/trainer.py19CODE
LOWexamples/fabric/meta_learning/train_torch.py56CODE
LOWexamples/fabric/meta_learning/train_fabric.py52CODE
LOW…mples/pytorch/domain_templates/reinforce_learn_Qnet.py236CODE
LOW…amples/pytorch/domain_templates/reinforce_learn_ppo.py155CODE
LOWsrc/lightning/fabric/fabric.py134CODE
LOWsrc/lightning/fabric/strategies/ddp.py56CODE
LOWsrc/lightning/fabric/strategies/fsdp.py150CODE
LOWsrc/lightning/fabric/strategies/deepspeed.py58CODE
LOWsrc/lightning/fabric/strategies/xla_fsdp.py84CODE
LOWsrc/lightning/fabric/utilities/testing/_runif.py30CODE
LOWsrc/lightning/pytorch/cli.py322CODE
LOWsrc/lightning/pytorch/tuner/lr_finder.py199CODE
LOWsrc/lightning/pytorch/tuner/tuning.py31CODE
LOWsrc/lightning/pytorch/tuner/tuning.py119CODE
LOWsrc/lightning/pytorch/loggers/mlflow.py116CODE
LOWsrc/lightning/pytorch/loggers/wandb.py294CODE
LOWsrc/lightning/pytorch/loggers/litlogger.py58CODE
LOWsrc/lightning/pytorch/core/module.py386CODE
LOWsrc/lightning/pytorch/core/module.py552CODE
LOWsrc/lightning/pytorch/core/module.py670CODE
LOWsrc/lightning/pytorch/callbacks/lr_finder.py91CODE
LOWsrc/lightning/pytorch/callbacks/pruning.py66CODE
LOWsrc/lightning/pytorch/callbacks/model_checkpoint.py263CODE
LOWsrc/lightning/pytorch/callbacks/finetuning.py408CODE
LOWsrc/lightning/pytorch/callbacks/early_stopping.py114CODE
LOWsrc/lightning/pytorch/callbacks/lambda_function.py41CODE
LOWsrc/lightning/pytorch/strategies/ddp.py71CODE
LOWsrc/lightning/pytorch/strategies/fsdp.py157CODE
LOWsrc/lightning/pytorch/strategies/deepspeed.py80CODE
LOWsrc/lightning/pytorch/profilers/pytorch.py233CODE
LOWsrc/lightning/pytorch/utilities/types.py54CODE
LOWsrc/lightning/pytorch/utilities/testing/_runif.py26CODE
LOW…tning/pytorch/utilities/model_summary/model_summary.py323CODE
LOWsrc/lightning/pytorch/demos/transformer.py82CODE
LOWsrc/lightning/pytorch/trainer/trainer.py91CODE
LOW…ng/pytorch/trainer/connectors/accelerator_connector.py75CODE
LOW…/pytorch/trainer/connectors/logger_connector/result.py355CODE
Redundant / Tautological Comments17 hits · 28 pts
SeverityFileLineSnippetContext
LOWtests/tests_pytorch/profilers/test_profiler.py715 # Check if setting max_name_column_width results in a wider table (more dashes)COMMENT
LOW…ts/tests_pytorch/trainer/flags/test_overfit_batches.py210 # Check if the batches are identicalCOMMENT
LOW…ghtning/fabric/plugins/precision/transformer_engine.py174 # Check if bias exists before attempting to clone its dataCOMMENT
LOWsrc/lightning/fabric/utilities/cloud_io.py172 # Check if the path is not already taken by a file. If not, it is considered a valid directory-like pathCOMMENT
LOWsrc/lightning/pytorch/tuner/batch_size_scaling.py207 # Check if this is the last trial before trying to doubleCOMMENT
LOWsrc/lightning/pytorch/tuner/batch_size_scaling.py271 # Check if we've reached max_trials before trying to adjust batch sizeCOMMENT
LOWsrc/lightning/pytorch/tuner/lr_finder.py430 # Check if we divergingCOMMENT
LOWsrc/lightning/pytorch/core/module.py1400 # Set gradients to `None` instead of zero to improve performance (not required on `torch>=2.0.0`).COMMENT
LOWsrc/lightning/pytorch/callbacks/pruning.py280 # Check if the parameter has been pruned (has _orig suffix)COMMENT
LOWsrc/lightning/pytorch/callbacks/model_checkpoint.py355 # Check if we should skip due to trainer/callback stateCOMMENT
LOWsrc/lightning/pytorch/callbacks/model_checkpoint.py376 if not saved_models: # Check if dictionary is not emptyCODE
LOWsrc/lightning/pytorch/strategies/model_parallel.py404 # Check if key starts with "prefix." (the compiled module path)COMMENT
LOWsrc/lightning/pytorch/utilities/parsing.py249 # Check if attribute in modelCOMMENT
LOWsrc/lightning/pytorch/utilities/parsing.py253 # Check if attribute in model.hparams, either namespace or dictCOMMENT
LOWsrc/lightning/pytorch/utilities/parsing.py258 # Check if the attribute in datamodule (datamodule gets registered in Trainer)COMMENT
LOW…ng/pytorch/trainer/connectors/accelerator_connector.py576 # Set benchmark to False to ensure determinismCOMMENT
LOW…tning/pytorch/trainer/connectors/callback_connector.py182 # Check if LitLogger is being used with log_model enabledCOMMENT
Excessive Try-Catch Wrapping17 hits · 20 pts
SeverityFileLineSnippetContext
LOW…sts/tests_pytorch/callbacks/test_throughput_monitor.py464 except Exception as e:CODE
LOWtests/tests_pytorch/helpers/datasets.py112 except Exception as ex:CODE
LOWtests/tests_pytorch/helpers/threading.py27 except Exception as e:CODE
MEDIUMtests/tests_pytorch/helpers/threading.py24def run(self):CODE
LOW…sts/tests_pytorch/trainer/test_ddp_sigterm_handling.py62 except Exception as e:CODE
LOWtests/tests_pytorch/trainer/test_trainer.py157 except Exception:CODE
LOWtests/tests_pytorch/trainer/test_trainer.py168 except Exception:CODE
LOW…torch/trainer/optimization/test_manual_optimization.py195 except Exception:CODE
LOWsrc/lightning/fabric/loggers/tensorboard.py215 except Exception as ex:STRING
LOWsrc/lightning/fabric/utilities/logger.py70 except Exception:CODE
LOWsrc/lightning/pytorch/tuner/batch_size_scaling.py100 except Exception as ex:CODE
LOWsrc/lightning/pytorch/tuner/lr_finder.py290 except Exception as ex:CODE
LOWsrc/lightning/pytorch/core/datamodule.py291 except Exception:CODE
LOWsrc/lightning/pytorch/loops/training_epoch_loop.py266 except Exception:CODE
MEDIUMsrc/lightning/pytorch/loops/training_epoch_loop.py259def _broadcast_sigterm_tensor(self) -> None:CODE
LOWsrc/lightning/pytorch/demos/mnist_datamodule.py112 except Exception as ex:CODE
MEDIUMsrc/lightning/pytorch/demos/mnist_datamodule.py138 print(f"Error {ex} downloading `torchvision.datasets.MNIST`")CODE
AI Slop Vocabulary9 hits · 14 pts
SeverityFileLineSnippetContext
MEDIUMtests/parity_fabric/utils.py27 # The median is more robust to outliers than the meanCOMMENT
MEDIUMtests/tests_fabric/utilities/test_data.py452 """This test asserts, that custom `BatchSampler`, with all the arguments, that are required in order to properlySTRING
LOWtests/tests_pytorch/callbacks/test_weight_averaging.py105 # model and will just call the epoch-level hooks. For that reason, we check that we are not restarting beforeCOMMENT
LOWtests/tests_pytorch/callbacks/test_weight_averaging.py154 # model and will just call the epoch-level hooks. For that reason, we check that we are not restarting beforeCOMMENT
LOW…/tests_pytorch/callbacks/test_stochastic_weight_avg.py107 # not update the model and just call the epoch-level hooks, for that reason, we check that we are notCOMMENT
MEDIUMtests/tests_pytorch/utilities/test_data.py144 """This test asserts, that custom `BatchSampler`, with all the arguments, that are required in order to properlySTRING
MEDIUMsrc/lightning/fabric/accelerators/cuda.py161 return major >= 8 # Ampere and later leverage tensor cores, where this setting becomes usefulCODE
LOWsrc/lightning/fabric/utilities/logger.py60 # If it's a class, don't try to instantiate it, just return the nameCOMMENT
MEDIUMsrc/lightning/fabric/utilities/distributed.py350 """Reset the sampler list in order to get new sampling."""STRING
Structural Annotation Overuse7 hits · 13 pts
SeverityFileLineSnippetContext
LOWREADME.md143# Step 1: Define a LightningModuleCOMMENT
LOWREADME.md176# Step 2: Define dataCOMMENT
LOWREADME.md182# Step 3: TrainCOMMENT
LOWsrc/pytorch_lightning/README.md93### Step 0: InstallCOMMENT
LOWsrc/pytorch_lightning/README.md144### Step 1: Add these importsCOMMENT
LOWsrc/pytorch_lightning/README.md157### Step 2: Define a LightningModule (nn.Module subclass)COMMENT
LOWsrc/pytorch_lightning/README.md190### Step 3: Train!COMMENT
Slop Phrases5 hits · 10 pts
SeverityFileLineSnippetContext
LOWexamples/fabric/image_classifier/train_fabric.py93 # don't forget to call `setup_dataloaders` to prepare for dataloaders for distributed training.COMMENT
LOWexamples/fabric/image_classifier/train_fabric.py93 # don't forget to call `setup_dataloaders` to prepare for dataloaders for distributed training.COMMENT
LOWexamples/fabric/image_classifier/train_fabric.py99 # don't forget to call `setup` to prepare for model / optimizer for distributed training.COMMENT
LOWexamples/fabric/image_classifier/train_fabric.py99 # don't forget to call `setup` to prepare for model / optimizer for distributed training.COMMENT
LOW…tning/fabric/strategies/launchers/subprocess_script.py132 # if hydra is available and initialized, make sure to set the cwd correctlySTRING
Example Usage Blocks2 hits · 3 pts
SeverityFileLineSnippetContext
LOWtests/legacy/generate_checkpoints.sh2# Usage:COMMENT
LOWdocs/generate_docs_for_tags.sh2# Usage:COMMENT