MCPcopy Create free account

hub / github.com/Lightning-AI/lit-llama / functions

Functions276 in github.com/Lightning-AI/lit-llama

↓ 26 callersMethodencode
( self, string: str, bos: bool = True, eos: bool = False, max_length:
lit_llama/tokenizer.py:24
↓ 23 callersMethodsave
(self, obj)
lit_llama/utils.py:475
↓ 22 callersMethodfrom_name
(cls, name: str)
lit_llama/model.py:125
↓ 16 callersMethoddecode
(self, tokens: torch.Tensor)
lit_llama/tokenizer.py:45
↓ 15 callersMethodtrain
Set the module into train or eval mode if `mode` is True of False respectively. For train mode (train(True)) if weights are merged we need to
lit_llama/lora.py:243
↓ 12 callersFunction_check_python_packages
()
lit_llama/utils.py:504
↓ 12 callersFunctiongenerate_prompt
Generates a standardized message to prompt the model with an instruction, optional input and a 'response' field.
scripts/prepare_alpaca.py:113
↓ 9 callersFunctiongenerate
Takes a conditioning sequence (prompt) as input and continues to generate as many tokens as requested. The implementation of this function is mod
generate.py:21
↓ 9 callersFunctionllama_model_lookup
Returns the LLaMA model name from the checkpoint. Checks the width of the lm_head.weight matrix, as these uniquely identify the model.
lit_llama/utils.py:29
↓ 8 callersMethod_load_tensor
()
lit_llama/utils.py:181
↓ 8 callersMethodinit_module
(self, empty_init)
tests/test_generate.py:72
↓ 6 callersFunctionfind_multiple
(n: int, k: int)
lit_llama/utils.py:38
↓ 6 callersFunctionlora
Apply context manager under which you can instantiate the model with LoRA. In a nutshell the code inside this function forces to use LoRA variant
lit_llama/lora.py:450
↓ 5 callersMethodbuild_rope_cache
(self, idx: torch.Tensor)
lit_llama/model.py:128
↓ 4 callersMethod__init__
(self, config: LLaMAConfig)
lit_llama/model.py:241
↓ 4 callersMethodadd_array
(self, arr)
lit_llama/packed_dataset.py:124
↓ 4 callersFunctionapply_rope
(x: torch.Tensor, rope_cache: RoPECache)
lit_llama/model.py:306
↓ 4 callersMethodbuild_mask_cache
(self, idx: torch.Tensor)
lit_llama/model.py:136
↓ 4 callersFunctionquantization
(mode: str = None)
lit_llama/utils.py:142
↓ 4 callersMethodreset_cache
(self)
lit_llama/model.py:140
↓ 4 callersFunctionsave_model_checkpoint
Handles boilerplate logic for retrieving and saving the state_dict. This will be upstreamed to Fabric soon.
lit_llama/utils.py:44
↓ 3 callersMethod__init__
Store LoRA specific attributes in a class. Args: r: rank of the weight update matrices. To make sense of using LoRA the rank shou
lit_llama/lora.py:60
↓ 3 callersFunctionadd_adapter_v2_parameters_to_linear_layers
(model)
lit_llama/adapter_v2.py:44
↓ 3 callersMethodstore_early
(self, tensor)
lit_llama/utils.py:470
↓ 2 callersMethod__init__
(self, config: LLaMAConfig, block_idx: int)
lit_llama/adapter.py:197
↓ 2 callersMethod__init__
(self, fn)
lit_llama/utils.py:333
↓ 2 callersMethod_close_mmaps
(self)
lit_llama/packed_dataset.py:179
↓ 2 callersMethod_load_n_chunks
(self)
lit_llama/packed_dataset.py:183
↓ 2 callersMethod_quantize_weight
(self, weight: torch.Tensor)
lit_llama/quantization.py:69
↓ 2 callersMethod_write_chunk
(self)
lit_llama/packed_dataset.py:100
↓ 2 callersMethod_write_storage_and_return_key
(self, storage)
lit_llama/utils.py:486
↓ 2 callersFunctionadapter_state_from_state_dict
Returns the model state dict with only the adapter weights for saving.
lit_llama/adapter.py:313
↓ 2 callersFunctionadapter_v2_linear_with_bias_and_scale
(layer)
lit_llama/adapter_v2.py:36
↓ 2 callersFunctionadapter_v2_state_from_state_dict
Returns the model state dict with only the adapter weights for saving.
lit_llama/adapter_v2.py:24
↓ 2 callersFunctioncopy_weights
(llama_model, orig_llama_model)
tests/test_model.py:29
↓ 2 callersFunctioncreate_dataloader
( batch_size: int, block_size: int, data_dir: str, fabric, shuffle: bool = True, seed:
pretrain/redpajama.py:237
↓ 2 callersFunctiondownload_original
(wd: str)
scripts/download.py:13
↓ 2 callersMethoddtype
(self)
lit_llama/packed_dataset.py:117
↓ 2 callersFunctionenable_gate
(model)
tests/test_model.py:155
↓ 2 callersMethodfind_params_weight
(self, x)
lit_llama/quantization.py:477
↓ 2 callersFunctionget_adapter_substrings
()
lit_llama/adapter_v2.py:11
↓ 2 callersFunctionget_batch
(fabric: L.Fabric, data: list)
finetune/adapter.py:217
↓ 2 callersFunctionget_batch
(fabric: L.Fabric, data: list)
finetune/full.py:201
↓ 2 callersFunctionget_batch
(fabric: L.Fabric, data: list)
finetune/lora.py:196
↓ 2 callersFunctionget_batch
(fabric: L.Fabric, data: list)
finetune/adapter_v2.py:220
↓ 2 callersFunctionget_batch
(fabric: L.Fabric, data: np.ndarray, block_size: int)
pretrain/shakespeare.py:152
↓ 2 callersFunctionload_generate_script
()
tests/test_generate.py:18
↓ 2 callersFunctionlora_state_dict
Return state_dict with weights of LoRA's A and B matrices and with biases depending on the `bias` value. Args: model: model with LoRA lay
lit_llama/lora.py:364
↓ 2 callersFunctionloss_fn
(logits, targets)
finetune/adapter.py:209
↓ 2 callersFunctionloss_fn
(logits, targets)
finetune/full.py:193
↓ 2 callersFunctionloss_fn
(logits, targets)
finetune/lora.py:188
↓ 2 callersFunctionloss_fn
(logits, targets)
finetune/adapter_v2.py:212
↓ 2 callersFunctionmark_only_lora_as_trainable
Freeze all modules except LoRA's and depending on 'bias' value unfreezes bias weights. Args: model: model with LoRA layers bias:
lit_llama/lora.py:329
↓ 2 callersFunctionpad_right
(x, pad_id)
finetune/adapter.py:225
↓ 2 callersFunctionpad_right
(x, pad_id)
finetune/full.py:209
↓ 2 callersFunctionpad_right
(x, pad_id)
finetune/lora.py:204
↓ 2 callersFunctionpad_right
(x, pad_id)
finetune/adapter_v2.py:228
↓ 2 callersFunctionpermute
(w)
scripts/convert_hf_checkpoint.py:63
↓ 2 callersFunctionprepare_line
Processes a single sample. This function processes the line to produce the tokenized version of it.
scripts/prepare_any_text.py:78
↓ 2 callersFunctionprepare_sample
Processes a single sample. Each sample in the dataset consists of: - instruction: A string describing the task - input: A string hold
scripts/prepare_dolly.py:81
↓ 2 callersFunctionprepare_sample
Processes a single sample. Each sample in the dataset consists of: - instruction: A string describing the task - input: A string hold
scripts/prepare_alpaca.py:78
↓ 2 callersMethodquantize
(self)
lit_llama/quantization.py:531
↓ 2 callersFunctionsave_model_checkpoint
(fabric, model, file_path)
finetune/adapter.py:282
↓ 2 callersFunctionsave_model_checkpoint
(fabric, model, file_path)
finetune/adapter_v2.py:285
↓ 2 callersFunctiontokenize
(tokenizer: Tokenizer, string: str, max_length: int, eos=True)
scripts/prepare_dolly.py:111
↓ 2 callersFunctiontokenize
(tokenizer: Tokenizer, string: str, max_length: int, eos=True)
scripts/prepare_alpaca.py:109
↓ 2 callersFunctiontrain_tokenizer
(destination_path)
tests/test_prepare_redpajama.py:16
↓ 2 callersMethodwrite_reminder
(self)
lit_llama/packed_dataset.py:135
↓ 2 callersMethodzero_pad
Properly pad weight updates with zeros. If, based on `self.enable_lora`, we want to fine-tune queries and values, but not keys, then
lit_llama/lora.py:205
↓ 1 callersMethod__enter__
(self)
lit_llama/utils.py:339
↓ 1 callersMethod__exit__
(self, exc_type, exc_val, exc_tb)
lit_llama/utils.py:342
↓ 1 callersMethod__init__
(self, *args, **kwargs)
lit_llama/quantization.py:46
↓ 1 callersMethod__reduce_ex__
(self, protocol_version)
lit_llama/utils.py:395
↓ 1 callersMethod_read_header
(self, path)
lit_llama/packed_dataset.py:168
↓ 1 callersFunctionbuild_rope_cache
Enhanced Transformer with Rotary Position Embedding. Derived from: https://github.com/labmlai/annotated_deep_learning_paper_implementations/blob/
lit_llama/model.py:280
↓ 1 callersFunctioncode
(dtype)
lit_llama/packed_dataset.py:28
↓ 1 callersFunctionconvert_state_dict
(state_dict: Dict[str, torch.Tensor], dtype: torch.dtype = torch.float32)
scripts/convert_checkpoint.py:22
↓ 1 callersFunctioncopy_adapter_weights
(llama_model, orig_llama_model)
tests/test_model.py:136
↓ 1 callersFunctioncopy_attention
(llama_attn, orig_llama_attn)
tests/test_model.py:14
↓ 1 callersFunctioncopy_block
(llama_block, orig_llama_block)
tests/test_model.py:22
↓ 1 callersFunctioncopy_mlp
(llama_mlp, orig_llama_mlp)
tests/test_model.py:8
↓ 1 callersFunctioncreate_dataloaders
( batch_size: int, block_size: int, fabric, train_data_dir: str = "data/lit-redpajama", va
pretrain/redpajama.py:268
↓ 1 callersFunctiondel_lora_state_dict
(model: nn.Module)
scripts/convert_lora_weights.py:20
↓ 1 callersFunctiondownload
Downloads the raw json data file and saves it in the given destination.
scripts/prepare_dolly.py:73
↓ 1 callersFunctiondownload
Downloads the raw json data file and saves it in the given destination.
scripts/prepare_alpaca.py:70
↓ 1 callersFunctiongenerate_prompt
Generates a standardized message to prompt the model with an instruction, optional input and a 'response' field.
scripts/prepare_dolly.py:115
↓ 1 callersFunctiongenerate_response
(model, instruction, input="")
finetune/adapter.py:169
↓ 1 callersFunctiongenerate_response
(model, instruction)
finetune/full.py:152
↓ 1 callersFunctiongenerate_response
(model, instruction, tokenizer_path)
finetune/lora.py:148
↓ 1 callersFunctiongenerate_response
(model, instruction, input="")
finetune/adapter_v2.py:174
↓ 1 callersFunctionget_dataloader
( fabric: L.Fabric, data: torch.Tensor, micro_batch_size: int, group_by_length: bool, )
finetune/adapter.py:249
↓ 1 callersFunctionget_dataloader
( fabric: L.Fabric, data: torch.Tensor, micro_batch_size: int, group_by_length: bool, )
finetune/full.py:233
↓ 1 callersFunctionget_dataloader
( fabric: L.Fabric, data: torch.Tensor, micro_batch_size: int, group_by_length: bool, )
finetune/lora.py:228
↓ 1 callersFunctionget_dataloader
( fabric: L.Fabric, data: torch.Tensor, micro_batch_size: int, group_by_length: bool, )
finetune/adapter_v2.py:252
↓ 1 callersFunctionget_length_grouped_indices
Return a list of indices so that each slice of `batch_size` consecutive indices correspond to elements of similar lengths. To do this, the in
finetune/length_grouped_sampler.py:26
↓ 1 callersFunctionget_lr
(it)
pretrain/redpajama.py:302
↓ 1 callersFunctionget_sample_data
()
quantize/gptq.py:24
↓ 1 callersMethodget_weight
(self, dtype=torch.float)
lit_llama/quantization.py:392
↓ 1 callersFunctionllama_blockwise_quantization
This is the classic post-training quantization of all linear layers. We quantize in order, i.e. when observing the inputs, we use the outputs
quantize/gptq.py:39
↓ 1 callersFunctionload_datasets
(data_dir)
finetune/adapter.py:276
next →1–100 of 276, ranked by callers