MCPcopy Create free account

hub / github.com/Nicolas-BZRD/llm-recipes / functions

Functions67 in github.com/Nicolas-BZRD/llm-recipes

↓ 11 callersFunctionbyte2gb
(x)
models/memory.py:9
↓ 4 callersFunctionupdate_config
(config, isSubmodule=False, **kwargs)
configs/configs_utils.py:11
↓ 3 callersMethodcpu_mem_used
get resident set size memory for the current process
models/memory.py:27
↓ 3 callersFunctionget_dataloader
(dataset_config, train_config, tokenizer, rank, distil_config=None)
data/data_utils.py:48
↓ 3 callersFunctionget_model
(train_config, fsdp_config, rank, kwargs)
models/models_utils.py:118
↓ 3 callersFunctionload
()
models/models_utils.py:38
↓ 3 callersMethodstep
Performs a single optimization step. Args: closure (callable, optional): A closure that reevaluates the model and
policies/anyprecision_optimizer.py:61
↓ 2 callersMethod__get_start_and_size_answers
(self, answer_tensors)
models/distillation_model.py:177
↓ 2 callersFunctionclear_gpu_cache
Clear the GPU cache for all ranks
train/tools.py:20
↓ 2 callersFunctionget_dataloader_kwargs
(train_config, dataset, tokenizer, mode, distil_config=None)
configs/configs_utils.py:39
↓ 2 callersFunctionget_dataset
(dataset_config, tokenizer, split: str)
data/data_utils.py:25
↓ 2 callersFunctionpreprocess_distillation_batch
(batch)
models/distillation_model.py:7
↓ 2 callersFunctionsave_model_and_optimizer_sharded
save model and optimizer via sharded_state_dict to save_dir
models/checkpoint_handler.py:70
↓ 1 callersMethod__init__
(self, crossentropy_weight=1, distillation_weight=1, student_temperature=1, teacher_temperature=1, skip_studen
models/distillation_model.py:38
↓ 1 callersFunctionapply_fsdp_checkpointing
apply activation checkpointing to model returns None as model is updated directly
policies/activation_checkpointing_functions.py:20
↓ 1 callersFunctionevaluation
(model, train_config, distil_config, eval_dataloader, steps_per_eval, local_rank)
train/evaluations.py:8
↓ 1 callersFunctionfreeze_transformer_layers
(model, num_layer)
models/tools.py:14
↓ 1 callersFunctionfsdp_auto_wrap_policy
(model, transformer_layer_name: list)
models/fsdp.py:6
↓ 1 callersFunctiongenerate_peft_config
(train_config, kwargs)
configs/configs_utils.py:25
↓ 1 callersFunctionget_distillation_dataloader
(dataset_config, train_config, distil_config, student_tokenizer, teacher_tokenizer, rank)
data/data_utils.py:108
↓ 1 callersFunctionget_distillation_models
(train_config, distil_config, fsdp_config, rank, kwargs)
models/models_utils.py:125
↓ 1 callersFunctionget_optimizer
(model, train_config, fsdp_config)
models/models_utils.py:134
↓ 1 callersFunctionget_policies
(cfg, rank)
models/tools.py:26
↓ 1 callersFunctionget_wrapper
()
policies/wrapping.py:20
↓ 1 callersFunctionload_model
(train_config, rank)
models/models_utils.py:36
↓ 1 callersFunctionload_model_from_config
(config_path)
models/checkpoint_converter_fsdp_hf.py:13
↓ 1 callersFunctionload_module_from_py_file
This method loads a module from a py file which is not in the Python path
data/data_utils.py:12
↓ 1 callersFunctionload_sharded_model_single_gpu
(model, model_path)
models/checkpoint_handler.py:191
↓ 1 callersFunctionload_tokenizer
(name, encoder_decoder)
models/models_utils.py:30
↓ 1 callersFunctionprint_model_size
(model, config, rank: int = 0)
models/tools.py:53
↓ 1 callersFunctionsave_model
(model, optimizer, step, train_config, distil_config, fsdp_config, rank)
train/save.py:10
↓ 1 callersFunctionsave_model_checkpoint
saving model via rank0 cpu streaming and full_state_dict
models/checkpoint_handler.py:98
↓ 1 callersFunctionsave_train_params
This function saves the train_config and FSDP config into a train_params.yaml. This will be used by converter script in the inference folder
train/save.py:44
↓ 1 callersFunctionset_model
(model, train_config, fsdp_config, rank, kwargs)
models/models_utils.py:81
↓ 1 callersFunctionsetup
Initialize the process group for distributed training
train/tools.py:5
↓ 1 callersFunctionsetup_environ_flags
Set environment flags for debugging purposes
train/tools.py:9
↓ 1 callersFunctiontrain
(model, train_dataloader, eval_dataloader, optimizer, lr_scheduler, gradient_accumulation_steps, train_config,
train/train_utils.py:16
Method__enter__
(self)
models/memory.py:14
Method__exit__
(self, *exc)
models/memory.py:47
Method__getitem__
(self, idx)
data/concatenator.py:25
Method__init__
(self, data_source, batch_size: int, drop_last: bool, shuffle: bool = True, seed: int = 0)
data/sampler.py:8
Method__init__
(self, data_source, batch_size: int, num_replicas: int, rank: int, shuffle: bool = True, seed: int = 0)
data/sampler.py:36
Method__init__
(self, dataset, chunk_size)
data/concatenator.py:5
Method__init__
Args: params (iterable): iterable of parameters to optimize or dicts defining parameter groups
policies/anyprecision_optimizer.py:5
Method__init__
(self, student, teacher)
models/distillation_model.py:15
Method__iter__
(self)
data/sampler.py:19
Method__iter__
(self)
data/sampler.py:43
Method__len__
(self)
data/sampler.py:28
Method__len__
(self)
data/sampler.py:48
Method__len__
(self)
data/concatenator.py:28
Method__str__
(self)
models/memory.py:38
Functionbyte2mb
(x)
models/memory.py:6
Functioncheck_frozen_layers_peft_model
(model)
models/tools.py:20
Functioncleanup
Clean up the process group after training
train/tools.py:16
Methodforward
(self, student_input_ids, student_attention_mask, student_labels, teacher_input_ids, teacher_attention_mask, t
models/distillation_model.py:21
Methodforward
(self, student_predictions, teacher_predictions, student_targets, teacher_targets, rank=0)
models/distillation_model.py:65
Functionget_date_of_run
create date and time for file save uniqueness example: 2022-05-07-08:31:12_PM'
models/checkpoint_handler.py:19
Functionget_parameter_dtypes
(model)
models/tools.py:8
Functionget_size_policy
(min_params=1e8)
policies/wrapping.py:13
Functionlambda_policy_fn
(module)
models/fsdp.py:7
Functionload_model_checkpoint
load local checkpoint to rank0 cpu must be called * before * passing to FSDP
models/checkpoint_handler.py:110
Functionload_model_sharded
(model, rank, cfg)
models/checkpoint_handler.py:32
Functionload_optimizer_checkpoint
load an fsdp optimizer full_state checkpoint using scatter method this ensures only rank 0 loads the optimizer state dict and scatters to other ra
models/checkpoint_handler.py:169
Functionmain
(**kwargs)
finetuning.py:20
Functionmain
( fsdp_checkpoint_path="", # Path to FSDP Sharded model checkpoints consolidated_model_path="", # Path
models/checkpoint_converter_fsdp_hf.py:18
Methodpeak_monitor_func
(self)
models/memory.py:31
Functionsave_optimizer_checkpoint
save optimizer state via full state dict
models/checkpoint_handler.py:135