Skip to content

retrieve training parameters from a lora model? #1733

Closed as not planned
Closed as not planned

Description

@ep0p

Hello,

I've fine-tuned Llama3.2 several times, and one model in particular—the very first one I trained—performs the best. Since it was my first attempt while I was exploring unsloth, I can't seem to recall the training parameters (like batch size, number of epochs, etc.) that I used for this model.

I've checked the LoRA model files, but there doesn't appear to be any metadata or documentation regarding the training setup.

Is there any way to extract or recover these details from the model itself?

Activity

  1. danielhanchen commented on Feb 23, 2025

    @danielhanchen
    Member

    Unfortunately not :( I could in theory save them inside the LoRA weights, but unsure if that's a good idea, since it exposes training dynamics - would that be helpful?

    Unfortunately for your case, I don't see a way sorry!

  2. ep0p commented on Feb 24, 2025

    @ep0p
    Author

    @danielhanchen No problem, thanks a lot for the answer.

    in the end i re-did the training and stumbled upon this issue 1756
    I don't understand where the problem could be.
    I have double checked all the steps, there is no error during fine-tunning process, and my parameters look like this:

    model, tokenizer = FastVisionModel.from_pretrained(
        "unsloth/Llama-3.2-11B-Vision-Instruct",
        load_in_4bit = True,
        use_gradient_checkpointing = "unsloth",
    )
    
    model = FastVisionModel.get_peft_model(
        model,
        finetune_vision_layers     = True,
        finetune_language_layers   = True,
        finetune_attention_modules = True,
        finetune_mlp_modules      = True,
        r = 16,
        lora_alpha = 16,
        lora_dropout = 0,
        bias = "none",
        random_state = 3407,
        use_rslora = False,
        loftq_config = None,
    )
    
    with open("converted_dataset_merged.json", "r", encoding="utf-8") as f:
        dataset = json.load(f)
    
    
    FastVisionModel.for_training(model)
    
    trainer = SFTTrainer(
        model = model,
        tokenizer = tokenizer,
        data_collator = UnslothVisionDataCollator(model, tokenizer),
        train_dataset = dataset,
        args = SFTConfig(
            per_device_train_batch_size = 1,
            gradient_accumulation_steps = 4,
            warmup_steps = 5,
            #max_steps = 30,
            num_train_epochs = 1,
            learning_rate = 2e-4,
            fp16 = not is_bf16_supported(),
            bf16 = is_bf16_supported(),
            logging_steps = 1,
            optim = "adamw_8bit",
            weight_decay = 0.01,
            lr_scheduler_type = "linear",
            seed = 3407,
            output_dir = "outputs_merged",
            report_to = "none",
            remove_unused_columns = False,
            dataset_text_field = "",
            dataset_kwargs = {"skip_prepare_dataset": True},
            dataset_num_proc = 4,
            max_seq_length = 2048,
        ),
    )
    

    Also the loss is decreasing as you can see in the following file with the output of training process

    app_redo.txt

  3. danielhanchen commented on Oct 8, 2026

    @danielhanchen
    Member

    The final LoRA adapter only stores the LoRA config (rank, alpha, target modules in adapter_config.json), not the training hyperparameters. However, if your output_dir (by default outputs) still has any checkpoint-* folders from that run, each one contains training_args.bin and trainer_state.json, which hold the batch size, learning rate, epochs and the full loss history:

    import torch
    args = torch.load("outputs/checkpoint-60/training_args.bin", weights_only = False)
    print(args)

    For future runs it is worth also logging to a tracker (report_to = "wandb" or "tensorboard") so the settings are kept with the run. Closing since there is no way to recover them from the adapter weights alone, but feel free to reopen if you have other questions.

  4. self-assigned this
    on Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions