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/examples/app/server_with_auto_scaler/app.py
# ! pip install torch torchvision from typing import List import torch import torchvision from pydantic import BaseModel import lightning as L class BatchRequestModel(BaseModel): inputs: List[L.app.components.Image] class BatchResponse(BaseModel): outputs: List[L.app.components.Number] class PyTorchServ...
3,008
31.706522
97
py
lightning
lightning-master/examples/app/components/python/pl_script.py
from lightning.pytorch import Trainer from lightning.pytorch.demos.boring_classes import BoringModel if __name__ == "__main__": model = BoringModel() trainer = Trainer(max_epochs=1, accelerator="cpu", devices=2, strategy="ddp") trainer.fit(model) trainer.validate(model) trainer.test(model) trai...
339
29.909091
81
py
lightning
lightning-master/examples/app/components/python/component_tracer.py
from lightning.app.components import TracerPythonScript from lightning.app.storage import Path from lightning.app.utilities.tracer import Tracer from lightning.pytorch import Trainer class PLTracerPythonScript(TracerPythonScript): """This component can be used for ANY PyTorch Lightning script to track its progres...
2,181
40.169811
115
py
lightning
lightning-master/examples/app/components/serve/gradio/app.py
from functools import partial import gradio as gr import requests import torch from PIL import Image import lightning as L from lightning.app.components import ServeGradio # Credit to @akhaliq for his inspiring work. # Find his original code there: https://huggingface.co/spaces/akhaliq/AnimeGANv2/blob/main/app.py c...
1,504
27.396226
156
py
lightning
lightning-master/examples/app/server/app.py
# !pip install torchvision pydantic import base64 import io import torch import torchvision from PIL import Image from pydantic import BaseModel import lightning as L from lightning.app.components.serve import Image as InputImage from lightning.app.components.serve import PythonServer class PyTorchServer(PythonServ...
1,348
30.372093
109
py
lightning
lightning-master/examples/app/multi_node/train_lt.py
# app.py import lightning as L from lightning.app.components import LightningTrainerMultiNode from lightning.pytorch.demos.boring_classes import BoringModel class LightningTrainerDistributed(L.LightningWork): def run(self): model = BoringModel() trainer = L.Trainer(max_epochs=10, strategy="ddp") ...
567
26.047619
63
py
lightning
lightning-master/examples/app/multi_node/train_fabric.py
import torch import lightning as L from lightning.app.components import FabricMultiNode from lightning.fabric import Fabric class FabricPyTorchDistributed(L.LightningWork): def run(self): # 1. Prepare the model model = torch.nn.Sequential( torch.nn.Linear(1, 1), torch.nn.R...
1,245
28.666667
92
py
lightning
lightning-master/examples/app/multi_node/pl_boring_script.py
import lightning as L from lightning.pytorch.demos.boring_classes import BoringModel if __name__ == "__main__": model = BoringModel() trainer = L.Trainer(max_epochs=1) trainer.fit(model)
200
24.125
62
py
lightning
lightning-master/examples/app/multi_node/train_pytorch_spawn.py
import torch from torch.nn.parallel.distributed import DistributedDataParallel import lightning as L from lightning.app.components import PyTorchSpawnMultiNode class PyTorchDistributed(L.LightningWork): def run( self, world_size: int, node_rank: int, global_rank: str, loca...
1,574
28.716981
105
py
lightning
lightning-master/examples/app/multi_node/train_pytorch.py
# app.py # ! pip install torch import torch from torch.nn.parallel.distributed import DistributedDataParallel import lightning as L from lightning.app.components import MultiNode def distributed_train(local_rank: int, main_address: str, main_port: int, num_nodes: int, node_rank: int, nprocs: int): # 1. SET UP DI...
2,358
37.048387
119
py
lightning
lightning-master/examples/app/hpo/objective.py
import os import tempfile from datetime import datetime from typing import Optional import pandas as pd import torch from optuna.distributions import CategoricalDistribution, LogUniformDistribution from torchmetrics import Accuracy import lightning as L from lightning.app.components import TracerPythonScript class ...
2,135
32.375
97
py
lightning
lightning-master/examples/app/hpo/pl_script.py
import argparse import os import pandas as pd import torch from flash import Trainer from flash.image import ImageClassificationData, ImageClassifier # Parse arguments provided by the Work. parser = argparse.ArgumentParser() parser.add_argument("--train_data_path", type=str, required=True) parser.add_argument("--subm...
1,396
30.75
103
py
lightning
lightning-master/examples/data/image/imagenet.py
import os import traceback from argparse import ArgumentParser from typing import Callable, Literal, Optional import torch import torch.nn.functional as F import torch.optim as optim import torch.optim.lr_scheduler as lr_scheduler import lightning as L from lightning.pytorch.utilities.model_helpers import get_torchvi...
5,970
30.26178
118
py
lightning
lightning-master/examples/pytorch/hpu/mnist_sample.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,365
30.972973
90
py
lightning
lightning-master/examples/pytorch/bug_report/bug_report_model.py
import os import torch from torch.utils.data import DataLoader, Dataset from lightning.pytorch import LightningModule, Trainer class RandomDataset(Dataset): def __init__(self, size, length): self.len = length self.data = torch.randn(length, size) def __getitem__(self, index): return...
1,701
24.402985
78
py
lightning
lightning-master/examples/pytorch/domain_templates/computer_vision_fine_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...
10,389
35.202091
117
py
lightning
lightning-master/examples/pytorch/domain_templates/reinforce_learn_Qnet.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,250
32.462121
116
py
lightning
lightning-master/examples/pytorch/domain_templates/reinforce_learn_ppo.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,054
36.401316
119
py
lightning
lightning-master/examples/pytorch/domain_templates/generative_adversarial_net.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,409
30.666667
115
py
lightning
lightning-master/examples/pytorch/domain_templates/semantic_segmentation.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,354
34.27027
117
py
lightning
lightning-master/examples/pytorch/domain_templates/imagenet.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,342
36.464286
119
py
lightning
lightning-master/examples/pytorch/basics/transformer.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 class LanguageModel(L.LightningModule): def __init__(self, vocab_size): super().__init__() self.model = Transformer(v...
1,913
29.380952
92
py
lightning
lightning-master/examples/pytorch/basics/autoencoder.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,129
35.943005
120
py
lightning
lightning-master/examples/pytorch/basics/profiler_example.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,249
36.280702
120
py
lightning
lightning-master/examples/pytorch/basics/backbone_image_classifier.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,511
31.695652
116
py
lightning
lightning-master/examples/pytorch/servable_module/production.py
import base64 from dataclasses import dataclass from io import BytesIO from os import path from typing import Dict, Optional import numpy as np import torch import torchvision import torchvision.transforms as T from PIL import Image as PILImage from lightning.pytorch import cli_lightning_logo, LightningDataModule, Li...
4,218
32.752
120
py
lightning
lightning-master/examples/pytorch/ipu/mnist_sample.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,944
33.647059
90
py
lightning
lightning-master/.actions/assistant.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,396
39.835789
120
py
lightning
lightning-master/src/pytorch_lightning/__setup__.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, Dict from pkg_resources import parse_requirements from setuptools import find_packages _PROJECT_ROOT = "." _SOURCE_ROOT = os.path.join(_PROJECT_...
5,021
42.669565
116
py
lightning
lightning-master/src/pytorch_lightning/__about__.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,171
36.448276
108
py
lightning
lightning-master/src/lightning_fabric/__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 pkg_resources import parse_requirements from setuptools import find_packages _PROJECT_ROOT = "." _SOURCE_ROOT = os.path.join(_PROJECT_ROOT,...
4,717
42.685185
105
py
lightning
lightning-master/src/lightning_fabric/__about__.py
import time __author__ = "Lightning AI et al." __author_email__ = "pytorch@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__ =...
477
22.9
74
py
lightning
lightning-master/src/lightning/__setup__.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, Dict from setuptools import find_packages _PROJECT_ROOT = "." _SOURCE_ROOT = os.path.join(_PROJECT_ROOT, "src") _PACKAGE_ROOT = os.path.join(_SO...
5,993
46.571429
117
py
lightning
lightning-master/src/lightning/__init__.py
"""Root package info.""" import logging import os # 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...
1,952
33.875
88
py
lightning
lightning-master/src/lightning/__about__.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,285
30.365854
95
py
lightning
lightning-master/src/lightning/fabric/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...
27,490
47.742908
120
py
lightning
lightning-master/src/lightning/fabric/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...
46,853
46.471125
120
py
lightning
lightning-master/src/lightning/fabric/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,014
34.790816
116
py
lightning
lightning-master/src/lightning/fabric/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...
13,203
42.721854
117
py
lightning
lightning-master/src/lightning/fabric/__init__.py
"""Root package info.""" import logging import os from lightning_utilities.core.imports import package_available if os.path.isfile(os.path.join(os.path.dirname(__file__), "__about__.py")): from lightning.fabric.__about__ import * # noqa: F401, F403 if os.path.isfile(os.path.join(os.path.dirname(__file__), "__ver...
1,474
35.875
111
py
lightning
lightning-master/src/lightning/fabric/strategies/single_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,408
35.5
89
py
lightning
lightning-master/src/lightning/fabric/strategies/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,972
37.95098
114
py
lightning
lightning-master/src/lightning/fabric/strategies/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...
17,853
38.941834
119
py
lightning
lightning-master/src/lightning/fabric/strategies/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...
40,930
45.093468
120
py
lightning
lightning-master/src/lightning/fabric/strategies/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...
2,781
33.345679
108
py
lightning
lightning-master/src/lightning/fabric/strategies/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...
41,232
44.865406
120
py
lightning
lightning-master/src/lightning/fabric/strategies/parallel.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,430
40.027778
115
py
lightning
lightning-master/src/lightning/fabric/strategies/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...
10,089
38.881423
119
py
lightning
lightning-master/src/lightning/fabric/strategies/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...
9,568
42.103604
116
py
lightning
lightning-master/src/lightning/fabric/strategies/launchers/subprocess_script.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,851
41.825
120
py
lightning
lightning-master/src/lightning/fabric/strategies/launchers/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...
8,044
41.342105
120
py
lightning
lightning-master/src/lightning/fabric/strategies/launchers/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...
5,097
39.460317
119
py
lightning
lightning-master/src/lightning/fabric/plugins/__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,694
40.341463
88
py
lightning
lightning-master/src/lightning/fabric/plugins/io/checkpoint_io.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,584
36.463768
118
py
lightning
lightning-master/src/lightning/fabric/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...
843
43.421053
74
py
lightning
lightning-master/src/lightning/fabric/plugins/io/torch_io.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,183
40.425743
118
py
lightning
lightning-master/src/lightning/fabric/plugins/io/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,861
41.716418
118
py
lightning
lightning-master/src/lightning/fabric/plugins/precision/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...
5,347
37.2
119
py
lightning
lightning-master/src/lightning/fabric/plugins/precision/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...
810
35.863636
84
py
lightning
lightning-master/src/lightning/fabric/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...
3,564
36.526316
119
py
lightning
lightning-master/src/lightning/fabric/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...
7,300
41.695906
120
py
lightning
lightning-master/src/lightning/fabric/plugins/precision/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...
5,284
41.96748
120
py
lightning
lightning-master/src/lightning/fabric/plugins/precision/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,736
38.1
119
py
lightning
lightning-master/src/lightning/fabric/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,512
35.02381
119
py
lightning
lightning-master/src/lightning/fabric/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...
2,301
36.737705
119
py
lightning
lightning-master/src/lightning/fabric/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...
1,406
36.026316
117
py
lightning
lightning-master/src/lightning/fabric/plugins/collectives/collective.py
from abc import ABC, abstractmethod from typing import Any, List, Optional from torch import Tensor from typing_extensions import Self from lightning.fabric.utilities.types import CollectibleGroup class Collective(ABC): """Interface for collective operations. Supports communications between multiple proces...
3,650
26.044444
116
py
lightning
lightning-master/src/lightning/fabric/plugins/collectives/torch_collective.py
import datetime import os from typing import Any, List, Optional, Union import torch import torch.distributed as dist from torch import Tensor from typing_extensions import Self from lightning.fabric.plugins.collectives.collective import Collective from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_1...
8,405
40.820896
118
py
lightning
lightning-master/src/lightning/fabric/plugins/collectives/single_device.py
from typing import Any, List from torch import Tensor from lightning.fabric.plugins.collectives.collective import Collective from lightning.fabric.utilities.types import CollectibleGroup class SingleDeviceCollective(Collective): """Support for collective operations on a single device (no-op). .. warning:: ...
2,315
25.62069
116
py
lightning
lightning-master/src/lightning/fabric/plugins/collectives/__init__.py
from lightning.fabric.plugins.collectives.collective import Collective from lightning.fabric.plugins.collectives.single_device import SingleDeviceCollective from lightning.fabric.plugins.collectives.torch_collective import TorchCollective __all__ = [ "Collective", "TorchCollective", "SingleDeviceCollective...
325
31.6
85
py
lightning
lightning-master/src/lightning/fabric/plugins/environments/kubeflow.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,402
34.338235
117
py
lightning
lightning-master/src/lightning/fabric/plugins/environments/lsf.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,574
39.945946
119
py
lightning
lightning-master/src/lightning/fabric/plugins/environments/lightning.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,662
34.911765
119
py
lightning
lightning-master/src/lightning/fabric/plugins/environments/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,779
36.066667
119
py
lightning
lightning-master/src/lightning/fabric/plugins/environments/__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,309
58.545455
102
py
lightning
lightning-master/src/lightning/fabric/plugins/environments/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,767
32.349398
113
py
lightning
lightning-master/src/lightning/fabric/utilities/device_dtype_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...
4,119
35.785714
114
py
lightning
lightning-master/src/lightning/fabric/utilities/seed.py
import logging import os import random from random import getstate as python_get_rng_state from random import setstate as python_set_rng_state from typing import Any, Dict, Optional import numpy as np import torch from lightning.fabric.utilities.rank_zero import _get_rank, rank_prefixed_message, rank_zero_only, rank_...
5,500
41.643411
119
py
lightning
lightning-master/src/lightning/fabric/utilities/cloud_io.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,616
34.849315
113
py
lightning
lightning-master/src/lightning/fabric/utilities/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,757
32.272727
114
py
lightning
lightning-master/src/lightning/fabric/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...
20,349
45.674312
120
py
lightning
lightning-master/src/lightning/fabric/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,844
28.128788
114
py
lightning
lightning-master/src/lightning/fabric/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,923
33.357143
94
py
lightning
lightning-master/src/lightning/fabric/utilities/distributed.py
import logging import os import sys from contextlib import nullcontext from typing import Any, Iterable, Iterator, List, Optional, Sized, Tuple, Union import torch import torch.nn.functional as F from lightning_utilities.core.imports import package_available from torch import Tensor from torch.utils.data import Datase...
12,735
39.820513
120
py
lightning
lightning-master/src/lightning/fabric/utilities/device_parser.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,239
35.38191
115
py
lightning
lightning-master/src/lightning/fabric/utilities/spike.py
import json import operator import os import warnings from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union import torch from lightning_utilities.core.imports import compare_version from lightning.fabric.utilities.types import _PATH if TYPE_CHECKING: from lightning.fabric.fabric import Fabr...
7,644
41.709497
115
py
lightning
lightning-master/src/lightning/fabric/utilities/optimizer.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,382
38.514286
107
py
lightning
lightning-master/src/lightning/fabric/utilities/apply_func.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,635
35.793651
119
py
lightning
lightning-master/src/lightning/fabric/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,619
44
96
py
lightning
lightning-master/src/lightning/fabric/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...
5,153
38.646154
116
py
lightning
lightning-master/src/lightning/fabric/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...
12,913
39.996825
120
py
lightning
lightning-master/src/lightning/fabric/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,500
32.589552
115
py
lightning
lightning-master/src/lightning/fabric/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...
7,827
33.484581
120
py
lightning
lightning-master/src/lightning/fabric/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...
2,973
33.581395
120
py
lightning
lightning-master/src/lightning/fabric/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...
14,090
37.395095
120
py
lightning
lightning-master/src/lightning/fabric/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,882
29.868852
111
py
lightning
lightning-master/src/lightning/fabric/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...
2,778
30.579545
94
py
lightning
lightning-master/src/lightning/fabric/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...
6,349
38.197531
117
py
lightning
lightning-master/src/lightning/app/cli/cmd_pl_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...
6,726
34.781915
117
py
lightning
lightning-master/src/lightning/app/cli/pl-app-template/core/callbacks.py
import inspect from typing import Any, Dict, TYPE_CHECKING, Union from core.state import ProgressBarState, TrainerState import lightning.pytorch as pl from lightning.app.storage import Path from lightning.app.utilities.app_helpers import Logger from lightning.pytorch import Callback from lightning.pytorch.callbacks.p...
12,991
39.855346
117
py