question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to properly fix random seed with TFT?

See original GitHub issue

Expected behavior

Hello guys I wonder how to fix seed to get reproducibility of my experiments

Right now I’m using this function before the start of the training pl.seed_everything(42)

Actual behavior

However, it doesn’t work. It is caused by dropout because when I set dropout = 0 it had worked.

# configure network and trainer
pl.seed_everything(42)
trainer = pl.Trainer(
    deterministic=True,
    gpus=[0],
    gradient_clip_val=0.1,
)


tft = TemporalFusionTransformer.from_dataset(
    training,
    learning_rate=0.03,
    hidden_size=128,
    attention_head_size=2,
    dropout=0.3,  
    hidden_continuous_size=32,  
    output_size=7,  
    loss=QuantileLoss(),
    reduce_on_plateau_patience=4,
)

trainer.fit(
    tft,
    train_dataloader=train_dataloader,
    val_dataloaders=val_dataloader,
)

So, how do I do to fix this issue?

Thanks,

This is my colab notebook.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
nessessencecommented, May 10, 2021

Hi, could you try this?: pl.seed_everything(42,workers=True)
// It works for me

0reactions
monkiravncommented, Mar 24, 2021

What about adding shuffle=False in to_dataloader()?

Hi Luming Sun, Thanks for your suggestion, I have tried but it hasn’t worked too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to properly fix random seed in pytorch-forecasting with ...
I wonder how to fix seed to get the reproducibility of my experiments. Right now I'm using this function before the start of...
Read more >
Properly Setting the Random Seed in ML Experiments
1. Use an Experiment tracking system such as Comet.ml. · 2. Define a single variable that contains a static random seed and use...
Read more >
How to Use Random Seeds Effectively | by Jai Bansal
If, as most people do, you set a random seed arbitrarily, your resulting data splits can vary drastically depending on your choice.
Read more >
Can anyone confirm if TFT uses random number generator or ...
I don't know exactly how it works, but there is definitely some kind of increased chance to hit synergies you have on the...
Read more >
Fixing random seed on inference - Cross Validated
I will be deploying models into production and I'm wondering whether it is appropriate to fix the random number generator seed at inference ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found