[nbdev] how do i tell tests to not use this line after pushing to repo for "run tests"?

I’m using a certain GPU in development, and I have this code near the top of my notebook:

#hide
# torch.cuda.set_device(1)
# print(f'Using GPU #{torch.cuda.current_device()}: {torch.cuda.get_device_name()}')

Problem occurs when this gets pushed to github, during “Run Tests”. It tries to execute that code and there is no GPU #1 so it fails.

You should put a test flag #cuda at the top of the cell, then put cuda in your test flags in settings.ini (look at the fastai2 repo to check the syntax).

1 Like

Ah nice. I knew there would be a way! Thanks much