592c65341891ccadec31a624c4e6f062e8455723,allennlp/common/checks.py,,check_for_gpu,#Any#,103
Before Change
elif device_id is not None and device_id >= 0:
num_devices_available = cuda.device_count()
if num_devices_available == 0:
raise ConfigurationError(
"Experiment specified a GPU but none is available;"
" if you want to run on CPU use the override"
" "trainer.cuda_device=-1" in the json config file."
)
elif device_id >= num_devices_available:
raise ConfigurationError(
f"Experiment specified GPU device {device_id}"
f" but there are only {num_devices_available} devices "
After Change
except Exception as e:
torch_gpu_error = "\n{0}".format(e)
raise ConfigurationError(
"Experiment specified a GPU but none is available;"
" if you want to run on CPU use the override"
" "trainer.cuda_device=-1" in the json config file." + torch_gpu_error
)
elif device_id >= num_devices_available:
raise ConfigurationError(
f"Experiment specified GPU device {device_id}"
f" but there are only {num_devices_available} devices "
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: allenai/allennlp
Commit Name: 592c65341891ccadec31a624c4e6f062e8455723
Time: 2020-05-12
Author: MichaelS@allenai.org
File Name: allennlp/common/checks.py
Class Name:
Method Name: check_for_gpu
Project Name: allenai/allennlp
Commit Name: ca453c8b1186b4f346e70428c889a139ca21f794
Time: 2019-12-16
Author: markn@allenai.org
File Name: allennlp/models/biattentive_classification_network.py
Class Name: BiattentiveClassificationNetwork
Method Name: __init__
Project Name: jsalt18-sentence-repl/jiant
Commit Name: 164dd4dd3df73af90931d0dcc6ccab94956adc32
Time: 2018-04-08
Author: wang.alex.c@gmail.com
File Name: src/models.py
Class Name: HeadlessPairAttnEncoder
Method Name: __init__