diff --git a/evaluate/adapter.py b/evaluate/adapter.py index 9aa37827..0b985404 100644 --- a/evaluate/adapter.py +++ b/evaluate/adapter.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + # This mimics GPTQ's evaluation metrics: https://github.com/IST-DASLab/gptq/ # Thanks to E. Frantar et al GPTQ: Accurate Post-training Compression for GPT, arXiv:2210.17323 import math diff --git a/evaluate/adapter_v2.py b/evaluate/adapter_v2.py index c1337a77..ef5322c7 100644 --- a/evaluate/adapter_v2.py +++ b/evaluate/adapter_v2.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + # This mimics GPTQ's evaluation metrics: https://github.com/IST-DASLab/gptq/ # Thanks to E. Frantar et al GPTQ: Accurate Post-training Compression for GPT, arXiv:2210.17323 import math diff --git a/evaluate/full.py b/evaluate/full.py index 48d5fb89..71e0f2c2 100644 --- a/evaluate/full.py +++ b/evaluate/full.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + # This mimics GPTQ's evaluation metrics: https://github.com/IST-DASLab/gptq/ # Thanks to E. Frantar et al GPTQ: Accurate Post-training Compression for GPT, arXiv:2210.17323 import math diff --git a/evaluate/lora.py b/evaluate/lora.py index 9c2192b3..10a936e6 100644 --- a/evaluate/lora.py +++ b/evaluate/lora.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + # This mimics GPTQ's evaluation metrics: https://github.com/IST-DASLab/gptq/ # Thanks to E. Frantar et al GPTQ: Accurate Post-training Compression for GPT, arXiv:2210.17323 import math diff --git a/finetune/adapter.py b/finetune/adapter.py index fc815830..1d3a476b 100644 --- a/finetune/adapter.py +++ b/finetune/adapter.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """ Instruction-tuning with LLaMA-Adapter on the Alpaca dataset following the paper diff --git a/finetune/adapter_v2.py b/finetune/adapter_v2.py index c686cd15..baa0f882 100644 --- a/finetune/adapter_v2.py +++ b/finetune/adapter_v2.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """ Instruction-tuning with LLaMA-Adapter v2 on the Alpaca dataset following the paper diff --git a/finetune/full.py b/finetune/full.py index 9248e8de..999260be 100644 --- a/finetune/full.py +++ b/finetune/full.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """ Instruction-tuning on the Alpaca dataset using a regular finetuning procedure (updating all layers). diff --git a/finetune/lora.py b/finetune/lora.py index 18737015..40a8862b 100644 --- a/finetune/lora.py +++ b/finetune/lora.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """ Instruction-tuning with LoRA on the Alpaca dataset. diff --git a/generate.py b/generate.py index 91a7a6e4..f9322bda 100644 --- a/generate.py +++ b/generate.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import sys import time import warnings diff --git a/generate/adapter.py b/generate/adapter.py index 1fe8af4d..002a017c 100644 --- a/generate/adapter.py +++ b/generate/adapter.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import sys import time import warnings diff --git a/generate/adapter_v2.py b/generate/adapter_v2.py index d32db7c0..39281b9b 100644 --- a/generate/adapter_v2.py +++ b/generate/adapter_v2.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import sys import time import warnings diff --git a/generate/full.py b/generate/full.py index 443a75e3..779342cd 100644 --- a/generate/full.py +++ b/generate/full.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import sys import time import warnings diff --git a/generate/lora.py b/generate/lora.py index 38a3cf63..74623704 100644 --- a/generate/lora.py +++ b/generate/lora.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import sys import time import warnings diff --git a/lit_llama/__init__.py b/lit_llama/__init__.py index c169d4c6..02750574 100644 --- a/lit_llama/__init__.py +++ b/lit_llama/__init__.py @@ -1,2 +1,4 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + from lit_llama.model import LLaMAConfig, LLaMA, RMSNorm, build_rope_cache, apply_rope from lit_llama.tokenizer import Tokenizer diff --git a/lit_llama/adapter.py b/lit_llama/adapter.py index f57ee970..3b8839db 100644 --- a/lit_llama/adapter.py +++ b/lit_llama/adapter.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """Implementation of the paper: LLaMA-Adapter: Efficient Fine-tuning of Language Models with Zero-init Attention diff --git a/lit_llama/adapter_v2.py b/lit_llama/adapter_v2.py index 368e695f..228496de 100644 --- a/lit_llama/adapter_v2.py +++ b/lit_llama/adapter_v2.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import torch from torch import Tensor import torch.nn as nn diff --git a/lit_llama/lora.py b/lit_llama/lora.py index 0f644e2d..d79db9cb 100644 --- a/lit_llama/lora.py +++ b/lit_llama/lora.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + # Derived from https://github.com/microsoft/LoRA # ------------------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. diff --git a/lit_llama/model.py b/lit_llama/model.py index 4d0637ec..1aaafa39 100644 --- a/lit_llama/model.py +++ b/lit_llama/model.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """Full definition of a LLaMA Language Model, all of it in this single file. Based on the nanoGPT implementation: https://github.com/karpathy/nanoGPT. diff --git a/lit_llama/packed_dataset.py b/lit_llama/packed_dataset.py index bb9f946e..d492b4e0 100644 --- a/lit_llama/packed_dataset.py +++ b/lit_llama/packed_dataset.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + # Very loosely inspired by indexed_dataset in Fairseq, Megatron # https://github.com/NVIDIA/Megatron-LM/blob/main/megatron/data/indexed_dataset.py diff --git a/lit_llama/quantization.py b/lit_llama/quantization.py index 3a6ff5fe..74461a80 100644 --- a/lit_llama/quantization.py +++ b/lit_llama/quantization.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import os from contextlib import contextmanager import warnings diff --git a/lit_llama/tokenizer.py b/lit_llama/tokenizer.py index fb681e3f..3b7aece9 100644 --- a/lit_llama/tokenizer.py +++ b/lit_llama/tokenizer.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import os from pathlib import Path from typing import Optional diff --git a/lit_llama/utils.py b/lit_llama/utils.py index a09ada20..f13223fc 100644 --- a/lit_llama/utils.py +++ b/lit_llama/utils.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """Utility functions for training and inference.""" import functools diff --git a/pretrain/redpajama.py b/pretrain/redpajama.py index 97ebde28..de21298b 100644 --- a/pretrain/redpajama.py +++ b/pretrain/redpajama.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import os import sys import math diff --git a/pretrain/shakespeare.py b/pretrain/shakespeare.py index 9daa064c..cb83fee6 100644 --- a/pretrain/shakespeare.py +++ b/pretrain/shakespeare.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """ This script is a placeholder for training LLaMA from scratch. Currently, it just trains on the Shakespeare dataset. diff --git a/quantize/gptq.py b/quantize/gptq.py index 3d646ff0..88d7d5c9 100644 --- a/quantize/gptq.py +++ b/quantize/gptq.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + # This adapts GPTQ's quantization process: https://github.com/IST-DASLab/gptq/ # E. Frantar et al GPTQ: Accurate Post-training Compression for GPT, arXiv:2210.17323 # portions copyright by the authors licensed under the Apache License 2.0 diff --git a/scripts/convert_checkpoint.py b/scripts/convert_checkpoint.py index a7cd157f..f4c296a9 100644 --- a/scripts/convert_checkpoint.py +++ b/scripts/convert_checkpoint.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import gc import shutil from pathlib import Path diff --git a/scripts/convert_hf_checkpoint.py b/scripts/convert_hf_checkpoint.py index 5b262e5e..e5fbe7e1 100644 --- a/scripts/convert_hf_checkpoint.py +++ b/scripts/convert_hf_checkpoint.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import collections import contextlib import gc diff --git a/scripts/convert_lora_weights.py b/scripts/convert_lora_weights.py index ad6071e8..7e8c7016 100644 --- a/scripts/convert_lora_weights.py +++ b/scripts/convert_lora_weights.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import sys import time from pathlib import Path diff --git a/scripts/download.py b/scripts/download.py index bd9eb9e3..67171fca 100644 --- a/scripts/download.py +++ b/scripts/download.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import os from typing import Optional from urllib.request import urlretrieve diff --git a/scripts/prepare_alpaca.py b/scripts/prepare_alpaca.py index bc7f78f1..a61fcc58 100644 --- a/scripts/prepare_alpaca.py +++ b/scripts/prepare_alpaca.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """Implementation derived from https://github.com/tloen/alpaca-lora""" import sys from pathlib import Path diff --git a/scripts/prepare_any_text.py b/scripts/prepare_any_text.py index 9377da6a..7546e094 100644 --- a/scripts/prepare_any_text.py +++ b/scripts/prepare_any_text.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """Implementation derived from https://github.com/tloen/alpaca-lora""" import sys from pathlib import Path diff --git a/scripts/prepare_dolly.py b/scripts/prepare_dolly.py index a40fa8dd..61ec49e6 100644 --- a/scripts/prepare_dolly.py +++ b/scripts/prepare_dolly.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + """Implementation derived from https://github.com/tloen/alpaca-lora""" import sys from pathlib import Path diff --git a/scripts/prepare_redpajama.py b/scripts/prepare_redpajama.py index 8da1c1b4..30f40d9c 100644 --- a/scripts/prepare_redpajama.py +++ b/scripts/prepare_redpajama.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import json import glob import os diff --git a/scripts/prepare_shakespeare.py b/scripts/prepare_shakespeare.py index 01a4079e..95cdd1b3 100644 --- a/scripts/prepare_shakespeare.py +++ b/scripts/prepare_shakespeare.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + # MIT License # Copyright (c) 2022 Andrej Karpathy diff --git a/setup.py b/setup.py index 94f72363..633eb01c 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import os from setuptools import setup, find_packages diff --git a/tests/conftest.py b/tests/conftest.py index ab19c77e..e93ed255 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import sys from pathlib import Path diff --git a/tests/test_adapter.py b/tests/test_adapter.py index f61c6766..38a95610 100644 --- a/tests/test_adapter.py +++ b/tests/test_adapter.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + from dataclasses import asdict import pytest import sys diff --git a/tests/test_adapter_v2.py b/tests/test_adapter_v2.py index 2a594a73..0d2c4694 100644 --- a/tests/test_adapter_v2.py +++ b/tests/test_adapter_v2.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import pytest import sys diff --git a/tests/test_generate.py b/tests/test_generate.py index ecbd6afd..40d4d511 100644 --- a/tests/test_generate.py +++ b/tests/test_generate.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import functools import subprocess import sys diff --git a/tests/test_lora.py b/tests/test_lora.py index 2d9e3e80..5f621847 100644 --- a/tests/test_lora.py +++ b/tests/test_lora.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import torch diff --git a/tests/test_model.py b/tests/test_model.py index 3abc4843..22ad6e6e 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import torch import pytest import sys diff --git a/tests/test_packed_dataset.py b/tests/test_packed_dataset.py index 3b91fb4a..0a681e6e 100644 --- a/tests/test_packed_dataset.py +++ b/tests/test_packed_dataset.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import os from unittest.mock import MagicMock import requests diff --git a/tests/test_prepare_redpajama.py b/tests/test_prepare_redpajama.py index a3e68a15..7eb97760 100644 --- a/tests/test_prepare_redpajama.py +++ b/tests/test_prepare_redpajama.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import json import os import subprocess diff --git a/tests/test_prepare_shakespeare.py b/tests/test_prepare_shakespeare.py index ef6a80aa..925e2dbb 100644 --- a/tests/test_prepare_shakespeare.py +++ b/tests/test_prepare_shakespeare.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import os import subprocess import sys diff --git a/tests/test_rmsnorm.py b/tests/test_rmsnorm.py index e88dc859..0ee9b1e3 100644 --- a/tests/test_rmsnorm.py +++ b/tests/test_rmsnorm.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import torch diff --git a/tests/test_rope.py b/tests/test_rope.py index 37e993ab..a7ee6222 100644 --- a/tests/test_rope.py +++ b/tests/test_rope.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import torch diff --git a/tests/test_utils.py b/tests/test_utils.py index 97101b12..4f0fdfae 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,3 +1,5 @@ +# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file. + import tempfile import pathlib