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

Confusing warning when using GANs that suggests that CUDA isn't being used #2052

Closed
srinify opened this issue Jun 11, 2024 · 0 comments · Fixed by #2155
Closed

Confusing warning when using GANs that suggests that CUDA isn't being used #2052

srinify opened this issue Jun 11, 2024 · 0 comments · Fixed by #2155
Assignees
Labels
bug Something isn't working feature: modeling Related to training the model itself
Milestone

Comments

@srinify
Copy link
Contributor

srinify commented Jun 11, 2024

Environment Details

  • SDV version: 1.13
  • Python version: 3.10.12
  • Operating System: Colab (using T4 GPU)

Warning

If you try to fit CTGANSynthesizer or CopulaGANSynthesizer in Google Colab with a T4 (GPU) runtime, the following warning is displayed the first time only:

/usr/local/lib/python3.10/dist-packages/torch/autograd/graph.py:744: UserWarning: Attempting to run cuBLAS, but there was no current CUDA context! Attempting to set the primary context... (Triggered internally at ../aten/src/ATen/cuda/CublasHandlePool.cpp:135.)
  return Variable._execution_engine.run_backward(  # Calls into the C++ engine to run the backward pass
  • We've ruled out CUDA not being available by running torch.cuda.is_available(), which returns True.
  • This warning might be displayed because the CUDA state / context isn't initialized. But we do end up initializing the CUDA context in our code somewhere (which is why running it twice doesn't throw this warning).

So the warning is technically true, but is confusing to users because they may think that the GPU isn't being used.

Steps to reproduce

To reproduce warning, change the Colab runtime to T4 (Runtime > Change runtime type, from Colab menu bar) then run this code:

from sdv.datasets.demo import download_demo
from sdv.single_table import CTGANSynthesizer

data, metadata = download_demo(
    modality='single_table',
    dataset_name='fake_hotel_guests'
)

c = CTGANSynthesizer(metadata, cuda=True)
c.fit(data)

To reproduce CopulaGANSynthesizer, delete / restart your runtime:

from sdv.datasets.demo import download_demo
from sdv.single_table import CopulaGANynthesizer

data, metadata = download_demo(
    modality='single_table',
    dataset_name='fake_hotel_guests'
)

c = CopulaGANynthesizer(metadata, cuda=True)
c.fit(data)

Internal Colab Notebook

@srinify srinify added bug Something isn't working feature: modeling Related to training the model itself labels Jun 11, 2024
@srinify srinify changed the title UserWarning when using CTGAN caused by potentially uninitialized CUDA context UserWarning when using CTGAN is confusing Jun 11, 2024
@srinify srinify changed the title UserWarning when using CTGAN is confusing Confusing warning raised when using CTGAN suggests that CUDA isn't being used Jun 11, 2024
@srinify srinify changed the title Confusing warning raised when using CTGAN suggests that CUDA isn't being used Confusing warning raised when using CTGAN or CopulaGAN suggests that CUDA isn't being used Jun 11, 2024
@srinify srinify changed the title Confusing warning raised when using CTGAN or CopulaGAN suggests that CUDA isn't being used Confusing warning raised when using GANs that suggests that CUDA isn't being used Jun 11, 2024
@srinify srinify changed the title Confusing warning raised when using GANs that suggests that CUDA isn't being used Confusing warning when using GANs that suggests that CUDA isn't being used Jun 11, 2024
@amontanez24 amontanez24 added this to the 1.15.1 milestone Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: modeling Related to training the model itself
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants