-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import torch | ||
|
||
# Set this to "True" to force no repair | ||
FORCE_NO_REPAIR = False | ||
|
||
|
||
def check_if_torch_has_cuda(): | ||
"""Check if torch has CUDA available""" | ||
if FORCE_NO_REPAIR: | ||
print("Forcing no torch repair") | ||
return True | ||
try: | ||
if torch.cuda.is_available(): | ||
return True | ||
else: | ||
raise Exception("") | ||
except Exception as e: | ||
print("Torch does not have CUDA") | ||
print(e) | ||
exit(1) # set return code to 1 | ||
|
||
|
||
check_if_torch_has_cuda() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters