repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
lightning
lightning-master/tests/tests_pytorch/plugins/precision/test_xlabf16.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
916
34.269231
74
py
lightning
lightning-master/tests/tests_pytorch/plugins/precision/test_xla.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,085
36.448276
80
py
lightning
lightning-master/tests/tests_pytorch/plugins/precision/test_amp.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,298
41.574074
113
py
lightning
lightning-master/tests/tests_pytorch/plugins/precision/test_amp_integration.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,965
33.491228
94
py
lightning
lightning-master/tests/tests_pytorch/plugins/precision/test_deepspeed_precision.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
881
37.347826
89
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_parameter_tying.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,579
32.506494
96
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_warnings.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,846
35.215686
80
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_model_helpers.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,260
42.480769
114
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_data.py
from dataclasses import dataclass import numpy as np import pytest import torch from lightning_utilities.test.warning import no_warning_call from torch import Tensor from torch.utils.data import BatchSampler, DataLoader, RandomSampler, SequentialSampler from lightning.fabric.utilities.data import _replace_dunder_meth...
11,793
40.094077
120
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_model_summary.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
14,161
33.710784
119
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_signature_utils.py
import torch from lightning.pytorch.utilities.signature_utils import is_param_in_hook_signature def test_param_in_hook_signature(): class LightningModule: def validation_step(self, dataloader_iter, batch_idx): ... model = LightningModule() assert is_param_in_hook_signature(model.vali...
1,241
32.567568
98
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_parsing.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
9,102
34.420233
117
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_deepspeed_model_summary.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,166
39.12963
111
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_seed.py
import random from unittest import mock import numpy as np import pytest import torch from lightning.pytorch.utilities.seed import isolate_rng from tests_pytorch.helpers.runif import RunIf @pytest.mark.parametrize("with_torch_cuda", [False, pytest.param(True, marks=RunIf(min_cuda_gpus=1))]) def test_isolate_rng(wit...
1,682
31.365385
102
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_combined_loader.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
21,826
36.24744
119
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_memory.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,178
35.84375
117
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_imports.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
5,628
35.316129
120
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_upgrade_checkpoint.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
4,206
38.688679
116
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_enums.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
934
41.5
74
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_compile.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
5,521
35.813333
117
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_grads.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
3,214
32.842105
108
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_deepspeed_collate_checkpoint.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,401
39.711864
111
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_dtype_device_mixin.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,880
30.881356
87
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_all_gather_grad.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
5,083
36.382353
89
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_exceptions.py
# Copyright The PyTorch Lightning team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
2,580
36.955882
76
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_pytree.py
import torch from torch.utils.data import DataLoader, TensorDataset from lightning.pytorch.utilities._pytree import _tree_flatten, tree_unflatten def assert_tree_flatten_unflatten(pytree, leaves): flat, spec = _tree_flatten(pytree) assert flat == leaves unflattened = tree_unflatten(flat, spec) assert...
2,497
36.283582
85
py
lightning
lightning-master/tests/tests_pytorch/utilities/test_auto_restart.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
5,565
40.537313
120
py
lightning
lightning-master/tests/tests_pytorch/utilities/testing/test_runif.py
import pytest from tests_pytorch.helpers.runif import RunIf @RunIf(min_torch="99") def test_always_skip(): exit(1) @pytest.mark.parametrize("arg1", [0.5, 1.0, 2.0]) @RunIf(min_torch="0.0") def test_wrapper(arg1: float): assert arg1 > 0.0
251
15.8
49
py
lightning
lightning-master/tests/tests_pytorch/utilities/migration/test_migration.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
13,121
46.032258
118
py
lightning
lightning-master/tests/tests_pytorch/utilities/migration/test_utils.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
6,595
42.111111
117
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_utilities.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,241
35.529412
74
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_wandb.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
18,500
36.225352
119
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_neptune.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
15,790
38.876263
119
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_comet.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
9,037
38.125541
119
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_csv.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
4,778
33.381295
102
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_mlflow.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
15,149
40.735537
119
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_tensorboard.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
11,952
34.259587
116
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_logger.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
11,699
32.333333
112
py
lightning
lightning-master/tests/tests_pytorch/loggers/test_all.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
14,277
36.279373
118
py
lightning
lightning-master/tests/tests_pytorch/graveyard/test_hpu.py
from importlib import import_module import pytest @pytest.mark.parametrize( ("import_path", "name"), [ ("lightning.pytorch.accelerators", "HPUAccelerator"), ("lightning.pytorch.accelerators.hpu", "HPUAccelerator"), ("lightning.pytorch.strategies", "HPUParallelStrategy"), ("lig...
1,048
39.346154
108
py
lightning
lightning-master/tests/tests_pytorch/graveyard/test_tpu.py
from importlib import import_module import pytest import torch @pytest.mark.parametrize( ("import_path", "name"), [ ("lightning.pytorch.strategies", "SingleTPUStrategy"), ("lightning.pytorch.strategies.single_tpu", "SingleTPUStrategy"), ], ) def test_graveyard_single_tpu(import_path, name...
1,436
34.925
110
py
lightning
lightning-master/tests/tests_pytorch/graveyard/test_ipu.py
from importlib import import_module import pytest @pytest.mark.parametrize( ("import_path", "name"), [ ("lightning.pytorch.accelerators", "IPUAccelerator"), ("lightning.pytorch.accelerators.ipu", "IPUAccelerator"), ("lightning.pytorch.strategies", "IPUStrategy"), ("lightning.p...
753
33.272727
108
py
lightning
lightning-master/tests/tests_pytorch/graveyard/test_legacy_import_unpickler.py
import glob import os import sys import pytest import torch from lightning_utilities.core.imports import module_available from lightning_utilities.test.warning import no_warning_call from packaging.version import Version from tests_pytorch.checkpointing.test_legacy_checkpoints import ( CHECKPOINT_EXTENSION, L...
3,464
44.592105
115
py
lightning
lightning-master/tests/tests_pytorch/tuner/test_lr_finder.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
17,121
32.837945
119
py
lightning
lightning-master/tests/tests_pytorch/tuner/test_tuning.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,011
39.24
103
py
lightning
lightning-master/tests/tests_pytorch/tuner/test_scale_batch_size.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
18,967
39.10148
119
py
lightning
lightning-master/tests/tests_pytorch/accelerators/test_xla.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
12,042
35.383686
118
py
lightning
lightning-master/tests/tests_pytorch/accelerators/test_common.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,027
31.190476
79
py
lightning
lightning-master/tests/tests_pytorch/accelerators/test_gpu.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,320
31.690141
103
py
lightning
lightning-master/tests/tests_pytorch/accelerators/test_mps.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
5,105
34.706294
118
py
lightning
lightning-master/tests/tests_pytorch/accelerators/test_registry.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,042
44.347826
104
py
lightning
lightning-master/tests/tests_pytorch/accelerators/test_cpu.py
import os from pathlib import Path from typing import Any, Dict, Union from unittest.mock import Mock import pytest import torch import lightning.pytorch as pl from lightning.fabric.plugins import TorchCheckpointIO from lightning.pytorch import Trainer from lightning.pytorch.accelerators import CPUAccelerator from li...
2,794
33.9375
108
py
lightning
lightning-master/tests/tests_pytorch/deprecated_api/test_no_removal_version.py
import pytest import torch.nn import lightning.fabric from lightning.pytorch import Trainer from lightning.pytorch.demos.boring_classes import BoringModel from lightning.pytorch.strategies import DDPStrategy, FSDPStrategy from tests_pytorch.helpers.runif import RunIf def test_configure_sharded_model(): class MyM...
1,570
33.152174
111
py
lightning
lightning-master/tests/tests_pytorch/overrides/test_distributed.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
3,698
35.99
115
py
lightning
lightning-master/tests/tests_pytorch/overrides/test_base.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
948
35.5
81
py
lightning
lightning-master/tests/tests_pytorch/profilers/test_profiler.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
25,502
37.817352
163
py
lightning
lightning-master/tests/tests_pytorch/profilers/test_xla_profiler.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,006
32.45
116
py
lightning
lightning-master/tests/tests_pytorch/serve/test_servable_module_validator.py
from typing import Dict import pytest import torch from torch import Tensor from lightning.pytorch import Trainer from lightning.pytorch.demos.boring_classes import BoringModel from lightning.pytorch.serve.servable_module_validator import ServableModule, ServableModuleValidator class ServableBoringModel(BoringModel...
1,481
26.962264
101
py
lightning
lightning-master/tests/tests_app/core/scripts/registry.py
from lightning.app.utilities.imports import _is_pytorch_lightning_available if _is_pytorch_lightning_available(): import torch from torch.utils.data import DataLoader, Dataset from pytorch_lightning import LightningDataModule, LightningModule from pytorch_lightning.cli import LightningCLI class R...
3,366
31.375
96
py
lightning
lightning-master/tests/tests_app/core/scripts/lightning_trainer.py
import argparse from lightning.app.utilities.imports import _is_pytorch_lightning_available, _is_torch_available if _is_torch_available(): import torch from torch.utils.data import DataLoader, Dataset if _is_pytorch_lightning_available(): import pytorch_lightning as pl from pytorch_lightning import L...
2,173
27.986667
96
py
lightning
lightning-master/tests/tests_app/core/scripts/lightning_cli.py
from lightning.app.utilities.imports import _is_pytorch_lightning_available, _is_torch_available if _is_torch_available(): import torch from torch.utils.data import DataLoader, Dataset if _is_pytorch_lightning_available(): from pytorch_lightning import cli, LightningDataModule, LightningModule if __name_...
1,884
29.901639
96
py
lightning
lightning-master/tests/tests_app/core/scripts/lightning_overrides.py
from lightning.app.utilities.imports import _is_pytorch_lightning_available, _is_torch_available if _is_torch_available(): from torch.utils.data import Dataset if _is_pytorch_lightning_available(): from torchmetrics import Metric from lightning.fabric import Fabric from pytorch_lightning import Light...
1,245
22.961538
96
py
lightning
lightning-master/tests/tests_app/utilities/test_introspection.py
import os from numbers import Rational from lightning.app import LightningApp, LightningFlow from lightning.app.testing.helpers import _RunIf from lightning.app.utilities.imports import _is_pytorch_lightning_available from lightning.app.utilities.introspection import Scanner if _is_pytorch_lightning_available(): ...
2,288
36.52459
113
py
lightning
lightning-master/tests/tests_app/utilities/test_tracer.py
import os import sys from lightning.app.testing.helpers import _RunIf from lightning.app.utilities.tracer import Tracer from tests_app import _PROJECT_ROOT @_RunIf(pl=True) def test_tracer(): from pytorch_lightning import Trainer def pre_fn(self, *args, **kwargs): kwargs["fast_dev_run"] = True ...
757
27.074074
98
py
lightning
lightning-master/tests/tests_app/utilities/packaging/test_build_spec.py
import logging import os import sys from unittest.mock import Mock from lightning.app.testing import application_testing, LightningTestApp from lightning.app.utilities.packaging.build_config import BuildConfig from tests_app import _TESTS_ROOT EXTRAS_ARGS = ["--blocking", "False", "--multiprocess", "--open-ui", "Fals...
4,011
37.209524
112
py
lightning
lightning-master/tests/tests_app/components/sample_package_repo/setup.py
import json import os from setuptools import find_packages, setup from setuptools.command.install import install LIGHTNING_COMPONENT_INFO = { "package": "external_lightning_component_package", "version": "0.0.1", "entry_point": "myorg.lightning_modules", } class PostInstallCommand(install): def run(...
1,479
30.489362
116
py
lightning
lightning-master/tests/tests_app/components/serve/test_model_inference_api.py
import base64 import multiprocessing as mp import os from unittest.mock import ANY, MagicMock import pytest from lightning.app.components.serve import serve from lightning.app.testing.helpers import _RunIf from lightning.app.utilities.imports import _is_numpy_available, _is_torch_available from lightning.app.utilitie...
2,542
30.012195
113
py
lightning
lightning-master/tests/tests_app/components/multi_node/test_trainer.py
import os from copy import deepcopy from functools import partial from unittest import mock import pytest from lightning_utilities.core.imports import module_available from lightning_utilities.test.warning import no_warning_call import pytorch_lightning as pl from lightning.app.components.multi_node.trainer import _L...
3,554
35.27551
118
py
lightning
lightning-master/tests/tests_app/runners/test_cloud.py
import contextlib import logging import os import pathlib import re import sys from copy import copy from pathlib import Path from unittest import mock from unittest.mock import MagicMock import pytest from lightning_cloud.openapi import ( CloudspaceIdRunsBody, Externalv1Cluster, Externalv1LightningappInst...
97,714
45.048539
120
py
lightning
lightning-master/tests/tests_cloud/test_requirements.py
import os from lightning.pytorch.demos.boring_classes import BoringModel from lightning.store import download_model, upload_model from lightning.store.save import __STORAGE_DIR_NAME from tests_cloud import _API_KEY, _PROJECT_ID, _USERNAME def test_requirements(lit_home, version: str = "1.0.0", model_name: str = "bor...
1,135
34.5
109
py
lightning
lightning-master/tests/tests_cloud/test_versioning.py
import os import platform import pytest from lightning.pytorch.demos.boring_classes import BoringModel from lightning.store.cloud_api import download_model, upload_model from lightning.store.save import __STORAGE_DIR_NAME from tests_cloud import _API_KEY, _PROJECT_ID, _USERNAME def assert_download_successful(lit_ho...
1,947
33.175439
109
py
lightning
lightning-master/tests/tests_cloud/test_source_code.py
import inspect import os import tempfile from lightning.pytorch.demos.boring_classes import BoringModel from lightning.store import download_model, upload_model from lightning.store.save import __STORAGE_DIR_NAME from tests_cloud import _API_KEY, _PROJECT_ID, _PROJECT_ROOT, _TEST_ROOT, _USERNAME def test_source_code...
3,176
30.77
120
py
lightning
lightning-master/tests/tests_cloud/test_model.py
import os import pytest from lightning.pytorch import Trainer from lightning.pytorch.demos.boring_classes import BoringModel from lightning.store import download_model, load_model, upload_model from lightning.store.save import __STORAGE_DIR_NAME from tests_cloud import _API_KEY, _PROJECT_ID, _USERNAME @pytest.mark....
2,046
40.77551
115
py
lightning
lightning-master/tests/tests_fabric/test_cli.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
7,024
38.027778
113
py
lightning
lightning-master/tests/tests_fabric/test_fabric.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
44,905
38.01477
120
py
lightning
lightning-master/tests/tests_fabric/conftest.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
7,261
38.68306
119
py
lightning
lightning-master/tests/tests_fabric/test_wrappers.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
21,476
37.558348
118
py
lightning
lightning-master/tests/tests_fabric/test_connector.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
42,964
40.3125
116
py
lightning
lightning-master/tests/tests_fabric/strategies/test_xla.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
7,052
37.752747
117
py
lightning
lightning-master/tests/tests_fabric/strategies/test_ddp_integration.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,296
34.890625
89
py
lightning
lightning-master/tests/tests_fabric/strategies/test_deepspeed.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
16,756
41.966667
119
py
lightning
lightning-master/tests/tests_fabric/strategies/test_ddp.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
8,545
43.051546
116
py
lightning
lightning-master/tests/tests_fabric/strategies/test_fsdp.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
23,387
42.311111
120
py
lightning
lightning-master/tests/tests_fabric/strategies/test_single_device.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
5,766
37.446667
113
py
lightning
lightning-master/tests/tests_fabric/strategies/test_deepspeed_integration.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
16,221
38.089157
116
py
lightning
lightning-master/tests/tests_fabric/strategies/test_fsdp_integration.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
18,530
42.195804
118
py
lightning
lightning-master/tests/tests_fabric/strategies/test_dp.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
3,384
36.611111
107
py
lightning
lightning-master/tests/tests_fabric/strategies/test_strategy.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
10,790
44.724576
114
py
lightning
lightning-master/tests/tests_fabric/strategies/launchers/test_multiprocessing.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
4,289
43.226804
114
py
lightning
lightning-master/tests/tests_fabric/helpers/models.py
from typing import Any, Iterator import torch import torch.nn as nn from torch import Tensor from torch.nn import Module from torch.optim import Optimizer from torch.utils.data import DataLoader, Dataset, IterableDataset from lightning.fabric import Fabric class RandomDataset(Dataset): def __init__(self, size: ...
2,206
27.294872
80
py
lightning
lightning-master/tests/tests_fabric/plugins/precision/test_half.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,383
30.368421
74
py
lightning
lightning-master/tests/tests_fabric/plugins/precision/test_amp.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
4,291
38.018182
115
py
lightning
lightning-master/tests/tests_fabric/plugins/precision/test_deepspeed.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
3,512
32.457143
102
py
lightning
lightning-master/tests/tests_fabric/plugins/precision/test_fsdp.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
4,735
36.291339
103
py
lightning
lightning-master/tests/tests_fabric/plugins/precision/test_double.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
1,232
36.363636
74
py
lightning
lightning-master/tests/tests_fabric/plugins/precision/test_amp_integration.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
3,798
34.839623
105
py
lightning
lightning-master/tests/tests_fabric/plugins/precision/test_double_integration.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,020
34.45614
100
py
lightning
lightning-master/tests/tests_fabric/plugins/collectives/test_torch_collective.py
import contextlib import datetime import os from functools import partial from unittest import mock import pytest import torch from lightning.fabric.accelerators import CPUAccelerator, CUDAAccelerator from lightning.fabric.plugins.collectives import TorchCollective from lightning.fabric.plugins.environments import Li...
12,991
41.045307
119
py
lightning
lightning-master/tests/tests_fabric/plugins/environments/test_xla.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
3,867
35.490566
104
py
lightning
lightning-master/tests/tests_fabric/plugins/environments/test_torchelastic.py
# Copyright The Lightning AI team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
2,783
31.752941
109
py