Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Lightning-AI/lit-llama
/ functions
Functions
276 in github.com/Lightning-AI/lit-llama
⨍
Functions
276
◇
Types & classes
39
↳
Endpoints
1
Function
download_from_hub
(repo_id: Optional[str] = None, local_dir: str = "checkpoints/hf-llama/7B")
scripts/download.py:24
Method
filenames
(self)
lit_llama/packed_dataset.py:121
Method
find_class
(self, module, name)
lit_llama/utils.py:307
Method
forward
( self, x: torch.Tensor, rope: RoPECache, mask: torch.Tensor, max_seq_
lit_llama/adapter.py:88
Method
forward
( self, x: torch.Tensor, rope: RoPECache, mask: torch.Tensor, max_seq_
lit_llama/adapter.py:204
Method
forward
( self, idx: torch.Tensor, max_seq_length: Optional[int] = None, input_pos: Optional[torch.Tensor] = N
lit_llama/adapter.py:254
Method
forward
(self, inp)
lit_llama/quantization.py:413
Method
forward
Do the forward pass. If LoRA's weights are merged with pretrained ones then it's a simple matrix multiplication. If not, then multipl
lit_llama/lora.py:282
Method
forward
( self, idx: torch.Tensor, max_seq_length: Optional[int] = None, input_pos: Optional[torch.Tensor] = N
lit_llama/model.py:76
Method
forward
( self, x: torch.Tensor, rope: RoPECache, mask: MaskCache, max_seq_len
lit_llama/model.py:156
Method
forward
( self, x: torch.Tensor, rope: RoPECache, mask: MaskCache, max_seq_len
lit_llama/model.py:185
Method
forward
(self, x: torch.Tensor)
lit_llama/model.py:251
Method
forward
(self, x: torch.Tensor)
lit_llama/model.py:270
Method
from_name
(cls, name: str)
lit_llama/adapter.py:247
Method
from_name
(cls, name: str)
lit_llama/model.py:39
Function
linear_kernel_4bit_weight
Kernel for computing the matmul C = A x B.T. A has shape (M, K), B has shape (N, K) and C has shape (M, N)
lit_llama/quantization.py:188
Function
lit_llama
()
tests/conftest.py:38
Function
main
Generates text samples based on a pre-trained LLaMA model and tokenizer. Args: prompt: The prompt string to use for generating the sample
generate.py:94
Function
main
Generates text samples based on a pre-trained LLaMA model and tokenizer. Args: datasets: The datasets to use as a comma separated string
evaluate/adapter.py:53
Function
main
Generates text samples based on a pre-trained LLaMA model and tokenizer. Args: datasets: The datasets to use as a comma separated string
evaluate/full.py:48
Function
main
Generates text samples based on a pre-trained LLaMA model and tokenizer finetuned with LoRA. Args: datasets: The datasets to use a
evaluate/lora.py:55
Function
main
Generates text samples based on a pre-trained LLaMA model and tokenizer. Args: datasets: The datasets to use as a comma separated string
evaluate/adapter_v2.py:52
Function
main
Generates text samples based on a pre-trained LLaMA model and tokenizer. Args: checkpoint_path: The checkpoint path to load. outp
quantize/gptq.py:153
Function
main
Merges lora weights to base model. Args: accelerator: The hardware to run on. Possible choices are: ``"cpu"``, ``"cuda"``, ``
scripts/convert_lora_weights.py:35
Function
main
( data_dir: str = "data/alpaca", pretrained_path: str = "checkpoints/lit-llama/7B/lit-llama.pth",
finetune/adapter.py:67
Function
main
( data_dir: str = "data/alpaca", pretrained_path: str = "checkpoints/lit-llama/7B/lit-llama.pth",
finetune/full.py:55
Function
main
( data_dir: str = "data/alpaca", pretrained_path: str = "checkpoints/lit-llama/7B/lit-llama.pth",
finetune/lora.py:53
Function
main
( data_dir: str = "data/alpaca", pretrained_path: str = "checkpoints/lit-llama/7B/lit-llama.pth",
finetune/adapter_v2.py:71
Function
main
( devices: int = 4, train_data_dir: Path = "data/lit-redpajama", val_data_dir: Optional[Path] = No
pretrain/redpajama.py:65
Function
main
Generates a response based on a given instruction and an optional input_sentence. This script will only work with checkpoints from the instruction
generate/adapter.py:23
Function
main
Generates text samples based on a pre-trained LLaMA model and tokenizer. Args: prompt: The prompt string to use for generating the sample
generate/full.py:22
Function
main
Generates a response based on a given instruction and an optional input_sentence. This script will only work with checkpoints from the instruction
generate/lora.py:27
Function
main
Generates a response based on a given instruction and an optional input_sentence. This script will only work with checkpoints from the instruction
generate/adapter_v2.py:24
Function
meta_weights_for_nano_model
( *, output_dir: Path = Path("checkpoints/lit-llama"), checkpoint_dir: Path = Path("checkpoints/ll
scripts/convert_checkpoint.py:68
Function
multinomial
(*args, **kwargs)
tests/test_generate.py:42
Function
orig_llama
()
tests/conftest.py:12
Function
orig_llama_adapter
()
tests/conftest.py:25
Method
persistent_id
(self, obj)
lit_llama/utils.py:411
Method
persistent_load
(self, pid)
lit_llama/utils.py:323
Function
prepare
Prepare any dataset for finetuning (akin to Shakespheare full tuning). The output is a training and validation dataset saved as `train.pt` and `v
scripts/prepare_any_text.py:24
Function
prepare
Prepare the "Red Pajama" dataset. We assume tokenizer has been trained (i.e. we reuse LLaMA's tokenizer model).
scripts/prepare_redpajama.py:153
Function
prepare
Prepare the Dolly dataset for instruction tuning. The output is a training and validation dataset saved as `train.pt` and `val.pt`, which
scripts/prepare_dolly.py:24
Function
prepare
Prepare the Alpaca dataset for instruction tuning. The output is a training and validation dataset saved as `train.pt` and `val.pt`, whic
scripts/prepare_alpaca.py:24
Function
prepare
Prepare the "Tiny Shakespeare" dataset.
scripts/prepare_shakespeare.py:35
Method
rebuild_from_type_v2
(cls, func, new_type, args, state, *, archiveinfo=None)
lit_llama/utils.py:176
Method
rebuild_parameter
( cls, data, requires_grad, backward_hooks, *, archiveinfo=None )
lit_llama/utils.py:192
Method
rebuild_tensor_v2
( cls, storage, storage_offset, size, stride, requires_grad,
lit_llama/utils.py:207
Method
reset_cache
(self)
lit_llama/adapter.py:250
Function
test_adapter_load_gating_factor
Tests backward-compatible loading of checkpoints after the `gating_factor` was extended per-head in PR #297.
tests/test_adapter.py:29
Function
test_adapter_parity
Test parity between our implementation of LLaMA-Adapter and the reference code.
tests/test_model.py:162
Function
test_bfloat16_llama_init
(lit_llama, orig_llama)
tests/test_model.py:107
Function
test_cli
()
tests/test_prepare_redpajama.py:140
Function
test_cli
()
tests/test_prepare_shakespeare.py:21
Function
test_cli
()
tests/test_generate.py:115
Function
test_combined_dataset
(tmp_path)
tests/test_packed_dataset.py:147
Function
test_config_identical
(model_size, lit_llama)
tests/test_adapter.py:11
Function
test_config_identical
(model_size, lit_llama)
tests/test_adapter_v2.py:9
Function
test_find_multiple
(lit_llama)
tests/test_utils.py:69
Function
test_generate
()
tests/test_generate.py:26
Function
test_incremental_write
(tmp_path, lit_llama)
tests/test_utils.py:52
Function
test_lazy_load_basic
(lit_llama)
tests/test_utils.py:13
Function
test_lazy_load_subclass
(lit_llama)
tests/test_utils.py:32
Function
test_lora_layer_replacement
(lit_llama)
tests/test_lora.py:6
Function
test_lora_merge_unmerge
(lit_llama)
tests/test_lora.py:24
Function
test_main
(tmp_path, monkeypatch)
tests/test_generate.py:58
Function
test_model_compile
(lit_llama)
tests/test_model.py:219
Function
test_packed_dataset
(tmp_path)
tests/test_packed_dataset.py:30
Function
test_prepare
(tmp_path)
tests/test_prepare_shakespeare.py:11
Function
test_prepare_full
(tmp_path)
tests/test_prepare_redpajama.py:78
Function
test_prepare_sample
(tmp_path)
tests/test_prepare_redpajama.py:32
Function
test_rmsnorm
(lit_llama, orig_llama)
tests/test_rmsnorm.py:7
Function
test_rope
(lit_llama, orig_llama)
tests/test_rope.py:7
Function
test_sharded_packed_dataset
(monkeypatch)
tests/test_packed_dataset.py:174
Function
test_to_orig_llama
(lit_llama, orig_llama, kv_cache)
tests/test_model.py:39
Method
train
(input: str, destination: str, vocab_size=32000)
lit_llama/tokenizer.py:49
Method
vocab_size
(self)
lit_llama/tokenizer.py:21
← previous
201–276 of 276, ranked by callers