Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to test a finetuned model on custom dataset? #82

Open
songgaojundeng opened this issue Jul 9, 2024 · 4 comments
Open

How to test a finetuned model on custom dataset? #82

songgaojundeng opened this issue Jul 9, 2024 · 4 comments

Comments

@songgaojundeng
Copy link

songgaojundeng commented Jul 9, 2024

My findtuned model based on moirai_1.0_R_small was saved in outputs/finetune/moirai_1.0_R_small folder. I wonder how can I use/load this fine-tuned model for evaluation.

Could you provide more examples/explanations on it? Thank you.

@gorold
Copy link
Contributor

gorold commented Jul 12, 2024

@dany4142
Copy link

Hi @gorold,

I'm having a couple of issues with the model fine-tuning and loading process:

  1. After fine-tuning the model and saving it in the directory specified above, I'm not seeing a .ckpt file that I can load. Could you please clarify the expected output files after the fine-tuning step?

  2. Assuming I have the correct saved files from the fine-tuning process, how do I load the fine-tuned model checkpoint so that I can use it to make predictions on a pandas DataFrame? I want to ensure I'm loading the model properly so I can test its performance on new data.

Any guidance you can provide on these two points would be greatly appreciated. Let me know if you need any additional information from me.

Thanks!

@songgaojundeng
Copy link
Author

@dany4142 Hey check your default.yaml under finetune folder.

callbacks:
    - _target_: lightning.pytorch.callbacks.LearningRateMonitor
      logging_interval: epoch
    - _target_: lightning.pytorch.callbacks.ModelCheckpoint
      dirpath: ${hydra:runtime.output_dir}/checkpoints
      monitor: val/PackedNLLLoss
      save_weights_only: true
      mode: min
      save_top_k: 1
      every_n_epochs: 1

Maybe you didn't set the validation set properly or maybe the val/PackedNLLLoss so you did not save any checkpoint. Also check the warning.

@songgaojundeng
Copy link
Author

@linyuan13 Hey I tested it in notebook, which looks like:

if finetune:
            model = MoiraiForecast.load_from_checkpoint(f"..some path/example_run/checkpoints/epoch=4-step=250.ckpt",local_files_only=True,
                prediction_length=dim_outputseqlen,
                context_length=dim_inputseqlen,
                patch_size=PSZ,
                num_samples=1000,
                target_dim=1,
                feat_dynamic_real_dim=ds.num_feat_dynamic_real,
                past_feat_dynamic_real_dim=ds.num_past_feat_dynamic_real,
            )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants