SYMBOL INDEX (850 symbols across 127 files) FILE: contrib/langchain/retrieval_chatbot.py class LangchainChatbot (line 26) | class LangchainChatbot: method __init__ (line 27) | def __init__(self, model_name_or_path: str, provider: str): method check_valid_provider (line 51) | def check_valid_provider(self): method set_retriever_url (line 69) | def set_retriever_url(self, url, chunk_size, chunk_overlap): method set_retriever_file (line 77) | def set_retriever_file(self, file, chunk_size, chunk_overlap): method get_model (line 85) | def get_model(self): method chat_with_chatbot (line 101) | def chat_with_chatbot(self, human_input, session_id): method retrieve_by_url (line 113) | def retrieve_by_url(self, query): method retrieve_by_file (line 116) | def retrieve_by_file(self, query): method get_session_history (line 119) | def get_session_history(self, session_id: str) -> BaseChatMessageHistory: function get_cli (line 125) | def get_cli() -> argparse.ArgumentParser: function main (line 143) | def main( FILE: contrib/long-context/sft_summarizer.py class UserArguments (line 35) | class UserArguments: class WandbCallback (line 128) | class WandbCallback(TrainerCallback): method __init__ (line 129) | def __init__(self, trainer): method on_save (line 137) | def on_save(self, args: TrainingArguments, state: TrainerState, contro... FILE: contrib/rlhflow/reward_modeling.py function build_dataset (line 72) | def build_dataset(tokenizer, config): function compute_metrics (line 109) | def compute_metrics(eval_pred): class DataCollatorReward (line 118) | class DataCollatorReward: method __init__ (line 119) | def __init__(self, tokenizer): method __call__ (line 122) | def __call__(self, data): class RMTrainer (line 143) | class RMTrainer(Trainer): method compute_loss (line 144) | def compute_loss(self, model, inputs, return_outputs=False): FILE: contrib/text2image/diffuser_args.py class T2IDatasetArguments (line 9) | class T2IDatasetArguments(DatasetArguments): method __post_init__ (line 22) | def __post_init__(self): class DiffuserModelArguments (line 54) | class DiffuserModelArguments: class DiffuserTunerArguments (line 98) | class DiffuserTunerArguments: FILE: contrib/text2image/diffuser_finetuner.py function log_validation (line 31) | def log_validation( class DiffuserModelTuner (line 66) | class DiffuserModelTuner(BaseTuner): method __init__ (line 87) | def __init__( method tune (line 99) | def tune( FILE: contrib/text2image/finetune_t2i.py function main (line 20) | def main(): FILE: contrib/text2image/t2i_dataset.py class CustomT2IDataset (line 18) | class CustomT2IDataset(Dataset): method __init__ (line 21) | def __init__(self, data_args: T2IDatasetArguments): method __len__ (line 31) | def __len__(self): method __getitem__ (line 34) | def __getitem__(self, idx): class EncodePreprocessor (line 46) | class EncodePreprocessor: method __init__ (line 47) | def __init__(self, data_args: T2IDatasetArguments, kind: str = "simple... method register_simple_func (line 63) | def register_simple_func(self, tokenizer, text_encoder, vae): method __call__ (line 90) | def __call__(self, data_item): class PreprocessedT2IDataset (line 94) | class PreprocessedT2IDataset(Dataset): method __init__ (line 97) | def __init__(self, raw_dataset: Dataset, data_args: T2IDatasetArgument... method __len__ (line 104) | def __len__(self): method __getitem__ (line 107) | def __getitem__(self, idx): function build_t2i_dataset (line 111) | def build_t2i_dataset(data_args: T2IDatasetArguments, tokenizer, text_en... FILE: contrib/tool-finetune/function_call_finetune.py class HFDecoderModelForTool (line 34) | class HFDecoderModelForTool(HFDecoderModel): method tokenize (line 35) | def tokenize(self, dataset, add_special_tokens=True, *args, **kwargs) ... function conversation_tokenize_function (line 158) | def conversation_tokenize_function( function train (line 245) | def train(): FILE: examples/benchmarking.py function is_lmflow_local_benchmarking (line 115) | def is_lmflow_local_benchmarking(dataset_name): function is_lm_evaluation_benchmarking (line 142) | def is_lm_evaluation_benchmarking(dataset_name): function run_lmflow_local_benchmarking (line 149) | def run_lmflow_local_benchmarking( function run_lm_evaluation_benchmarking (line 191) | def run_lm_evaluation_benchmarking(dataset_name, model_name): function main (line 214) | def main(): FILE: examples/chatbot.py class ChatbotArguments (line 27) | class ChatbotArguments: function main (line 42) | def main(): FILE: examples/chatbot_gradio.py class ChatbotArguments (line 80) | class ChatbotArguments: function hist2context (line 141) | def hist2context(hist): function chat_stream (line 150) | def chat_stream(query: str, history=None, **kwargs): function predict (line 178) | def predict(input, history=None): FILE: examples/dpov2_train.py function main (line 28) | def main(): FILE: examples/finetune.py function main (line 32) | def main(): FILE: examples/finetune_multi_modal.py function main (line 34) | def main(): FILE: examples/inference.py function main (line 24) | def main(): FILE: examples/iterative_dpo_train.py function main (line 35) | def main(): FILE: examples/merge_lora.py class MergeLoraArguments (line 24) | class MergeLoraArguments: function main (line 43) | def main(): FILE: examples/multistage_finetune.py class MultistageFinetuneArgs (line 37) | class MultistageFinetuneArgs: function setup_logger (line 45) | def setup_logger(): function generate_new_seed (line 56) | def generate_new_seed(seed): function shuffle_and_split_data (line 60) | def shuffle_and_split_data(dataset, num_split=None, seed=None): function main (line 75) | def main(): FILE: examples/raft_align.py class RewardArguments (line 25) | class RewardArguments: function get_reward_function (line 53) | def get_reward_function(reward_args, pipeline_args): function main (line 92) | def main(): FILE: examples/reward_modeling.py function main (line 23) | def main(): FILE: examples/rm_inference.py function main (line 21) | def main(): FILE: examples/sglang_inference.py function main (line 21) | def main(): FILE: examples/tool_inference.py function main (line 9) | def main(): FILE: examples/vis_chatbot.py class ChatbotArguments (line 33) | class ChatbotArguments: function main (line 63) | def main(): FILE: examples/vis_chatbot_gradio.py class ChatbotArguments (line 69) | class ChatbotArguments: function gradio_reset (line 89) | def gradio_reset(chat_state, img_list): function upload_image (line 103) | def upload_image(image_file, history, text_input, chat_state, image_list): function read_img (line 133) | def read_img(image): function gradio_ask (line 143) | def gradio_ask(user_message, chatbot, chat_state): function gradio_answer (line 155) | def gradio_answer(chatbot, chat_state, image_list, num_beams=1, temperat... function start_inferencer (line 214) | def start_inferencer( FILE: examples/vllm_inference.py function main (line 21) | def main(): FILE: experimental/LISA-diffusion/diffusion_dpo/train_diffusion_dpo.py function import_model_class_from_model_name_or_path (line 69) | def import_model_class_from_model_name_or_path(pretrained_model_name_or_... function log_validation (line 85) | def log_validation(args, unet, accelerator, weight_dtype, epoch, is_fina... function parse_args (line 150) | def parse_args(input_args=None): function tokenize_captions (line 443) | def tokenize_captions(tokenizer, examples): function encode_prompt (line 455) | def encode_prompt(text_encoder, input_ids): function main (line 465) | def main(args): FILE: experimental/LISA-diffusion/diffusion_dpo/train_diffusion_dpo_lisa.py function freeze_all_layers (line 67) | def freeze_all_layers(model): function random_activate_layers (line 72) | def random_activate_layers(model, p): function lisa (line 85) | def lisa(model, p=0.25): function import_model_class_from_model_name_or_path (line 90) | def import_model_class_from_model_name_or_path(pretrained_model_name_or_... function update_ema (line 107) | def update_ema(target_params, source_params, rate=0.99): function log_validation (line 121) | def log_validation(args, unet, accelerator, weight_dtype, epoch, is_fina... function parse_args (line 185) | def parse_args(input_args=None): function tokenize_captions (line 472) | def tokenize_captions(tokenizer, examples): function encode_prompt (line 484) | def encode_prompt(text_encoder, input_ids): function main (line 494) | def main(args): FILE: experimental/LISA-diffusion/instruct_pix2pix/test_instruct_pix2pix.py class InstructPix2Pix (line 30) | class InstructPix2Pix(ExamplesTestsAccelerate): method test_instruct_pix2pix_checkpointing_checkpoints_total_limit (line 31) | def test_instruct_pix2pix_checkpointing_checkpoints_total_limit(self): method test_instruct_pix2pix_checkpointing_checkpoints_total_limit_removes_multiple_checkpoints (line 54) | def test_instruct_pix2pix_checkpointing_checkpoints_total_limit_remove... FILE: experimental/LISA-diffusion/instruct_pix2pix/train_instruct_pix2pix_lisa.py function parse_args (line 63) | def parse_args(): function convert_to_np (line 369) | def convert_to_np(image, resolution): function download_image (line 374) | def download_image(url): function freeze_all_layers (line 381) | def freeze_all_layers(model): function random_activate_layers (line 386) | def random_activate_layers(model, p): function lisa (line 399) | def lisa(model, p=0.25): function main (line 404) | def main(): FILE: experimental/LISA-diffusion/latent_consistency_model/train_lcm_distill_sd_wds_lisa.py function freeze_all_layers (line 76) | def freeze_all_layers(model): function random_activate_layers (line 81) | def random_activate_layers(model, p): function lisa (line 94) | def lisa(model, p=0.25): function filter_keys (line 99) | def filter_keys(key_set): function group_by_keys_nothrow (line 106) | def group_by_keys_nothrow(data, keys=base_plus_ext, lcase=True, suffixes... function tarfile_to_samples_nothrow (line 134) | def tarfile_to_samples_nothrow(src, handler=wds.warn_and_continue): class WebdatasetFilter (line 142) | class WebdatasetFilter: method __init__ (line 143) | def __init__(self, min_size=1024, max_pwatermark=0.5): method __call__ (line 147) | def __call__(self, x): class SDText2ImageDataset (line 162) | class SDText2ImageDataset: method __init__ (line 163) | def __init__( method train_dataset (line 233) | def train_dataset(self): method train_dataloader (line 237) | def train_dataloader(self): function log_validation (line 241) | def log_validation(vae, unet, args, accelerator, weight_dtype, step, nam... function guidance_scale_embedding (line 337) | def guidance_scale_embedding(w, embedding_dim=512, dtype=torch.float32): function append_dims (line 366) | def append_dims(x, target_dims): function scalings_for_boundary_conditions (line 375) | def scalings_for_boundary_conditions(timestep, sigma_data=0.5, timestep_... function get_predicted_original_sample (line 383) | def get_predicted_original_sample(model_output, timesteps, sample, predi... function get_predicted_noise (line 402) | def get_predicted_noise(model_output, timesteps, sample, prediction_type... function extract_into_tensor (line 420) | def extract_into_tensor(a, t, x_shape): class DDIMSolver (line 426) | class DDIMSolver: method __init__ (line 427) | def __init__(self, alpha_cumprods, timesteps=1000, ddim_timesteps=50): method to (line 440) | def to(self, device): method ddim_step (line 446) | def ddim_step(self, pred_x0, pred_noise, timestep_index): function update_ema (line 454) | def update_ema(target_params, source_params, rate=0.99): function import_model_class_from_model_name_or_path (line 468) | def import_model_class_from_model_name_or_path( function parse_args (line 488) | def parse_args(): function encode_prompt (line 849) | def encode_prompt(prompt_batch, text_encoder, tokenizer, proportion_empt... function main (line 874) | def main(args): FILE: experimental/LISA-diffusion/latent_consistency_model/train_lcm_distill_sd_wds_lora.py function get_module_kohya_state_dict (line 77) | def get_module_kohya_state_dict(module, prefix: str, dtype: torch.dtype,... function filter_keys (line 94) | def filter_keys(key_set): function group_by_keys_nothrow (line 101) | def group_by_keys_nothrow(data, keys=base_plus_ext, lcase=True, suffixes... function tarfile_to_samples_nothrow (line 129) | def tarfile_to_samples_nothrow(src, handler=wds.warn_and_continue): class WebdatasetFilter (line 137) | class WebdatasetFilter: method __init__ (line 138) | def __init__(self, min_size=1024, max_pwatermark=0.5): method __call__ (line 142) | def __call__(self, x): class SDText2ImageDataset (line 157) | class SDText2ImageDataset: method __init__ (line 158) | def __init__( method train_dataset (line 228) | def train_dataset(self): method train_dataloader (line 232) | def train_dataloader(self): function log_validation (line 236) | def log_validation(vae, unet, args, accelerator, weight_dtype, step): function guidance_scale_embedding (line 318) | def guidance_scale_embedding(w, embedding_dim=512, dtype=torch.float32): function append_dims (line 347) | def append_dims(x, target_dims): function scalings_for_boundary_conditions (line 356) | def scalings_for_boundary_conditions(timestep, sigma_data=0.5, timestep_... function get_predicted_original_sample (line 364) | def get_predicted_original_sample(model_output, timesteps, sample, predi... function get_predicted_noise (line 383) | def get_predicted_noise(model_output, timesteps, sample, prediction_type... function extract_into_tensor (line 401) | def extract_into_tensor(a, t, x_shape): class DDIMSolver (line 407) | class DDIMSolver: method __init__ (line 408) | def __init__(self, alpha_cumprods, timesteps=1000, ddim_timesteps=50): method to (line 421) | def to(self, device): method ddim_step (line 427) | def ddim_step(self, pred_x0, pred_noise, timestep_index): function update_ema (line 435) | def update_ema(target_params, source_params, rate=0.99): function import_model_class_from_model_name_or_path (line 448) | def import_model_class_from_model_name_or_path( function parse_args (line 468) | def parse_args(): function encode_prompt (line 842) | def encode_prompt(prompt_batch, text_encoder, tokenizer, proportion_empt... function main (line 867) | def main(args): FILE: experimental/LISA-diffusion/single_lisa.py class LISADiffusion (line 5) | class LISADiffusion: method __init__ (line 6) | def __init__(self, model, rate=None): method freeze_all_layers (line 11) | def freeze_all_layers(self, model): method random_activate_layers (line 15) | def random_activate_layers(self, model, p): method lisa (line 26) | def lisa(self, model, p=0.25): method lisa_recall (line 30) | def lisa_recall(self): method initialize (line 35) | def initialize(self): method register (line 40) | def register( method insert_hook (line 65) | def insert_hook( FILE: experimental/RAFT-diffusion/train_text_to_image_lora.py function save_model_card (line 53) | def save_model_card(repo_name, images=None, base_model=str, dataset_name... function parse_args (line 82) | def parse_args(): function get_full_repo_name (line 346) | def get_full_repo_name(model_id: str, organization: Optional[str] = None... function main (line 361) | def main(): FILE: scripts/archive/convert_llama_weights_to_hf.py function compute_intermediate_size (line 59) | def compute_intermediate_size(n): function read_json (line 63) | def read_json(path): function write_json (line 68) | def write_json(text, path): function write_model (line 73) | def write_model(model_path, input_base_path, model_size): function write_tokenizer (line 232) | def write_tokenizer(tokenizer_path, input_tokenizer_path): function main (line 249) | def main(): FILE: scripts/archive/export_llama_state_dict_checkpoint.py function permute (line 11) | def permute(w): function unpermute (line 15) | def unpermute(w): function translate_state_dict_key (line 19) | def translate_state_dict_key(k): # noqa: C901 FILE: src/lmflow/args.py class OptimizerNames (line 34) | class OptimizerNames: class ModelArguments (line 58) | class ModelArguments: method __post_init__ (line 331) | def __post_init__(self): class VisModelArguments (line 368) | class VisModelArguments(ModelArguments): class DatasetArguments (line 418) | class DatasetArguments: method __post_init__ (line 601) | def __post_init__(self): class MultiModalDatasetArguments (line 617) | class MultiModalDatasetArguments(DatasetArguments): class FinetunerArguments (line 626) | class FinetunerArguments(TrainingArguments): class RewardModelTunerArguments (line 684) | class RewardModelTunerArguments(FinetunerArguments): class EvaluatorArguments (line 693) | class EvaluatorArguments: method __post_init__ (line 843) | def __post_init__(self): class InferencerArguments (line 853) | class InferencerArguments: method __post_init__ (line 1070) | def __post_init__(self): class RaftAlignerArguments (line 1135) | class RaftAlignerArguments(TrainingArguments): class BenchmarkingArguments (line 1195) | class BenchmarkingArguments: class DPOAlignerArguments (line 1227) | class DPOAlignerArguments: class DPOv2AlignerArguments (line 1309) | class DPOv2AlignerArguments(FinetunerArguments): class IterativeAlignerArguments (line 1333) | class IterativeAlignerArguments(InferencerArguments): class IterativeDPOAlignerArguments (line 1347) | class IterativeDPOAlignerArguments(IterativeAlignerArguments, DPOv2Align... class AutoArguments (line 1384) | class AutoArguments: method get_pipeline_args_class (line 1389) | def get_pipeline_args_class(pipeline_name: str): function split_args (line 1393) | def split_args(args): FILE: src/lmflow/datasets/dataset.py class Dataset (line 53) | class Dataset: method __init__ (line 72) | def __init__(self, data_args: DatasetArguments = None, backend: str = ... method __len__ (line 112) | def __len__(self): method _check_instance_format (line 115) | def _check_instance_format(self): method _check_hf_json_format (line 125) | def _check_hf_json_format(self, data_files: list[str]): method from_dict (line 150) | def from_dict(self, dict_obj: dict, *args, **kwargs): method create_from_dict (line 238) | def create_from_dict(cls, dict_obj, *args, **kwargs): method to_dict (line 249) | def to_dict(self): method to_list (line 298) | def to_list(self): method map (line 310) | def map(self, *args, **kwargs): method get_backend (line 336) | def get_backend(self) -> Optional[str]: method get_backend_dataset (line 345) | def get_backend_dataset(self): method get_fingerprint (line 354) | def get_fingerprint(self): method get_data_args (line 363) | def get_data_args(self): method get_type (line 372) | def get_type(self) -> str: method save (line 381) | def save(self, file_path: str, format: str = "json"): method sample (line 398) | def sample(self, n: int, seed: int = 42): method train_test_split (line 428) | def train_test_split(self, test_size: float = 0.2, shuffle: bool = Tru... method drop_instances (line 470) | def drop_instances(self, indices: list): method sanity_check (line 484) | def sanity_check( method hf_dataset_sanity_check (line 496) | def hf_dataset_sanity_check( FILE: src/lmflow/datasets/multi_modal_dataset.py class CustomMultiModalDataset (line 26) | class CustomMultiModalDataset(Dataset): method __init__ (line 29) | def __init__(self, dataset_path: str, data_args: DatasetArguments): method __len__ (line 37) | def __len__(self): method register_tokenizer (line 40) | def register_tokenizer(self, tokenizer, image_processor=None): method __getitem__ (line 44) | def __getitem__(self, i): function preprocess_multimodal_llava (line 94) | def preprocess_multimodal_llava(sources, data_args): function tokenizer_image_token (line 116) | def tokenizer_image_token(prompt, tokenizer, image_token_index=IMAGE_TOK... function preprocess_llama_from_llava_plain (line 138) | def preprocess_llama_from_llava_plain(sources, tokenizer: transformers.P... function preprocess_llama_from_llava_v1 (line 166) | def preprocess_llama_from_llava_v1(sources, tokenizer: transformers.PreT... class DataCollatorForSupervisedDataset (line 254) | class DataCollatorForSupervisedDataset: method __call__ (line 259) | def __call__(self, instances): FILE: src/lmflow/models/auto_model.py class AutoModel (line 10) | class AutoModel: method get_model (line 12) | def get_model(self, model_args, *args, **kwargs): FILE: src/lmflow/models/base_model.py class BaseModel (line 5) | class BaseModel: FILE: src/lmflow/models/decoder_model.py class DecoderModel (line 18) | class DecoderModel(BaseModel): method __init__ (line 19) | def __init__(self, *args, **kwargs): FILE: src/lmflow/models/encoder_decoder_model.py class EncoderDecoderModel (line 18) | class EncoderDecoderModel(BaseModel): method __init__ (line 19) | def __init__(self, *args, **kwargs): FILE: src/lmflow/models/hf_decoder_model.py class HFDecoderModel (line 62) | class HFDecoderModel(DecoderModel, HFModelMixin, Tunable): method __init__ (line 83) | def __init__(self, model_args, do_train=True, device="gpu", **kwargs): method tokenize (line 86) | def tokenize(self, dataset: Dataset, add_special_tokens=True, *args, *... method encode (line 239) | def encode(self, input: Union[str, list[str]], *args, **kwargs) -> Uni... method decode (line 273) | def decode(self, input, **kwargs) -> Union[str, list[str]]: method inference (line 315) | def inference( method __inference (line 387) | def __inference(self, inputs, *args, **kwargs): method __vllm_inference (line 425) | def __vllm_inference( method __sglang_inference (line 468) | def __sglang_inference( method prepare_inputs_for_inference (line 493) | def prepare_inputs_for_inference( method merge_lora_weights (line 597) | def merge_lora_weights(self): method get_peft_without_qlora (line 610) | def get_peft_without_qlora(self): method save (line 649) | def save(self, dir, save_full_model=False, *args, **kwargs): FILE: src/lmflow/models/hf_model_mixin.py class HFModelMixin (line 43) | class HFModelMixin(BaseModel): method __init__ (line 44) | def __init__( method __prepare_tokenizer (line 94) | def __prepare_tokenizer( method __prepare_dtype (line 133) | def __prepare_dtype( method __prepare_model_config (line 159) | def __prepare_model_config( method __prepare_quant_config (line 203) | def __prepare_quant_config( method __prepare_peft_config (line 248) | def __prepare_peft_config( method __model_module_inject (line 304) | def __model_module_inject( method __prepare_model_for_training (line 323) | def __prepare_model_for_training( method __prepare_model_for_inference (line 386) | def __prepare_model_for_inference( method __prepare_model_for_vllm_inference (line 446) | def __prepare_model_for_vllm_inference( method __prepare_model_for_sglang_inference (line 466) | def __prepare_model_for_sglang_inference( method __fix_special_tokens (line 489) | def __fix_special_tokens(self): method activate_model_for_inference (line 511) | def activate_model_for_inference( method deactivate_model_for_inference (line 545) | def deactivate_model_for_inference( method get_max_length (line 575) | def get_max_length(self): method get_tokenizer (line 581) | def get_tokenizer(self): method get_backend_model (line 587) | def get_backend_model(self): FILE: src/lmflow/models/hf_text_regression_model.py class HFTextRegressionModel (line 45) | class HFTextRegressionModel(TextRegressionModel, HFModelMixin, Tunable): method __init__ (line 66) | def __init__(self, model_args: ModelArguments, do_train: bool = False,... method tokenize (line 80) | def tokenize(self, dataset: Dataset, add_special_tokens=True, *args, *... method inference (line 222) | def inference( method __inference (line 266) | def __inference(self, inputs, **kwargs): method __vllm_inference (line 310) | def __vllm_inference( method prepare_inputs_for_inference (line 330) | def prepare_inputs_for_inference( method postprocess_inference_outputs (line 366) | def postprocess_inference_outputs( method postprocess_distributed_inference_outputs (line 398) | def postprocess_distributed_inference_outputs( method save (line 411) | def save(self, dir, *args, **kwargs): FILE: src/lmflow/models/interfaces/tunable.py class Tunable (line 5) | class Tunable: FILE: src/lmflow/models/regression_model.py class RegressionModel (line 7) | class RegressionModel(BaseModel): method __init__ (line 8) | def __init__(self, *args, **kwargs): FILE: src/lmflow/models/text_regression_model.py class TextRegressionModel (line 10) | class TextRegressionModel(RegressionModel): method __init__ (line 27) | def __init__(self, model_args, *args, **kwargs): method register_inference_function (line 34) | def register_inference_function(self, inference_func): method inference (line 40) | def inference(self, inputs: Dataset): FILE: src/lmflow/models/vision2seq_model.py class CustomAutoVision2SeqModel (line 31) | class CustomAutoVision2SeqModel(Blip2ForConditionalGeneration, BaseModel): method __init__ (line 32) | def __init__( method get_backend_model (line 111) | def get_backend_model(self): method vision_model_from_pretrained (line 114) | def vision_model_from_pretrained(self, pretrained_path): method qformer_from_pretrained (line 117) | def qformer_from_pretrained(self, pretrained_path): method language_model_from_pretrained (line 120) | def language_model_from_pretrained(self, pretrained_path, low_resource... method vision_feature_select (line 136) | def vision_feature_select(self, image_forward_outs): method register_prompt_cache (line 146) | def register_prompt_cache(self, prompt_ids, prompt_keys_values): method save_prompt_cache (line 161) | def save_prompt_cache(self, path): method load_prompt_cache (line 174) | def load_prompt_cache(self, path): method get_tokenizer (line 186) | def get_tokenizer(self): method forward (line 189) | def forward( method processor_image_token_in_minigpt4 (line 307) | def processor_image_token_in_minigpt4( method generate (line 352) | def generate( FILE: src/lmflow/models/vision_encoder/clip_encoder.py function build_vision_tower (line 8) | def build_vision_tower(vision_tower_cfg, **kwargs): class CLIPVisionTower (line 17) | class CLIPVisionTower(nn.Module): method __init__ (line 18) | def __init__(self, vision_tower, args, delay_load=False): method load_model (line 31) | def load_model(self): method encode_images (line 37) | def encode_images(self, images, language_projection): method feature_select (line 45) | def feature_select(self, image_forward_outs): method forward (line 56) | def forward(self, images): method dummy_feature (line 74) | def dummy_feature(self): method dtype (line 78) | def dtype(self): method device (line 82) | def device(self): method config (line 86) | def config(self): method hidden_size (line 93) | def hidden_size(self): method num_patches (line 97) | def num_patches(self): method prepare_inputs_labels_for_multimodal (line 100) | def prepare_inputs_labels_for_multimodal( FILE: src/lmflow/optim/adabelief.py class AdaBelief (line 9) | class AdaBelief(Optimizer): method __init__ (line 14) | def __init__( method __setstate__ (line 66) | def __setstate__(self, state): method reset (line 71) | def reset(self): method step (line 88) | def step(self, closure=None): FILE: src/lmflow/optim/adabound.py class AdaBound (line 9) | class AdaBound(Optimizer): method __init__ (line 19) | def __init__( method __setstate__ (line 56) | def __setstate__(self, state) -> None: method step (line 61) | def step(self, closure=None): FILE: src/lmflow/optim/adadelta.py class Adadelta (line 7) | class Adadelta(Optimizer): method __init__ (line 8) | def __init__(self, params, lr=1.0, rho=0.95, eps=1e-6): method step (line 12) | def step(self, closure=None): FILE: src/lmflow/optim/adagrad.py class AdaGrad (line 6) | class AdaGrad(torch.optim.Optimizer): method __init__ (line 7) | def __init__(self, params, lr=0.001, eps=1e-8, weight_decay=0): method step (line 11) | def step(self, closure=None): FILE: src/lmflow/optim/adam.py class Adam (line 7) | class Adam(Optimizer): method __init__ (line 8) | def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-8): method step (line 12) | def step(self, closure=None): FILE: src/lmflow/optim/adamax.py class Adamax (line 7) | class Adamax(Optimizer): method __init__ (line 8) | def __init__(self, params, lr=2e-3, betas=(0.9, 0.999), eps=1e-8, weig... method __setstate__ (line 22) | def __setstate__(self, state): method step (line 25) | def step(self, closure=None): FILE: src/lmflow/optim/adamp.py class AdamP (line 9) | class AdamP(Optimizer): method __init__ (line 20) | def __init__( method _channel_view (line 58) | def _channel_view(x): method _layer_view (line 62) | def _layer_view(x): method _cosine_similarity (line 66) | def _cosine_similarity(x, y, eps, view_func): method _projection (line 76) | def _projection(self, p, grad, perturb, delta, wd_ratio, eps): method step (line 91) | def step(self, closure=None): FILE: src/lmflow/optim/adamw_schedule_free.py class AdamWScheduleFree (line 15) | class AdamWScheduleFree(torch.optim.Optimizer): method __init__ (line 27) | def __init__( method eval (line 58) | def eval(self): method train (line 70) | def train(self): method step (line 82) | def step(self, closure=None): FILE: src/lmflow/optim/adan.py class Adan (line 10) | class Adan(Optimizer): method __init__ (line 19) | def __init__( method __setstate__ (line 53) | def __setstate__(self, state): method restart_opt (line 59) | def restart_opt(self): method step (line 75) | def step(self): function _single_tensor_adan (line 166) | def _single_tensor_adan( function _multi_tensor_adan (line 217) | def _multi_tensor_adan( FILE: src/lmflow/optim/dummy.py class Dummy (line 12) | class Dummy(Optimizer): method __init__ (line 23) | def __init__( method step (line 40) | def step(self, closure: Callable = None): FILE: src/lmflow/optim/lamb.py class Lamb (line 9) | class Lamb(Optimizer): method __init__ (line 20) | def __init__( method step (line 51) | def step(self, closure=None): FILE: src/lmflow/optim/lars.py class LARS (line 7) | class LARS(Optimizer): method __init__ (line 39) | def __init__( method __setstate__ (line 77) | def __setstate__(self, state) -> None: method step (line 84) | def step(self, closure=None): FILE: src/lmflow/optim/muon.py function zeropower_via_newtonschulz5 (line 8) | def zeropower_via_newtonschulz5(G: Tensor, steps: int) -> Tensor: class Muon (line 41) | class Muon(torch.optim.Optimizer): method __init__ (line 46) | def __init__(self, params, lr=0.001, betas=(0.9, 0.999), eps=1e-8, wei... method step (line 51) | def step(self, closure=None): FILE: src/lmflow/optim/nadam.py class NAdam (line 8) | class NAdam(torch.optim.Optimizer): method __init__ (line 9) | def __init__(self, params, lr=2e-3, betas=(0.9, 0.999), eps=1e-8, weig... method __setstate__ (line 25) | def __setstate__(self, state): method step (line 28) | def step(self, closure=None): FILE: src/lmflow/optim/novograd.py class NovoGrad (line 7) | class NovoGrad(optim.Optimizer): method __init__ (line 8) | def __init__( method __setstate__ (line 26) | def __setstate__(self, state): method step (line 31) | def step(self, closure=None): FILE: src/lmflow/optim/radam.py class RAdam (line 10) | class RAdam(Optimizer): method __init__ (line 24) | def __init__( method __setstate__ (line 62) | def __setstate__(self, state): method step (line 65) | def step(self, closure=None): FILE: src/lmflow/optim/sgd_schedule_free.py class SGDScheduleFree (line 13) | class SGDScheduleFree(torch.optim.Optimizer): method __init__ (line 25) | def __init__( method eval (line 61) | def eval(self): method train (line 73) | def train(self): method step (line 85) | def step(self, closure=None): FILE: src/lmflow/optim/sgdp.py class SGDP (line 9) | class SGDP(Optimizer): method __init__ (line 20) | def __init__( method _channel_view (line 60) | def _channel_view(x): method _layer_view (line 64) | def _layer_view(x): method _cosine_similarity (line 68) | def _cosine_similarity(x, y, eps, view_func): method _projection (line 78) | def _projection(self, p, grad, perturb, delta, wd_ratio, eps): method step (line 93) | def step(self, closure=None): FILE: src/lmflow/optim/sophia.py class SophiaG (line 7) | class SophiaG(Optimizer): method __init__ (line 13) | def __init__( method __setstate__ (line 39) | def __setstate__(self, state): method update_hessian (line 51) | def update_hessian(self): method step (line 74) | def step(self, closure=None, bs=5120): FILE: src/lmflow/optim/utils.py function create_customized_optimizer (line 10) | def create_customized_optimizer(base_trainer_class, model_args): FILE: src/lmflow/optim/yogi.py class Yogi (line 10) | class Yogi(Optimizer): method __init__ (line 20) | def __init__( method step (line 49) | def step(self, closure=None): FILE: src/lmflow/pipeline/auto_pipeline.py class AutoPipeline (line 57) | class AutoPipeline: method get_pipeline (line 63) | def get_pipeline(self, pipeline_name, model_args, data_args, pipeline_... FILE: src/lmflow/pipeline/base_aligner.py class BaseAligner (line 9) | class BaseAligner(BasePipeline): method __init__ (line 12) | def __init__(self, *args, **kwargs): method _check_if_alignable (line 15) | def _check_if_alignable(self, model, dataset, reward_model): method align (line 21) | def align(self, model, dataset, reward_model): FILE: src/lmflow/pipeline/base_pipeline.py class BasePipeline (line 5) | class BasePipeline: FILE: src/lmflow/pipeline/base_tuner.py class BaseTuner (line 9) | class BaseTuner(BasePipeline): method __init__ (line 12) | def __init__(self, *args, **kwargs): method _check_if_tunable (line 15) | def _check_if_tunable(self, model, dataset): method tune (line 20) | def tune(self, model, dataset): FILE: src/lmflow/pipeline/dpo_aligner.py function get_paired_dataset (line 23) | def get_paired_dataset( class DPOAligner (line 70) | class DPOAligner(BaseAligner): method __init__ (line 71) | def __init__(self, model_args, data_args, aligner_args): method _initialize_trainer (line 78) | def _initialize_trainer(self, model, tokenizer): method _load_dataset (line 132) | def _load_dataset(self): method align (line 151) | def align(self, model, dataset, reward_model): FILE: src/lmflow/pipeline/dpov2_aligner.py class DPOv2Aligner (line 30) | class DPOv2Aligner(BaseAligner): method __init__ (line 31) | def __init__( method align (line 43) | def align( method __prepare_training_args (line 114) | def __prepare_training_args( method convert_to_paired_dataset (line 143) | def convert_to_paired_dataset( method _calc_response_lengths (line 184) | def _calc_response_lengths( method _calc_reward_with_length_penalty (line 198) | def _calc_reward_with_length_penalty( method sampling_paired_idx_from_rewards (line 210) | def sampling_paired_idx_from_rewards( method _sampling_paired_idx_from_rewards (line 228) | def _sampling_paired_idx_from_rewards( method _sampling_paired_idx_from_rewards_fast (line 250) | def _sampling_paired_idx_from_rewards_fast( class MemorySafeDPOv2Aligner (line 273) | class MemorySafeDPOv2Aligner: method __init__ (line 274) | def __init__( method align (line 287) | def align(self): FILE: src/lmflow/pipeline/evaluator.py class Evaluator (line 41) | class Evaluator(BasePipeline): method __init__ (line 59) | def __init__( method create_dataloader (line 103) | def create_dataloader(self, dataset: Dataset): method _match (line 122) | def _match(self, predicted_answer, groundtruth, answer_type=None): method evaluate (line 137) | def evaluate( method _evaluate_acc_with_accelerate (line 174) | def _evaluate_acc_with_accelerate(self, model, dataset, verbose=True): method _evaluate_acc_with_deepspeed (line 282) | def _evaluate_acc_with_deepspeed(self, model, dataset, verbose=True): method _evaluate_ppl (line 386) | def _evaluate_ppl(self, model, dataset: Dataset, verbose=True): method _evaluate_nll (line 435) | def _evaluate_nll( FILE: src/lmflow/pipeline/finetuner.py class Finetuner (line 40) | class Finetuner(BaseTuner): method __init__ (line 63) | def __init__( method group_text (line 131) | def group_text(self, tokenized_datasets, model_max_length): method tune (line 222) | def tune( FILE: src/lmflow/pipeline/inferencer.py function rstrip_partial_utf8 (line 32) | def rstrip_partial_utf8(string): class Inferencer (line 44) | class Inferencer(BasePipeline): method __init__ (line 62) | def __init__( method create_dataloader (line 98) | def create_dataloader(self, dataset: Dataset): method inference (line 127) | def inference( method stream_inference (line 269) | def stream_inference( class SpeculativeInferencer (line 317) | class SpeculativeInferencer(Inferencer): method __init__ (line 338) | def __init__(self, model_args, draft_model_args, data_args, inferencer... method score_to_prob (line 350) | def score_to_prob( method sample (line 399) | def sample(prob: torch.Tensor, num_samples: int = 1) -> dict: method predict_next_token (line 409) | def predict_next_token(model: HFDecoderModel, input_ids: torch.Tensor,... method autoregressive_sampling (line 421) | def autoregressive_sampling( method inference (line 437) | def inference( method stream_inference (line 560) | def stream_inference(self): class ToolInferencer (line 564) | class ToolInferencer(Inferencer): method __init__ (line 582) | def __init__(self, model_args, data_args, inferencer_args): method inference (line 587) | def inference( method code_exec (line 627) | def code_exec(self, code): FILE: src/lmflow/pipeline/iterative_dpo_aligner.py class IterativeDPOAligner (line 27) | class IterativeDPOAligner: method __init__ (line 28) | def __init__( method align (line 44) | def align(self, dataset_list: list[Dataset]): method _align_single_iteration (line 64) | def _align_single_iteration( method _do_target_model_inference (line 118) | def _do_target_model_inference( method _do_reward_model_inference (line 146) | def _do_reward_model_inference( method _do_single_dpo_align (line 171) | def _do_single_dpo_align( method _parse_target_model_inference_args (line 191) | def _parse_target_model_inference_args( method _parse_reward_model_inference_args (line 205) | def _parse_reward_model_inference_args( method _parse_dpo_aligner_args (line 216) | def _parse_dpo_aligner_args( method __filter_args (line 231) | def __filter_args( FILE: src/lmflow/pipeline/raft_aligner.py class RaftAligner (line 34) | class RaftAligner(BaseAligner): method __init__ (line 57) | def __init__(self, model_args, data_args, aligner_args, *args, **kwargs): method _initialize_trainer (line 80) | def _initialize_trainer(self, model, tokenizer, training_args): method _load_dataset (line 96) | def _load_dataset( method _load_input_dataset (line 218) | def _load_input_dataset(self, dataset, tokenizer): method _clean_text (line 244) | def _clean_text(self, text): method _discard_sample (line 250) | def _discard_sample(self, text): method _get_batch_dataset_top (line 257) | def _get_batch_dataset_top( method _get_batch_dataset_local (line 390) | def _get_batch_dataset_local( method align (line 545) | def align(self, model, dataset, reward_model): FILE: src/lmflow/pipeline/rm_inferencer.py class RewardModelInferencer (line 41) | class RewardModelInferencer(BasePipeline): method __init__ (line 57) | def __init__( method inference (line 84) | def inference( method _inference (line 132) | def _inference( method __inference (line 157) | def __inference( method __distributed_inference (line 200) | def __distributed_inference( method __vllm_inference (line 300) | def __vllm_inference( method __post_process_model_output (line 308) | def __post_process_model_output( method flatten_list (line 316) | def flatten_list(self, list_of_list: list[list]) -> tuple[list, list[i... method compress_list (line 321) | def compress_list(self, list_to_compress: list, sublist_lengths: list[... FILE: src/lmflow/pipeline/rm_tuner.py class RewardModelTuner (line 16) | class RewardModelTuner(Finetuner): method __init__ (line 37) | def __init__(self, model_args, data_args, finetuner_args, *args, **kwa... method tune (line 40) | def tune( FILE: src/lmflow/pipeline/sglang_inferencer.py class SGLangInferencer (line 29) | class SGLangInferencer(BasePipeline): method __init__ (line 30) | def __init__( method _parse_args_to_sampling_params (line 43) | def _parse_args_to_sampling_params( method inference (line 62) | def inference( method save_inference_results (line 99) | def save_inference_results( method load_inference_results (line 110) | def load_inference_results( FILE: src/lmflow/pipeline/utils/dpov2_dataprocessor.py class PreferenceDataCollatorWithPadding (line 16) | class PreferenceDataCollatorWithPadding: method tokenize_batch_element (line 29) | def tokenize_batch_element( method collate (line 133) | def collate(self, batch): method __call__ (line 174) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, Any]: FILE: src/lmflow/pipeline/utils/dpov2_trainer.py class DPOv2Trainer (line 29) | class DPOv2Trainer(DPOTrainer): method __init__ (line 30) | def __init__( method dpo_loss (line 102) | def dpo_loss( method get_batch_loss_metrics (line 193) | def get_batch_loss_metrics( method get_batch_metrics (line 201) | def get_batch_metrics( FILE: src/lmflow/pipeline/utils/lisa_trainer.py class DynamicLayerActivationCallback (line 8) | class DynamicLayerActivationCallback(TrainerCallback): method __init__ (line 9) | def __init__( method freeze_all_layers (line 43) | def freeze_all_layers(self): method on_step_begin (line 49) | def on_step_begin(self, args, state, control, **kwargs): method switch_active_layers (line 54) | def switch_active_layers(self): FILE: src/lmflow/pipeline/utils/memory_safe_dpov2_align.py function main (line 26) | def main(): FILE: src/lmflow/pipeline/utils/memory_safe_vllm_inference.py function main (line 27) | def main(): FILE: src/lmflow/pipeline/utils/raft_trainer.py class RaftTrainer (line 209) | class RaftTrainer: method __init__ (line 282) | def __init__( method add_callback (line 655) | def add_callback(self, callback): method pop_callback (line 665) | def pop_callback(self, callback): method remove_callback (line 678) | def remove_callback(self, callback): method _move_model_to_device (line 688) | def _move_model_to_device(self, model, device): method _set_signature_columns_if_needed (line 694) | def _set_signature_columns_if_needed(self): method _remove_unused_columns (line 702) | def _remove_unused_columns(self, dataset: "datasets.Dataset", descript... method _get_collator_with_removed_columns (line 728) | def _get_collator_with_removed_columns( method _get_train_sampler (line 746) | def _get_train_sampler(self) -> Optional[torch.utils.data.Sampler]: method get_train_dataloader (line 817) | def get_train_dataloader(self) -> DataLoader: method _get_eval_sampler (line 865) | def _get_eval_sampler(self, eval_dataset: Dataset) -> Optional[torch.u... method get_eval_dataloader (line 894) | def get_eval_dataloader(self, eval_dataset: Optional[Dataset] = None) ... method get_test_dataloader (line 942) | def get_test_dataloader(self, test_dataset: Dataset) -> DataLoader: method create_optimizer_and_scheduler (line 988) | def create_optimizer_and_scheduler(self, num_training_steps: int): method create_optimizer (line 1003) | def create_optimizer(self): method get_optimizer_cls_and_kwargs (line 1059) | def get_optimizer_cls_and_kwargs(args: TrainingArguments) -> tuple[Any... method create_scheduler (line 1147) | def create_scheduler(self, num_training_steps: int, optimizer: torch.o... method num_examples (line 1166) | def num_examples(self, dataloader: DataLoader) -> int: method _hp_search_setup (line 1180) | def _hp_search_setup(self, trial: Union["optuna.Trial", dict[str, Any]]): method _report_to_hp_search (line 1221) | def _report_to_hp_search(self, trial: Union["optuna.Trial", dict[str, ... method _tune_save_checkpoint (line 1239) | def _tune_save_checkpoint(self): method call_model_init (line 1252) | def call_model_init(self, trial=None): method torch_jit_model_eval (line 1266) | def torch_jit_model_eval(self, model, dataloader, training=False): method ipex_optimize_model (line 1304) | def ipex_optimize_model(self, model, training=False, dtype=torch.float... method _wrap_model (line 1327) | def _wrap_model(self, model, training=True, dataloader=None): method train (line 1517) | def train( method _one_train (line 1613) | def _one_train( method _inner_training_loop (line 1950) | def _inner_training_loop( method _get_output_dir (line 2053) | def _get_output_dir(self, trial): method _load_from_checkpoint (line 2073) | def _load_from_checkpoint(self, resume_from_checkpoint, model=None): method _load_best_model (line 2131) | def _load_best_model(self): method _issue_warnings_after_load (line 2191) | def _issue_warnings_after_load(self, load_result): method _maybe_log_save_evaluate (line 2202) | def _maybe_log_save_evaluate(self, tr_loss, model, trial, epoch, ignor... method _load_rng_state (line 2241) | def _load_rng_state(self, checkpoint): method _save_checkpoint (line 2282) | def _save_checkpoint(self, model, trial, metrics=None): method _load_optimizer_and_scheduler (line 2391) | def _load_optimizer_and_scheduler(self, checkpoint): method hyperparameter_search (line 2448) | def hyperparameter_search( method log (line 2546) | def log(self, logs: dict[str, float]) -> None: method _prepare_input (line 2561) | def _prepare_input(self, data: Union[torch.Tensor, Any]) -> Union[torc... method _prepare_inputs (line 2579) | def _prepare_inputs(self, inputs: dict[str, Union[torch.Tensor, Any]])... method compute_loss_context_manager (line 2595) | def compute_loss_context_manager(self): method autocast_smart_context_manager (line 2601) | def autocast_smart_context_manager(self, cache_enabled: Optional[bool]... method training_step (line 2620) | def training_step(self, model: nn.Module, inputs: dict[str, Union[torc... method compute_loss (line 2664) | def compute_loss(self, model, inputs, return_outputs=False): method is_local_process_zero (line 2695) | def is_local_process_zero(self) -> bool: method is_world_process_zero (line 2702) | def is_world_process_zero(self) -> bool: method save_model (line 2714) | def save_model(self, output_dir: Optional[str] = None, _internal_call:... method _save_tpu (line 2777) | def _save_tpu(self, output_dir: Optional[str] = None): method _save (line 2805) | def _save(self, output_dir: Optional[str] = None, state_dict=None): method store_flos (line 2830) | def store_flos(self): method _sorted_checkpoints (line 2841) | def _sorted_checkpoints( method _rotate_checkpoints (line 2865) | def _rotate_checkpoints(self, use_mtime=False, output_dir=None) -> None: method evaluate (line 2890) | def evaluate( method predict (line 2957) | def predict( method evaluation_loop (line 3012) | def evaluation_loop( method _nested_gather (line 3220) | def _nested_gather(self, tensors, name=None): method _pad_across_processes (line 3238) | def _pad_across_processes(self, tensor, pad_index=-100): method prediction_step (line 3270) | def prediction_step( method floating_point_ops (line 3371) | def floating_point_ops(self, inputs: dict[str, Union[torch.Tensor, Any... method init_git_repo (line 3387) | def init_git_repo(self, at_init: bool = False): method create_model_card (line 3433) | def create_model_card( method _push_from_checkpoint (line 3488) | def _push_from_checkpoint(self, checkpoint_folder): method push_to_hub (line 3530) | def push_to_hub(self, commit_message: Optional[str] = "End of training... method prediction_loop (line 3588) | def prediction_loop( method _gather_and_numpify (line 3733) | def _gather_and_numpify(self, tensors, name): method _add_sm_patterns_to_gitignore (line 3749) | def _add_sm_patterns_to_gitignore(self) -> None: FILE: src/lmflow/pipeline/utils/rm_dataprocessor.py class RewardDataCollatorWithPadding (line 12) | class RewardDataCollatorWithPadding: method __call__ (line 19) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, Any]: FILE: src/lmflow/pipeline/utils/rm_trainer.py function compute_metrics (line 7) | def compute_metrics(eval_pred): function rm_loss (line 16) | def rm_loss(model, inputs, return_outputs=False): class RewardTrainer (line 29) | class RewardTrainer(Trainer): method compute_loss (line 30) | def compute_loss(self, model, inputs, return_outputs=False): FILE: src/lmflow/pipeline/vllm_inferencer.py class InferencerWithOffloading (line 46) | class InferencerWithOffloading(BasePipeline): method __init__ (line 47) | def __init__( method inference (line 58) | def inference(self): method save_inference_results (line 61) | def save_inference_results(self): method load_inference_results (line 64) | def load_inference_results(self): class VLLMInferencer (line 68) | class VLLMInferencer(InferencerWithOffloading): method __init__ (line 69) | def __init__( method parse_to_sampling_params (line 79) | def parse_to_sampling_params( method inference (line 94) | def inference( method _inference (line 171) | def _inference( method _distributed_inference (line 189) | def _distributed_inference( method save_inference_results (line 277) | def save_inference_results( method load_inference_results (line 287) | def load_inference_results( class MemorySafeVLLMInferencer (line 297) | class MemorySafeVLLMInferencer(VLLMInferencer): method __init__ (line 298) | def __init__( method inference (line 308) | def inference(self) -> list[VLLMInferenceResultWithInput]: FILE: src/lmflow/tokenization/hf_decoder_model.py function blocking (line 19) | def blocking( function tokenize_function (line 57) | def tokenize_function( function conversation_tokenize_function (line 111) | def conversation_tokenize_function( FILE: src/lmflow/tokenization/hf_text_regression_model.py function blocking_paired (line 19) | def blocking_paired( function blocking (line 61) | def blocking( function blocking_text_to_textlist (line 99) | def blocking_text_to_textlist( function paired_conversation_tokenize_function (line 140) | def paired_conversation_tokenize_function( function conversation_tokenize_function (line 214) | def conversation_tokenize_function( function tokenize_function (line 283) | def tokenize_function( function text_to_textlist_tokenize_function (line 337) | def text_to_textlist_tokenize_function( FILE: src/lmflow/utils/common.py function make_shell_args_from_dataclass (line 13) | def make_shell_args_from_dataclass( function create_copied_dataclass (line 76) | def create_copied_dataclass(original_dataclass, field_prefix: str, class... function remove_dataclass_attr_prefix (line 133) | def remove_dataclass_attr_prefix(data_instance, prefix: str) -> dict: function add_dataclass_attr_prefix (line 156) | def add_dataclass_attr_prefix(data_instance, prefix: str) -> dict: function print_banner (line 179) | def print_banner(message: str): FILE: src/lmflow/utils/conversation_template/base.py class TemplateComponent (line 18) | class TemplateComponent: method __post_init__ (line 56) | def __post_init__(self): method __repr__ (line 74) | def __repr__(self) -> str: method __str__ (line 77) | def __str__(self) -> str: class Formatter (line 82) | class Formatter(ABC): method format (line 86) | def format(self, **kwargs) -> list[TemplateComponent]: ... method has_placeholder (line 88) | def has_placeholder(self): class EmptyFormatter (line 99) | class EmptyFormatter(Formatter): method __post_init__ (line 100) | def __post_init__(self): method format (line 104) | def format(self, **kwargs) -> list: class StringFormatter (line 117) | class StringFormatter(Formatter): method __post_init__ (line 118) | def __post_init__(self): method format (line 122) | def format(self, **kwargs) -> list: class ConversationTemplate (line 156) | class ConversationTemplate: method __post_init__ (line 171) | def __post_init__(self): method encode_conversation (line 182) | def encode_conversation( method _encode (line 231) | def _encode( method _encode_template (line 264) | def _encode_template( method post_process_pairs (line 302) | def post_process_pairs(self, encoded_pairs, tokenizer): method remove_last_separator (line 326) | def remove_last_separator( method add_special_starter (line 349) | def add_special_starter( method add_special_stopper (line 372) | def add_special_stopper( method _ensure_id_list (line 395) | def _ensure_id_list(self, obj: Union[int, list[int]]) -> list[int]: class ConversationTemplateForTool (line 406) | class ConversationTemplateForTool(ConversationTemplate): method encode_conversation (line 407) | def encode_conversation( method _encode (line 456) | def _encode( method _encode_template (line 508) | def _encode_template( method _handle_tools (line 546) | def _handle_tools(self, tools: Optional[list[str]]) -> str: FILE: src/lmflow/utils/conversation_template/gemma.py class GemmaConversationTemplate (line 12) | class GemmaConversationTemplate(ConversationTemplate): method encode_conversation (line 13) | def encode_conversation(self, *args, **kwargs): FILE: src/lmflow/utils/conversation_template/hymba.py class HymbaConversationTemplate (line 37) | class HymbaConversationTemplate(ConversationTemplateForTool): method _handle_tools (line 38) | def _handle_tools(self, tools: Optional[list[str]]) -> str: FILE: src/lmflow/utils/conversation_template/llama.py class Llama2ConversationTemplate (line 16) | class Llama2ConversationTemplate(ConversationTemplate): method _encode (line 17) | def _encode( class Llama2ConversationTemplateForTool (line 54) | class Llama2ConversationTemplateForTool(Llama2ConversationTemplate): method _encode (line 55) | def _encode( FILE: src/lmflow/utils/conversation_template/zephyr.py class ZephyrConversationTemplate (line 14) | class ZephyrConversationTemplate(ConversationTemplate): method _encode (line 15) | def _encode( FILE: src/lmflow/utils/data_utils.py function set_random_seed (line 15) | def set_random_seed(seed: int): function load_data (line 32) | def load_data(file_name: str): function batchlize (line 66) | def batchlize(examples: list, batch_size: int, random_shuffle: bool): function preview_file (line 99) | def preview_file(file_path: str, chars: int = 100): function get_dataset_type_fast (line 129) | def get_dataset_type_fast(file_path: str, max_chars: int = 100) -> Union... function check_dataset_instances_key_fast (line 144) | def check_dataset_instances_key_fast(file_path: str, instances_key: str,... function answer_extraction (line 155) | def answer_extraction(response, answer_type=None): # use this funtion t... function process_image_flag (line 276) | def process_image_flag(text, image_flag=""): class VLLMInferenceResultWithInput (line 288) | class VLLMInferenceResultWithInput(TypedDict): class RewardModelInferenceResultWithInput (line 293) | class RewardModelInferenceResultWithInput(TypedDict): FILE: src/lmflow/utils/debug/profiler.py class Timer (line 5) | class Timer: method __init__ (line 6) | def __init__(self, name): method start (line 11) | def start(self, tag): method end (line 14) | def end(self, tag): method get_runtime (line 18) | def get_runtime(self, tag): method show (line 21) | def show(self): method _to_readable (line 25) | def _to_readable(self): FILE: src/lmflow/utils/deprecated.py function deprecated_args (line 13) | def deprecated_args(**deprecated_params: dict[str, Any]): FILE: src/lmflow/utils/envs.py function is_accelerate_env (line 15) | def is_accelerate_env(): function get_device_name (line 22) | def get_device_name() -> str: function get_torch_device (line 33) | def get_torch_device() -> any: FILE: src/lmflow/utils/llava_conversation_lib.py class SeparatorStyle (line 6) | class SeparatorStyle(Enum): class Conversation (line 17) | class Conversation: method get_prompt (line 31) | def get_prompt(self): method append_message (line 109) | def append_message(self, role, message): method get_images (line 112) | def get_images(self, return_pil=False): method to_gradio_chatbot (line 165) | def to_gradio_chatbot(self): method copy (line 199) | def copy(self): method dict (line 211) | def dict(self): FILE: src/lmflow/utils/model.py function check_homogeneity (line 12) | def check_homogeneity(model_args_list: list[ModelArguments]) -> bool: FILE: src/lmflow/utils/multimodal.py function update_custom_config (line 8) | def update_custom_config(config, model_args): function load_llava_pretrain_model (line 23) | def load_llava_pretrain_model(model, checkpoint_path): function adapt_llava_model_to_lmflow_type (line 38) | def adapt_llava_model_to_lmflow_type(state_dict): FILE: src/lmflow/utils/position_interpolation/llama_rope_scaled_monkey_patch.py class CondenseRotaryEmbedding (line 8) | class CondenseRotaryEmbedding(torch.nn.Module): method __init__ (line 9) | def __init__(self, dim, pi_ratio, ntk_ratio, max_position_embeddings=2... method forward (line 31) | def forward(self, x, seq_len=None): function replace_llama_with_condense (line 50) | def replace_llama_with_condense(pi_ratio, ntk_ratio): FILE: src/lmflow/utils/protocol.py function union_python_dict (line 34) | def union_python_dict(dict1: dict, dict2: dict): function union_tensor_dict (line 52) | def union_tensor_dict(tensor_dict1: TensorDict, tensor_dict2: TensorDict... function _array_equal (line 68) | def _array_equal(array1: np.ndarray, array2: np.ndarray, visited: Set[in... function _deep_equal (line 95) | def _deep_equal(a: Any, b: Any, visited: Set[int]) -> bool: function union_numpy_dict (line 131) | def union_numpy_dict(tensor_dict1: Dict[str, np.ndarray], tensor_dict2: ... function list_of_dict_to_dict_of_list (line 145) | def list_of_dict_to_dict_of_list(list_of_dict: List[dict]): function collate_fn (line 157) | def collate_fn(x: List["DataProtoItem"]): function get_tensordict (line 170) | def get_tensordict(tensor_dict: Dict[str, Union[torch.Tensor, list]], no... class DataProtoItem (line 250) | class DataProtoItem: class DataProto (line 257) | class DataProto: method __post_init__ (line 269) | def __post_init__(self): method __len__ (line 273) | def __len__(self): method __getitem__ (line 282) | def __getitem__(self, item): method __getstate__ (line 316) | def __getstate__(self): method __setstate__ (line 326) | def __setstate__(self, data): method save_to_disk (line 336) | def save_to_disk(self, filepath): method load_from_disk (line 341) | def load_from_disk(filepath) -> "DataProto": method print_size (line 346) | def print_size(self, prefix=""): method check_consistency (line 364) | def check_consistency(self): method from_single_dict (line 390) | def from_single_dict(cls, data: Dict[str, Union[torch.Tensor, np.ndarr... method from_dict (line 406) | def from_dict( method from_tensordict (line 453) | def from_tensordict( method to (line 493) | def to(self, device) -> "DataProto": method select (line 507) | def select(self, batch_keys=None, non_tensor_batch_keys=None, meta_inf... method select_idxs (line 542) | def select_idxs(self, idxs): method slice (line 582) | def slice(self, start=None, end=None, step=None): method pop (line 628) | def pop(self, batch_keys=None, non_tensor_batch_keys=None, meta_info_k... method rename (line 661) | def rename(self, old_keys=None, new_keys=None) -> "DataProto": method union (line 688) | def union(self, other: "DataProto") -> "DataProto": method make_iterator (line 707) | def make_iterator(self, mini_batch_size, epochs, seed=None, dataloader... method padding (line 747) | def padding(self, padding_size, padding_candidate=""): method chunk (line 762) | def chunk(self, chunks: int) -> list["DataProto"]: method split (line 803) | def split(self, split_size: int) -> list["DataProto"]: method concat (line 815) | def concat(data: list["DataProto"]) -> "DataProto": method reorder (line 861) | def reorder(self, indices): method repeat (line 869) | def repeat(self, repeat_times=2, interleave=True): method unfold_column_chunks (line 913) | def unfold_column_chunks(self, n_split: int, split_keys: Optional[list... method sample_level_repeat (line 952) | def sample_level_repeat(self, repeat_times): method to_tensordict (line 1000) | def to_tensordict(self) -> TensorDict: method get_data_info (line 1024) | def get_data_info(self) -> str: method _get_type_info (line 1051) | def _get_type_info(self, value): FILE: src/lmflow/utils/test_utils.py function compare_model (line 7) | def compare_model( FILE: src/lmflow/utils/versioning.py function get_python_version (line 13) | def get_python_version(): function _is_package_available (line 17) | def _is_package_available(package_name: str, skippable: bool = False): function _is_packages_available (line 33) | def _is_packages_available(packages: Union[List[str], List[Tuple[str, bo... function is_package_version_at_least (line 42) | def is_package_version_at_least(package_name, min_version): function is_gradio_available (line 52) | def is_gradio_available(): function is_ray_available (line 56) | def is_ray_available(): function is_vllm_available (line 60) | def is_vllm_available(): function is_sglang_available (line 64) | def is_sglang_available(): function is_flash_attn_available (line 68) | def is_flash_attn_available(): function is_flask_available (line 72) | def is_flask_available(): function is_trl_available (line 76) | def is_trl_available(): function is_multimodal_available (line 80) | def is_multimodal_available(): function is_deepspeed_available (line 84) | def is_deepspeed_available(): function get_lmflow_dir (line 88) | def get_lmflow_dir(return_src_dir: bool = False) -> Path: FILE: tests/conftest.py function pytest_configure (line 4) | def pytest_configure(config: pytest.Config): FILE: tests/datasets/conftest.py function dataset_inference_conversation (line 8) | def dataset_inference_conversation() -> Dataset: function dataset_inference_conversation_batch (line 17) | def dataset_inference_conversation_batch() -> Dataset: FILE: tests/datasets/test_dataset.py class DatasetTest (line 24) | class DatasetTest(unittest.TestCase): method test_init (line 25) | def test_init(self): method test_create_from_dict (line 36) | def test_create_from_dict(self): method test_create_from_dict_bad_type (line 47) | def test_create_from_dict_bad_type(self): FILE: tests/models/test_auto_model.py class AutoModelTest (line 12) | class AutoModelTest(unittest.TestCase): method test_get_decoder_model (line 13) | def test_get_decoder_model(self): method test_get_unsupported_model (line 36) | def test_get_unsupported_model(self): FILE: tests/models/test_hf_decoder_model.py function make_gt_from_conversation_ids (line 286) | def make_gt_from_conversation_ids(conversation_ids): function make_gt_from_conversation_ids_batch (line 299) | def make_gt_from_conversation_ids_batch(batched_conversation_ids): class HFDecoderModelTest (line 309) | class HFDecoderModelTest(unittest.TestCase): method _test_tokenize (line 311) | def _test_tokenize( method test_tokenize_text_only (line 341) | def test_tokenize_text_only(self): method test_tokenize_text_only_multiple (line 363) | def test_tokenize_text_only_multiple(self): method test_tokenize_text2text (line 384) | def test_tokenize_text2text(self): method test_tokenize_conversation (line 407) | def test_tokenize_conversation(self): method test_tokenize_conversation_multiple (line 512) | def test_tokenize_conversation_multiple(self): method test_encode (line 629) | def test_encode(self): method test_decode (line 640) | def test_decode(self): method test_inference (line 651) | def test_inference(self): FILE: tests/models/test_tool_inferencer.py class ToolInferencerTest (line 15) | class ToolInferencerTest(unittest.TestCase): method set_up (line 16) | def set_up(self): method test_code_exec_1 (line 22) | def test_code_exec_1(self, code=CODE_1, expected_output=RES_1): method test_code_exec_2 (line 26) | def test_code_exec_2(self, code=CODE_2): FILE: tests/pipeline/test_auto_pipeline.py class AutoPipelineTest (line 12) | class AutoPipelineTest(unittest.TestCase): method test_get_evaluator_pipeline (line 13) | def test_get_evaluator_pipeline(self): method test_get_finetuner_pipeline (line 21) | def test_get_finetuner_pipeline(self): method test_get_inferencer_pipeline (line 29) | def test_get_inferencer_pipeline(self): method test_get_unsupported_pipeline (line 37) | def test_get_unsupported_pipeline(self): FILE: tests/pipeline/test_finetuner_distributed_loss.py class AccelerateBackend (line 123) | class AccelerateBackend(Enum): class DeepSpeedZeroStage (line 128) | class DeepSpeedZeroStage(Enum): class PeftMethod (line 132) | class PeftMethod(Enum): class TestDtype (line 139) | class TestDtype(Enum): class TestFinetunerBase (line 158) | class TestFinetunerBase(TestCasePlus): method setUp (line 161) | def setUp(self): method _make_cmd (line 167) | def _make_cmd(self, run_name: str, args: list[list[str]]) -> list[str]: method _log_std (line 185) | def _log_std(self, res: _RunOutput): method _load_trainer_state (line 194) | def _load_trainer_state(self, output_dir: str) -> dict: method _run_with_accelerate (line 199) | def _run_with_accelerate( method _run_with_deepspeed (line 234) | def _run_with_deepspeed( method _compare_loss (line 269) | def _compare_loss(self, trainer_state1: dict, trainer_state2: dict): method test_loss_accelerate_dsz3_vs_fsdp (line 285) | def test_loss_accelerate_dsz3_vs_fsdp(self): method test_loss_deepspeed_z3_vs_accelerate_dsz3 (line 298) | def test_loss_deepspeed_z3_vs_accelerate_dsz3(self): class TestFinetunerLora (line 308) | class TestFinetunerLora(TestFinetunerBase): method test_loss_accelerate_dsz3_vs_fsdp (line 313) | def test_loss_accelerate_dsz3_vs_fsdp(self): method test_loss_deepspeed_z3_vs_accelerate_dsz3 (line 330) | def test_loss_deepspeed_z3_vs_accelerate_dsz3(self): class TestFinetunerQlora (line 344) | class TestFinetunerQlora(TestFinetunerBase): method test_loss_accelerate_dsz3_vs_fsdp (line 351) | def test_loss_accelerate_dsz3_vs_fsdp(self): method test_loss_deepspeed_z3_vs_accelerate_dsz3 (line 370) | def test_loss_deepspeed_z3_vs_accelerate_dsz3(self): class TestFinetunerCustomOptim (line 386) | class TestFinetunerCustomOptim(TestFinetunerBase): method test_loss_accelerate_dsz3_vs_fsdp (line 391) | def test_loss_accelerate_dsz3_vs_fsdp(self): method test_loss_deepspeed_z3_vs_accelerate_dsz3 (line 404) | def test_loss_deepspeed_z3_vs_accelerate_dsz3(self): FILE: tests/pipeline/test_memory_safe_vllm_inferencer.py class MemorySafeVLLMInferencerTest (line 40) | class MemorySafeVLLMInferencerTest: method test_init (line 41) | def test_init(self): method test_inference (line 51) | def test_inference(self): method test_inference_detokenize (line 64) | def test_inference_detokenize(self): method summary (line 82) | def summary(self): FILE: tests/pipeline/test_sglang_infernecer.py function sglang_test_model_args (line 14) | def sglang_test_model_args() -> ModelArguments: function sglang_test_inferencer_args (line 19) | def sglang_test_inferencer_args() -> InferencerArguments: function test_sglang_inferencer (line 30) | def test_sglang_inferencer( FILE: tests/utils/test_conversation_formatter.py class StringFormatterTest (line 6) | class StringFormatterTest(unittest.TestCase): method test_format_string_component (line 7) | def test_format_string_component(self): FILE: tests/utils/test_conversation_template.py class EmptyConversationTemplateTest (line 103) | class EmptyConversationTemplateTest(unittest.TestCase): method setUp (line 104) | def setUp(self): method test_encode_conversation_singleturn_llama2 (line 109) | def test_encode_conversation_singleturn_llama2(self): method test_encode_conversation_multiturn_llama2 (line 115) | def test_encode_conversation_multiturn_llama2(self): class Llama2ConversationTemplateTest (line 122) | class Llama2ConversationTemplateTest(unittest.TestCase): method setUp (line 123) | def setUp(self): method test_encode_conversation_singleturn (line 128) | def test_encode_conversation_singleturn(self): method test_encode_conversation_multiturn (line 137) | def test_encode_conversation_multiturn(self): class Qwen2ConversationTemplateTest (line 147) | class Qwen2ConversationTemplateTest(unittest.TestCase): method setUp (line 148) | def setUp(self): method test_encode_conversation_singleturn (line 153) | def test_encode_conversation_singleturn(self): method test_encode_conversation_multiturn (line 162) | def test_encode_conversation_multiturn(self): FILE: tests/utils/test_data_utils.py class DataUtilsTest (line 56) | class DataUtilsTest(unittest.TestCase): method test_load_data (line 57) | def test_load_data(self): method test_batchlize (line 70) | def test_batchlize(self): method test_answer_extraction (line 80) | def test_answer_extraction(self):