Skip to content

Add --device argument to run examples on a specific device #1288

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
add --device for siamese_network
  • Loading branch information
shink committed Sep 23, 2024
commit 61929977a6e1f3e3bd65b348fcbb3fb5699fb752
4 changes: 3 additions & 1 deletion siamese_network/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ def main():
help='disables CUDA training')
parser.add_argument('--no-mps', action='store_true', default=False,
help='disables macOS GPU training')
parser.add_argument('--device', type=str, default='cpu',
help='backend device')
parser.add_argument('--dry-run', action='store_true', default=False,
help='quickly check a single pass')
parser.add_argument('--seed', type=int, default=1, metavar='S',
Expand All @@ -271,7 +273,7 @@ def main():
elif use_mps:
device = torch.device("mps")
else:
device = torch.device("cpu")
device = torch.device(args.device)

train_kwargs = {'batch_size': args.batch_size}
test_kwargs = {'batch_size': args.test_batch_size}
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy