repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
pytorch-lightning | examples/pytorch/domain_templates/semantic_segmentation.py | .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... | 407 | 14,273 |
pytorch-lightning | examples/pytorch/domain_templates/imagenet.py | .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... | 196 | 7,286 |
pytorch-lightning | examples/pytorch/domain_templates/computer_vision_fine_tuning.py | .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... | 285 | 10,298 |
pytorch-lightning | examples/pytorch/domain_templates/reinforce_learn_ppo.py | .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... | 465 | 17,067 |
pytorch-lightning | examples/pytorch/domain_templates/reinforce_learn_Qnet.py | .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... | 409 | 13,266 |
pytorch-lightning | examples/fabric/tensor_parallel/train.py | .py | import torch
import torch.nn.functional as F
from data import RandomTokenDataset
from model import ModelArgs, Transformer
from parallelism import parallelize
from torch.distributed.tensor.parallel import loss_parallel
from torch.utils.data import DataLoader
import lightning as L
from lightning.fabric.strategies import... | 80 | 2,803 |
pytorch-lightning | examples/fabric/fp8_distributed_transformer/train.py | .py | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributed._composable.fsdp.fully_shard import fully_shard
from torch.distributed.device_mesh import DeviceMesh
from torch.utils.data import DataLoader
from torchao.float8 import Float8LinearConfig, convert_to_float8_training
from tqdm impor... | 102 | 3,113 |
pytorch-lightning | examples/fabric/dcgan/train_torch.py | .py | """
DCGAN - Raw PyTorch Implementation
Code adapted from the official PyTorch DCGAN tutorial:
https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html
"""
import os
import random
import time
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim as optim
impor... | 276 | 9,334 |
pytorch-lightning | examples/fabric/dcgan/train_fabric.py | .py | """
DCGAN - Accelerated with Lightning Fabric
Code adapted from the official PyTorch DCGAN tutorial:
https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html
"""
import os
import time
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim as optim
import torch... | 268 | 9,058 |
pytorch-lightning | examples/fabric/reinforcement_learning/train_torch.py | .py | """
Proximal Policy Optimization (PPO) - Accelerated with Lightning Fabric
Author: Federico Belotti @belerico
Adapted from https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo.py
Based on the paper: https://arxiv.org/abs/1707.06347
Requirements:
- gymnasium[box2d]>=0.27.1
- moviepy
- lightning
- torchmetrics
- ... | 276 | 10,888 |
pytorch-lightning | examples/fabric/reinforcement_learning/train_fabric.py | .py | """
Proximal Policy Optimization (PPO) - Accelerated with Lightning Fabric
Author: Federico Belotti @belerico
Adapted from https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo.py
Based on the paper: https://arxiv.org/abs/1707.06347
Requirements:
- gymnasium[box2d]>=0.27.1
- moviepy
- lightning
- torchmetrics
- ... | 211 | 8,259 |
pytorch-lightning | examples/fabric/reinforcement_learning/train_fabric_decoupled.py | .py | """
Proximal Policy Optimization (PPO) - Accelerated with Lightning Fabric
Author: Federico Belotti @belerico
Adapted from https://github.com/vwxyzjn/cleanrl/blob/master/cleanrl/ppo.py
Based on the paper: https://arxiv.org/abs/1707.06347
Requirements:
- gymnasium[box2d]>=0.27.1
- moviepy
- lightning
- torchmetrics
- ... | 352 | 14,662 |
pytorch-lightning | examples/fabric/reinforcement_learning/rl/utils.py | .py | import argparse
import math
import os
from typing import TYPE_CHECKING, Optional, Union
import gymnasium as gym
import torch
from torch.utils.tensorboard import SummaryWriter
if TYPE_CHECKING:
from rl.agent import PPOAgent, PPOLightningAgent
def strtobool(val):
"""Convert a string representation of truth to... | 199 | 7,078 |
pytorch-lightning | examples/fabric/reinforcement_learning/rl/loss.py | .py | import torch
import torch.nn.functional as F
from torch import Tensor
def policy_loss(advantages: torch.Tensor, ratio: torch.Tensor, clip_coef: float) -> torch.Tensor:
pg_loss1 = -advantages * ratio
pg_loss2 = -advantages * torch.clamp(ratio, 1 - clip_coef, 1 + clip_coef)
return torch.max(pg_loss1, pg_los... | 30 | 849 |
pytorch-lightning | examples/fabric/reinforcement_learning/rl/agent.py | .py | import math
import gymnasium as gym
import torch
import torch.nn.functional as F
from torch import Tensor
from torch.distributions import Categorical
from torchmetrics import MeanMetric
from lightning.pytorch import LightningModule
from rl.loss import entropy_loss, policy_loss, value_loss
from rl.utils import layer_i... | 248 | 9,238 |
pytorch-lightning | examples/fabric/build_your_own_trainer/run.py | .py | import torch
from torchmetrics.functional.classification.accuracy import accuracy
from trainer import MyCustomTrainer
import lightning as L
class MNISTModule(L.LightningModule):
def __init__(self) -> None:
super().__init__()
self.model = torch.nn.Sequential(
torch.nn.Conv2d(
... | 83 | 2,790 |
pytorch-lightning | examples/fabric/build_your_own_trainer/trainer.py | .py | import os
from collections.abc import Iterable, Mapping
from functools import partial
from typing import Any, Literal, Optional, Union, cast
import torch
from lightning_utilities import apply_to_collection
from tqdm import tqdm
import lightning as L
from lightning.fabric.accelerators import Accelerator
from lightning... | 545 | 23,333 |
pytorch-lightning | examples/fabric/kfold_cv/train_fabric.py | .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... | 192 | 7,504 |
pytorch-lightning | examples/fabric/image_classifier/train_torch.py | .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... | 153 | 5,608 |
pytorch-lightning | examples/fabric/image_classifier/train_fabric.py | .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... | 188 | 7,518 |
pytorch-lightning | examples/fabric/language_model/train.py | .py | import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader, random_split
import lightning as L
from lightning.pytorch.demos import Transformer, WikiText2
def main():
L.seed_everything(42)
fabric = L.Fabric()
# Data
dataset = WikiText2()
train_dataloader, val_dataloader... | 77 | 2,516 |
pytorch-lightning | examples/fabric/meta_learning/train_torch.py | .py | """
MAML - Raw PyTorch implementation using the Learn2Learn library
Adapted from https://github.com/learnables/learn2learn/blob/master/examples/vision/distributed_maml.py
Original code author: Séb Arnold - learnables.net
Based on the paper: https://arxiv.org/abs/1703.03400
Requirements:
- learn2learn
- cherry-rl
- gy... | 182 | 5,983 |
pytorch-lightning | examples/fabric/meta_learning/train_fabric.py | .py | """
MAML - Accelerated with Lightning Fabric
Adapted from https://github.com/learnables/learn2learn/blob/master/examples/vision/distributed_maml.py
Original code author: Séb Arnold - learnables.net
Based on the paper: https://arxiv.org/abs/1703.03400
Requirements:
- lightning>=1.9.0
- learn2learn
- cherry-rl
- gym<=0... | 165 | 5,546 |
pytorch-lightning | src/lightning_fabric/__about__.py | .py | import time
__author__ = "Lightning AI et al."
__author_email__ = "developer@lightning.ai"
__license__ = "Apache-2.0"
__copyright__ = f"Copyright (c) 2022-{time.strftime('%Y')}, {__author__}."
__homepage__ = "https://github.com/Lightning-AI/lightning"
__docs_url__ = "https://lightning.ai/docs/pytorch/stable/"
__docs__... | 20 | 479 |
pytorch-lightning | src/lightning_fabric/__version__.py | .py | import os
_PACKAGE_ROOT = os.path.dirname(__file__)
_VERSION_PATH = os.path.join(os.path.dirname(_PACKAGE_ROOT), "version.info")
if not os.path.exists(_VERSION_PATH):
# relevant for `bdist_wheel`
_VERSION_PATH = os.path.join(_PACKAGE_ROOT, "version.info")
with open(_VERSION_PATH, encoding="utf-8") as fopen:
... | 10 | 361 |
pytorch-lightning | src/lightning_fabric/__setup__.py | .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
from packaging.requirements import Requirement
from setuptools import find_packages
_PROJECT_ROOT = "."
_SOURCE_ROOT = os.path.join(_PROJECT_ROOT, "sr... | 119 | 5,152 |
pytorch-lightning | src/pytorch_lightning/__about__.py | .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... | 58 | 2,173 |
pytorch-lightning | src/pytorch_lightning/__setup__.py | .py | import glob
import os.path
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from types import ModuleType
from typing import Any
from packaging.requirements import Requirement
from setuptools import find_packages
_PROJECT_ROOT = "."
_SOURCE_ROOT = os.path.join(_PROJECT_ROOT... | 121 | 5,298 |
pytorch-lightning | src/lightning/__init__.py | .py | """Root package info."""
import logging
# explicitly don't set root logger's propagation and leave this to subpackages to manage
_logger = logging.getLogger(__name__)
_logger.setLevel(logging.INFO)
_console = logging.StreamHandler()
_console.setLevel(logging.INFO)
formatter = logging.Formatter("%(levelname)s: %(mes... | 33 | 1,009 |
pytorch-lightning | src/lightning/__about__.py | .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... | 41 | 1,287 |
pytorch-lightning | src/lightning/__setup__.py | .py | import glob
import os.path
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
from types import ModuleType
from typing import Any
from setuptools import find_namespace_packages
_PROJECT_ROOT = "."
_SOURCE_ROOT = os.path.join(_PROJECT_ROOT, "src")
_PACKAGE_ROOT = os.path.join... | 132 | 5,840 |
pytorch-lightning | src/lightning/pytorch/__init__.py | .py | """Root package info."""
import logging
import os
from lightning_utilities import module_available
if os.path.isfile(os.path.join(os.path.dirname(__file__), "__about__.py")):
from lightning.pytorch.__about__ import * # noqa: F403
if "__version__" not in locals():
if os.path.isfile(os.path.join(os.path.dirna... | 71 | 2,592 |
pytorch-lightning | src/lightning/pytorch/cli.py | .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... | 906 | 42,235 |
pytorch-lightning | src/lightning/pytorch/loggers/litlogger.py | .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... | 421 | 16,815 |
pytorch-lightning | src/lightning/pytorch/loggers/logger.py | .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... | 152 | 5,120 |
pytorch-lightning | src/lightning/pytorch/loggers/mlflow.py | .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... | 399 | 14,924 |
pytorch-lightning | src/lightning/pytorch/loggers/__init__.py | .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... | 31 | 1,132 |
pytorch-lightning | src/lightning/pytorch/loggers/utilities.py | .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... | 103 | 4,266 |
pytorch-lightning | src/lightning/pytorch/loggers/neptune.py | .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... | 46 | 1,598 |
pytorch-lightning | src/lightning/pytorch/loggers/csv_logs.py | .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... | 164 | 5,547 |
pytorch-lightning | src/lightning/pytorch/loggers/wandb.py | .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... | 687 | 25,507 |
pytorch-lightning | src/lightning/pytorch/loggers/comet.py | .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... | 422 | 15,244 |
pytorch-lightning | src/lightning/pytorch/loggers/tensorboard.py | .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... | 263 | 10,417 |
pytorch-lightning | src/lightning/pytorch/serve/servable_module.py | .py | from abc import ABC, abstractmethod
from typing import Any, Callable
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 API>` feature.
... | 95 | 3,288 |
pytorch-lightning | src/lightning/pytorch/serve/__init__.py | .py | from lightning.pytorch.serve.servable_module import ServableModule
from lightning.pytorch.serve.servable_module_validator import ServableModuleValidator
__all__ = ["ServableModuleValidator", "ServableModule"]
| 5 | 210 |
pytorch-lightning | src/lightning/pytorch/serve/servable_module_validator.py | .py | import contextlib
import logging
import time
from multiprocessing import Process
from typing import Any, Literal, Optional
import requests
import torch
from lightning_utilities.core.imports import RequirementCache
from typing_extensions import override
import lightning.pytorch as pl
from lightning.pytorch.callbacks i... | 178 | 7,264 |
pytorch-lightning | src/lightning/pytorch/demos/transformer.py | .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 Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from lightn... | 215 | 7,500 |
pytorch-lightning | src/lightning/pytorch/demos/boring_classes.py | .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... | 340 | 10,394 |
pytorch-lightning | src/lightning/pytorch/demos/mnist_datamodule.py | .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... | 260 | 9,271 |
pytorch-lightning | src/lightning/pytorch/demos/__init__.py | .py | from lightning.pytorch.demos.boring_classes import BoringDataModule, BoringModel, DemoModel
from lightning.pytorch.demos.lstm import LightningLSTM, SequenceSampler, SimpleLSTM
from lightning.pytorch.demos.transformer import LightningTransformer, Transformer, WikiText2
__all__ = [
"LightningLSTM",
"SequenceSamp... | 16 | 470 |
pytorch-lightning | src/lightning/pytorch/demos/lstm.py | .py | """Demo of a simple LSTM language model.
Code is adapted from the PyTorch examples at
https://github.com/pytorch/examples/blob/main/word_language_model
"""
from collections.abc import Iterator, Sized
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import Ten... | 100 | 3,508 |
pytorch-lightning | src/lightning/pytorch/trainer/configuration_validator.py | .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... | 166 | 8,613 |
pytorch-lightning | src/lightning/pytorch/trainer/setup.py | .py | # Copyright Lightning AI.
#
# 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, sof... | 244 | 10,174 |
pytorch-lightning | src/lightning/pytorch/trainer/call.py | .py | # Copyright Lightning AI.
#
# 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, sof... | 335 | 12,879 |
pytorch-lightning | src/lightning/pytorch/trainer/trainer.py | .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,793 | 79,297 |
pytorch-lightning | src/lightning/pytorch/trainer/states.py | .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... | 89 | 2,891 |
pytorch-lightning | src/lightning/pytorch/trainer/connectors/signal_connector.py | .py | import logging
import os
import re
import signal
import threading
from subprocess import call
from types import FrameType
from typing import Any, Callable, Union
import torch
import torch.distributed as dist
import lightning.pytorch as pl
from lightning.fabric.plugins.environments import SLURMEnvironment
from lightni... | 163 | 6,737 |
pytorch-lightning | src/lightning/pytorch/trainer/connectors/callback_connector.py | .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... | 281 | 13,115 |
pytorch-lightning | src/lightning/pytorch/trainer/connectors/data_connector.py | .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... | 514 | 22,889 |
pytorch-lightning | src/lightning/pytorch/trainer/connectors/accelerator_connector.py | .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... | 594 | 28,727 |
pytorch-lightning | src/lightning/pytorch/trainer/connectors/checkpoint_connector.py | .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... | 567 | 25,298 |
pytorch-lightning | src/lightning/pytorch/trainer/connectors/logger_connector/result.py | .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... | 534 | 20,363 |
pytorch-lightning | src/lightning/pytorch/trainer/connectors/logger_connector/fx_validator.py | .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... | 200 | 9,315 |
pytorch-lightning | src/lightning/pytorch/trainer/connectors/logger_connector/logger_connector.py | .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... | 275 | 10,998 |
pytorch-lightning | src/lightning/pytorch/overrides/distributed.py | .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... | 268 | 11,150 |
pytorch-lightning | src/lightning/pytorch/strategies/strategy.py | .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... | 650 | 25,609 |
pytorch-lightning | src/lightning/pytorch/strategies/deepspeed.py | .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... | 946 | 42,084 |
pytorch-lightning | src/lightning/pytorch/strategies/parallel.py | .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... | 135 | 5,093 |
pytorch-lightning | src/lightning/pytorch/strategies/__init__.py | .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 | 1,660 |
pytorch-lightning | src/lightning/pytorch/strategies/single_device.py | .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... | 102 | 3,316 |
pytorch-lightning | src/lightning/pytorch/strategies/xla.py | .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... | 366 | 13,236 |
pytorch-lightning | src/lightning/pytorch/strategies/single_xla.py | .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... | 123 | 4,690 |
pytorch-lightning | src/lightning/pytorch/strategies/model_parallel.py | .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... | 424 | 18,274 |
pytorch-lightning | src/lightning/pytorch/strategies/fsdp.py | .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... | 697 | 31,849 |
pytorch-lightning | src/lightning/pytorch/strategies/ddp.py | .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... | 473 | 20,670 |
pytorch-lightning | src/lightning/pytorch/strategies/launchers/xla.py | .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... | 177 | 7,510 |
pytorch-lightning | src/lightning/pytorch/strategies/launchers/multiprocessing.py | .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... | 323 | 14,371 |
pytorch-lightning | src/lightning/pytorch/strategies/launchers/subprocess_script.py | .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... | 160 | 7,015 |
pytorch-lightning | src/lightning/pytorch/_graveyard/tpu.py | .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... | 126 | 4,527 |
pytorch-lightning | src/lightning/pytorch/_graveyard/hpu.py | .py | import sys
from typing import Any
import lightning.pytorch as pl
def _patch_sys_modules() -> None:
self = sys.modules[__name__]
sys.modules["lightning.pytorch.accelerators.hpu"] = self
sys.modules["lightning.pytorch.strategies.hpu_parallel"] = self
sys.modules["lightning.pytorch.strategies.single_hpu... | 72 | 2,400 |
pytorch-lightning | src/lightning/pytorch/_graveyard/precision.py | .py | import sys
from typing import TYPE_CHECKING, Any, Literal, Optional
import lightning.pytorch as pl
from lightning.fabric.utilities.rank_zero import rank_zero_deprecation
from lightning.pytorch.plugins.precision import (
BitsandbytesPrecision,
DeepSpeedPrecision,
DoublePrecision,
FSDPPrecision,
Half... | 87 | 3,310 |
pytorch-lightning | src/lightning/pytorch/_graveyard/_torchmetrics.py | .py | from typing import Callable
import torchmetrics
from lightning_utilities.core.imports import compare_version as _compare_version
from lightning.pytorch.utilities.imports import _TORCHMETRICS_GREATER_EQUAL_0_8_0
from lightning.pytorch.utilities.migration.utils import _patch_pl_to_mirror_if_necessary
def compare_vers... | 21 | 967 |
pytorch-lightning | src/lightning/pytorch/accelerators/cpu.py | .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... | 109 | 3,313 |
pytorch-lightning | src/lightning/pytorch/accelerators/__init__.py | .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... | 36 | 1,415 |
pytorch-lightning | src/lightning/pytorch/accelerators/xla.py | .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... | 65 | 2,108 |
pytorch-lightning | src/lightning/pytorch/accelerators/accelerator.py | .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... | 48 | 1,517 |
pytorch-lightning | src/lightning/pytorch/accelerators/mps.py | .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... | 114 | 3,679 |
pytorch-lightning | src/lightning/pytorch/accelerators/cuda.py | .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... | 178 | 5,751 |
pytorch-lightning | src/lightning/pytorch/profilers/simple.py | .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... | 162 | 6,736 |
pytorch-lightning | src/lightning/pytorch/profilers/profiler.py | .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... | 163 | 5,758 |
pytorch-lightning | src/lightning/pytorch/profilers/xla.py | .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... | 82 | 3,004 |
pytorch-lightning | src/lightning/pytorch/profilers/advanced.py | .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... | 128 | 5,170 |
pytorch-lightning | src/lightning/pytorch/profilers/base.py | .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... | 35 | 1,077 |
pytorch-lightning | src/lightning/pytorch/profilers/pytorch.py | .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... | 579 | 24,129 |
pytorch-lightning | src/lightning/pytorch/core/hooks.py | .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... | 713 | 26,862 |
pytorch-lightning | src/lightning/pytorch/core/datamodule.py | .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... | 327 | 14,581 |
pytorch-lightning | src/lightning/pytorch/core/module.py | .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,850 | 80,993 |
pytorch-lightning | src/lightning/pytorch/core/saving.py | .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... | 392 | 15,314 |
pytorch-lightning | src/lightning/pytorch/core/optimizer.py | .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... | 420 | 18,382 |
pytorch-lightning | src/lightning/pytorch/core/mixins/hparams_mixin.py | .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... | 192 | 7,381 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.