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/src/lightning/pytorch/_graveyard/legacy_import_unpickler.py | import contextlib
import pickle
import warnings
from typing import Any, Callable
import torchmetrics
from lightning_utilities.core.imports import compare_version as _compare_version
def _patch_pl_to_mirror_if_necessary(module: str) -> str:
pl = "pytorch_" + "lightning" # avoids replacement during mirror package... | 1,892 | 41.066667 | 105 | py |
lightning | lightning-master/src/lightning/pytorch/_graveyard/__init__.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... | 775 | 42.111111 | 74 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/layer_sync.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,868 | 39.302083 | 106 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/__init__.py | from typing import Union
from lightning.fabric.plugins import CheckpointIO, ClusterEnvironment, TorchCheckpointIO, XLACheckpointIO
from lightning.pytorch.plugins.io.async_plugin import AsyncCheckpointIO
from lightning.pytorch.plugins.layer_sync import LayerSync, TorchSyncBatchNorm
from lightning.pytorch.plugins.precis... | 1,288 | 39.28125 | 105 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/io/async_plugin.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,351 | 37.557377 | 103 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/io/__init__.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... | 847 | 35.869565 | 85 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/precision/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... | 4,551 | 40.009009 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/precision/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,198 | 43.2 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/precision/amp.py | # 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 writing, software
# distributed under th... | 5,828 | 45.261905 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/precision/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... | 1,291 | 34.888889 | 95 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/precision/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... | 4,500 | 39.54955 | 114 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/precision/__init__.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,338 | 42.193548 | 82 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/precision/precision_plugin.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,299 | 39.10989 | 117 | py |
lightning | lightning-master/src/lightning/pytorch/plugins/precision/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... | 2,571 | 40.483871 | 110 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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... | 1,513 | 36.85 | 105 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/exceptions.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,864 | 42.372093 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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... | 3,406 | 32.07767 | 113 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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... | 3,104 | 32.75 | 107 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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,436 | 35.373134 | 118 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/seed.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,766 | 38.266667 | 110 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/data.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,906 | 44.70977 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/deepspeed.py | # Copyright 2020 The PyTorch Lightning team and Microsoft Corporation. All rights reserved.
#
# 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
... | 4,683 | 40.821429 | 114 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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... | 6,795 | 46.194444 | 117 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/types.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,153 | 36.105882 | 114 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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... | 2,053 | 38.5 | 113 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/_pytree.py | from typing import Any, List, Tuple
from torch.utils._pytree import _get_node_type, LeafSpec, PyTree, SUPPORTED_NODES, tree_unflatten, TreeSpec
def _is_leaf_or_primitive_container(pytree: PyTree) -> bool:
"""Customized :func:`torch.utils._pytree._is_leaf` to avoid flattening containers of primitives."""
is_l... | 1,505 | 36.65 | 107 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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,666 | 36.56338 | 118 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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... | 12,318 | 36.330303 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/__init__.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,614 | 43.861111 | 115 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/argparse.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,688 | 36.347222 | 101 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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... | 12,440 | 36.7 | 116 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/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... | 1,998 | 42.456522 | 118 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/testing/_runif.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,767 | 36.68 | 116 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/testing/__init__.py | from lightning.pytorch.utilities.testing._runif import _runif_reasons
__all__ = ["_runif_reasons"]
| 100 | 24.25 | 69 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/migration/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... | 14,530 | 44.409375 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/migration/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... | 7,426 | 42.946746 | 118 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/migration/__init__.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... | 757 | 43.588235 | 88 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/model_summary/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... | 17,624 | 36.660256 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/model_summary/model_summary_deepspeed.py | # Copyright 2020 The PyTorch Lightning team and Microsoft Corporation. All rights reserved.
#
# 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
... | 4,430 | 38.918919 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/utilities/model_summary/__init__.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... | 910 | 38.608696 | 108 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/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... | 14,392 | 37.279255 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/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... | 10,614 | 40.143411 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/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... | 22,559 | 38.929204 | 118 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/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... | 4,991 | 33.427586 | 112 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/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... | 3,980 | 40.905263 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/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... | 22,501 | 36.691792 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/csv_logs.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,502 | 33.610063 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/__init__.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,378 | 40.787879 | 90 | py |
lightning | lightning-master/src/lightning/pytorch/loggers/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... | 16,057 | 36.518692 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/tuner/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... | 11,380 | 48.268398 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/tuner/batch_size_scaling.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,722 | 36.31085 | 117 | py |
lightning | lightning-master/src/lightning/pytorch/tuner/__init__.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... | 644 | 42 | 74 | py |
lightning | lightning-master/src/lightning/pytorch/tuner/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... | 19,031 | 36.687129 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/accelerators/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... | 3,450 | 33.858586 | 100 | py |
lightning | lightning-master/src/lightning/pytorch/accelerators/cuda.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,518 | 33.279503 | 113 | py |
lightning | lightning-master/src/lightning/pytorch/accelerators/accelerator.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,483 | 31.977778 | 111 | py |
lightning | lightning-master/src/lightning/pytorch/accelerators/__init__.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 writi... | 1,327 | 54.333333 | 99 | py |
lightning | lightning-master/src/lightning/pytorch/accelerators/cpu.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,115 | 31.8 | 100 | py |
lightning | lightning-master/src/lightning/pytorch/accelerators/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,916 | 37.34 | 91 | py |
lightning | lightning-master/src/lightning/pytorch/demos/mnist_datamodule.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,208 | 35.255906 | 118 | py |
lightning | lightning-master/src/lightning/pytorch/demos/transformer.py | """Demo of a simple transformer language model.
Code is adapted from the PyTorch examples at
https://github.com/pytorch/examples/blob/main/word_language_model
"""
import math
import os
from pathlib import Path
from typing import Dict, List, Optional, Tuple
import requests
import torch
import torch.nn as nn
import tor... | 4,998 | 32.777027 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/demos/boring_classes.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,823 | 29.44358 | 100 | py |
lightning | lightning-master/src/lightning/pytorch/demos/__init__.py | from lightning.pytorch.demos.transformer import Transformer, WikiText2 # noqa: F401
| 85 | 42 | 84 | py |
lightning | lightning-master/src/lightning/pytorch/overrides/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... | 1,934 | 36.941176 | 114 | py |
lightning | lightning-master/src/lightning/pytorch/overrides/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... | 11,759 | 41.150538 | 113 | py |
lightning | lightning-master/src/lightning/pytorch/profilers/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... | 1,008 | 32.633333 | 87 | py |
lightning | lightning-master/src/lightning/pytorch/profilers/advanced.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,717 | 39.413043 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/profilers/simple.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,768 | 41.572327 | 120 | py |
lightning | lightning-master/src/lightning/pytorch/profilers/pytorch.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,730 | 41.076241 | 118 | py |
lightning | lightning-master/src/lightning/pytorch/profilers/__init__.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,098 | 36.896552 | 74 | py |
lightning | lightning-master/src/lightning/pytorch/profilers/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... | 2,959 | 36.948718 | 114 | py |
lightning | lightning-master/src/lightning/pytorch/serve/servable_module.py | from abc import ABC, abstractmethod
from typing import Any, Callable, Dict, Tuple
import torch
from torch import Tensor
class ServableModule(ABC, torch.nn.Module):
"""The ServableModule provides a simple API to make your model servable.
.. warning:: This is an :ref:`experimental <versioning:Experimental AP... | 3,298 | 34.858696 | 119 | py |
lightning | lightning-master/src/lightning/pytorch/serve/__init__.py | from lightning.pytorch.serve.servable_module import ServableModule
from lightning.pytorch.serve.servable_module_validator import ServableModuleValidator
__all__ = ["ServableModuleValidator", "ServableModule"]
| 210 | 41.2 | 85 | py |
lightning | lightning-master/src/lightning/pytorch/serve/servable_module_validator.py | import contextlib
import logging
import time
from multiprocessing import Process
from typing import Any, Dict, Literal, Optional
import requests
import torch
from lightning_utilities.core.imports import RequirementCache
import lightning.pytorch as pl
from lightning.pytorch.callbacks import Callback
from lightning.pyt... | 7,230 | 40.557471 | 120 | py |
lightning | lightning-master/src/lightning_app/__setup__.py | import glob
import os
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from types import ModuleType
from typing import Any, Dict
from setuptools import find_packages
_PROJECT_ROOT = "."
_SOURCE_ROOT = os.path.join(_PROJECT_ROOT, "src")
_PACKAGE_ROOT = os.path.join(_SOURCE_... | 4,896 | 41.95614 | 107 | py |
lightning | lightning-master/src/lightning_app/__about__.py | #!/usr/bin/env python
# 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 l... | 1,148 | 30.916667 | 116 | py |
lightning | lightning-master/tests/parity_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... | 1,091 | 32.090909 | 105 | py |
lightning | lightning-master/tests/parity_fabric/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... | 2,332 | 37.245902 | 119 | py |
lightning | lightning-master/tests/parity_fabric/test_parity_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... | 5,357 | 31.083832 | 120 | py |
lightning | lightning-master/tests/parity_fabric/models.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,529 | 29.481928 | 76 | py |
lightning | lightning-master/tests/parity_fabric/test_parity_simple.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,749 | 29.844156 | 94 | py |
lightning | lightning-master/tests/tests_pytorch/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... | 63,515 | 38.377557 | 120 | py |
lightning | lightning-master/tests/tests_pytorch/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... | 12,083 | 35.618182 | 119 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/test_trainer.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... | 75,762 | 35.63588 | 120 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/test_states.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,465 | 37.511111 | 108 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/test_dataloaders.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... | 54,386 | 37.654584 | 120 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/test_config_validator.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,239 | 36.818182 | 114 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/logging_/test_logger_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... | 24,277 | 36.582043 | 115 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/logging_/test_distributed_logging.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,042 | 29.831633 | 120 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/logging_/test_train_loop_logging.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... | 29,328 | 36.505115 | 120 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/logging_/test_eval_loop_logging.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... | 40,677 | 39.556331 | 120 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/logging_/test_loop_logging.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,025 | 37.711538 | 111 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/optimization/test_backward_calls.py | from unittest.mock import patch
import pytest
import torch
from lightning.pytorch import Trainer
from lightning.pytorch.demos.boring_classes import BoringModel
@pytest.mark.parametrize("num_steps", [1, 2, 3])
@patch("torch.Tensor.backward")
def test_backward_count_simple(torch_backward, num_steps):
"""Test that... | 1,739 | 29 | 95 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/optimization/test_multiple_optimizers.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,919 | 32.181818 | 117 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/optimization/test_manual_optimization.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... | 33,343 | 35.08658 | 116 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/optimization/test_optimizers.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,455 | 37.864122 | 118 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/flags/test_limit_batches.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,830 | 35.485714 | 115 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/flags/test_barebones.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,061 | 42.126761 | 85 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/flags/test_inference_mode.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,958 | 31.163043 | 103 | py |
lightning | lightning-master/tests/tests_pytorch/trainer/flags/test_fast_dev_run.py | import os
from unittest.mock import Mock
import pytest
import torch
from lightning.pytorch import Trainer
from lightning.pytorch.callbacks import EarlyStopping, ModelCheckpoint
from lightning.pytorch.demos.boring_classes import BoringModel
from lightning.pytorch.loggers import TensorBoardLogger
from lightning.pytorch... | 5,067 | 38.905512 | 107 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.