Hi everyone .
I’m new to Pytorch and I’m trying to figure out a few things right now .
I have the following components :
...:
`__Python VERSION: 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
__pyTorch VERSION: 1.2.0+cu92
__CUDA VERSION
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Tue_Jun_12_23:08:12_Central_Daylight_Time_2018
Cuda compilation tools, release 9.2, V9.2.148
__CUDNN VERSION: 7201
__Number CUDA Devices: 1
__Devices
Active CUDA Device: GPU 0
Available devices 1
Current cuda device 0``
I’m using the following hardware and software :
Z440 G4
16GB RAM
NVIDIA QUADRO RTX 4000 (CUDA supported)
Windows server 2012r2
Anaconda 3.5.2 - Python 3.6.5 ( I need that specific version) .
- After the installation of all the components I needed I searched for a training example just to make sure Pytorch is working . I executed the following :
`import torch
import torch.optim as optim
model = torch.nn.Linear(5, 2)
Initialize optimizer
optimizer = optim.SGD(model.parameters(), lr=0.001, momentum=0.9)
print("Model's state_dict:")
for param_tensor in model.state_dict():
print(param_tensor, "\t", model.state_dict()[param_tensor].size())
print("Model weight:")
print(model.weight)
print("Model bias:")
print(model.bias)
print("---")
print("Optimizer's state_dict:")
for var_name in optimizer.state_dict():
print(var_name, "\t", optimizer.state_dict()[var_name])``
And got the following output
Model's state_dict:
weight torch.Size([2, 5])
bias torch.Size([2])
Model weight:
Parameter containing:
tensor([[-0.1759, -0.2537, 0.1401, 0.2342, -0.3865],
[-0.2142, 0.2763, -0.2919, 0.2003, -0.3242]], requires_grad=True)
Model bias:
Parameter containing:
tensor([-0.0585, 0.2511], requires_grad=True)
---
Optimizer's state_dict:
state {}
param_groups [{'lr': 0.001, 'momentum': 0.9, 'dampening': 0, 'weight_decay': 0, 'nesterov': False, 'params': [935863832152, 9358638
31360]}]
Next I have saved it by using :
torch.save(model.state_dict(), "temp.pt")
So far it seems OK to me . Anything else I can / Should check in addition ?
2 . How can I check in real time that my GPU is working ? I want to make sure PYTORCH is using the GPU and not the CPU . Anything I can check ? Saved log file maybe ?
Appreciate your help .
Please let me know if any information is needed .