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.

[BUG] Cannot process using GPU

See original GitHub issue

Describe the bug I have trained the model NBEATS for a week, things worked properly if I train the model on single run. However, when I need to do gridsearch on this model, Data have just loaded on GPU, but calculating on CPU only, so it is very slow. I run the code on Jupyter lab.

To Reproduce I trained data with normal random variable with some available correlation, and scaled using sklearn.StandardScaler()

train_y, val_y = train_test_split(y, test_size = 0.3)
train_x, val_x = train_test_split(X, test_size = 0.3)

train_y.shape
>>> (1400,1)
val_y.shape
>>>(600,1)
train_x.shape
>>> (1400,22)
val_x.shape
>>>(600,22)

params2 = {
  'input_chunk_length':[12,18],
  'output_chunk_length': [3],
  'generic_architecture': [True],
  'num_stacks': [2,4,6],
  'num_blocks' : [2,4,6],
  'num_layers' : [2,4,6], 
  'layer_widths': [22],
  'batch_size': [128],
  'random_state' : [0]
}

gs_test2 = NBEATSModel.gridsearch(
     params2, 
     series = train_y, 
     past_covariates = train_x, 
     verbose = True, 
     forecast_horizon = 12
)

Expected behavior Expected both loading and training data on GPU

System (please complete the following information):

  • Python version: 3.8.11
  • darts version: 0.12.0
  • cudatoolkit: 11.1.74
  • jupyterlab: 3.1.7
  • numpy: 1.19.5
  • pytorch: 1.8.2
  • scikit-learn: 0.23.2 Hard drive system
  • CPU: i7-8700
  • GPU: RTX-2070

Thank for your help!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
hrzncommented, Sep 1, 2022

You have to include the GPU config in the hyper-parameters grid of the gridsearch. Something like this:

hyper_params = {
  ...,
  'pl_trainer_kwargs': [{
      "accelerator": "gpu",
      "gpus": [0]
    }],
}

... = ModelClass.gridsearch(parameters=hyper_params, ...)
0reactions
smhomacommented, Sep 1, 2022

You have to include the GPU config in the hyper-parameters grid of the gridsearch. Something like this:

hyper_params = {
  ...,
  'pl_trainer_kwargs': [{
      "accelerator": "gpu",
      "gpus": [0]
    }],
}

... = ModelClass.gridsearch(parameters=hyper_params, ...)

It worked. thank you very much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

11 GB of GPU RAM used, and no process listed by nvidia-smi
In my GPU #0, 11341MiB of GPU RAM is used, and no process is listed by nvidia-smi. How is that possible, and how...
Read more >
gpu usage 100% most of the time or is it a bug?
I'm still on 517.40 (Studio) drivers, and I get GPU usage near 0% range with just a browser window open, and no motion...
Read more >
Client Server Runtime Process using 40-70% of GPU
Client Server Runtime Process using 40-70% of GPU · Method 1: Run Processor Monitor. · Method 2: Safe mode with Networking. · Method...
Read more >
GPU process crashes with high chance if you switch quickly ...
The GPU process crash is caused by GPU hang/reset detected by driver, not by Chrome. Could you open about:crashes and share with us...
Read more >
Troubleshoot Photoshop graphics processor (GPU) and ...
If the problem persists, continue troubleshooting by performing the GPU and ... If your GPU preference is disabled and you cannot enable it, ......
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