Skip to content

Commit

Permalink
[minor] use fp32 when generate on CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanrui-Wang committed Nov 10, 2020
1 parent d5e13d0 commit c8d6d71
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def main(args):
print(args)

use_cuda = torch.cuda.is_available() and not args.cpu

# when running on CPU, use fp32 as default
if not use_cuda:
args.fp16 = False

# Load dataset splits
task = tasks.setup_task(args)
Expand Down

0 comments on commit c8d6d71

Please sign in to comment.