Skip to content

can not fine-tuning after reload the model weights #168

@wubizhi

Description

@wubizhi
            n_bases=2
            softGBM = SoftGradientBoostingRegressor(
                estimator=MLP,
                n_estimators=n_bases,
                shrinkage_rate=1.00,
                cuda=True
            )

            io.load(softGBM, save_dir='./torch_ensemble_results/softGBM/')  # reload

            criterion = StepwiseMSELoss()
            softGBM.set_criterion(criterion)
            softGBM.set_optimizer('Adam', lr=0.001, weight_decay=5e-4)
            softGBM.set_scheduler("ReduceLROnPlateau")
            
            # Re-training
            softGBM.fit(train_loader=new_train_loader,
                             log_interval=128, 
                             epochs=20, 
                             test_loader=new_vali_loader,
                             save_model=True, 
                             save_dir='./torch_ensemble_results/softGBM/')

I want to know my code above can work or not? if i have just trained the model in 20 epoches, and reload the model weights for the longer epoches training? if it make sense, why it would report bug like below:

sKAN_softGBM.fit(train_loader=new_train_loader,

File "/home/WuBizhi/anaconda3/envs/torch-ensemble/lib/python3.9/site-packages/torchensemble/soft_gradient_boosting.py", line 514, in fit
super().fit(
File "/home/WuBizhi/anaconda3/envs/torch-ensemble/lib/python3.9/site-packages/torchensemble/soft_gradient_boosting.py", line 261, in fit
loss += criterion(output[idx], rets[idx])
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    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