Skip to content

Commit

Permalink
Add license at the top of files (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
lantiga authored Aug 15, 2024
1 parent da71ade commit a55c9b1
Show file tree
Hide file tree
Showing 47 changed files with 94 additions and 0 deletions.
2 changes: 2 additions & 0 deletions evaluate/adapter.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions evaluate/adapter_v2.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions evaluate/full.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions evaluate/lora.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions finetune/adapter.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions finetune/adapter_v2.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions finetune/full.py
Original file line number Diff line number Diff line change
@@ -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).
Expand Down
2 changes: 2 additions & 0 deletions finetune/lora.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 2 additions & 0 deletions generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import sys
import time
import warnings
Expand Down
2 changes: 2 additions & 0 deletions generate/adapter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import sys
import time
import warnings
Expand Down
2 changes: 2 additions & 0 deletions generate/adapter_v2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import sys
import time
import warnings
Expand Down
2 changes: 2 additions & 0 deletions generate/full.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import sys
import time
import warnings
Expand Down
2 changes: 2 additions & 0 deletions generate/lora.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import sys
import time
import warnings
Expand Down
2 changes: 2 additions & 0 deletions lit_llama/__init__.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions lit_llama/adapter.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions lit_llama/adapter_v2.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions lit_llama/lora.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 2 additions & 0 deletions lit_llama/model.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 2 additions & 0 deletions lit_llama/packed_dataset.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 2 additions & 0 deletions lit_llama/quantization.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions lit_llama/tokenizer.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions lit_llama/utils.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions pretrain/redpajama.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import os
import sys
import math
Expand Down
2 changes: 2 additions & 0 deletions pretrain/shakespeare.py
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 2 additions & 0 deletions quantize/gptq.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/convert_checkpoint.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/convert_hf_checkpoint.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import collections
import contextlib
import gc
Expand Down
2 changes: 2 additions & 0 deletions scripts/convert_lora_weights.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/download.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/prepare_alpaca.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/prepare_any_text.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/prepare_dolly.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions scripts/prepare_redpajama.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import json
import glob
import os
Expand Down
2 changes: 2 additions & 0 deletions scripts/prepare_shakespeare.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

# MIT License

# Copyright (c) 2022 Andrej Karpathy
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import sys
from pathlib import Path

Expand Down
2 changes: 2 additions & 0 deletions tests/test_adapter.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/test_adapter_v2.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import pytest
import sys

Expand Down
2 changes: 2 additions & 0 deletions tests/test_generate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import functools
import subprocess
import sys
Expand Down
2 changes: 2 additions & 0 deletions tests/test_lora.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import torch


Expand Down
2 changes: 2 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import torch
import pytest
import sys
Expand Down
2 changes: 2 additions & 0 deletions tests/test_packed_dataset.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/test_prepare_redpajama.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import json
import os
import subprocess
Expand Down
2 changes: 2 additions & 0 deletions tests/test_prepare_shakespeare.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import os
import subprocess
import sys
Expand Down
2 changes: 2 additions & 0 deletions tests/test_rmsnorm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import torch


Expand Down
2 changes: 2 additions & 0 deletions tests/test_rope.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import torch


Expand Down
2 changes: 2 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Copyright Lightning AI. Licensed under the Apache License 2.0, see LICENSE file.

import tempfile
import pathlib

Expand Down

0 comments on commit a55c9b1

Please sign in to comment.