Ray tune error -ERROR trial_runner.py:1450

username: saxenastar
cooked: <p>i am trying to find the HPO for rnn based model .this is a modular coding based project .complete code run in google colab after mounting the drive.for HPO ray tune is used but it gives an error .the code and error are given below:<br>
<em><strong>Code :</strong></em></p>
<p>def train_fnd(config):<br>
model_rnn.to(device)<br>
criterion = nn.BCELoss()<br>
optimizer = optim.SDG(model_rnn.parameters(),lr=config[“lr”])<br>
train_loader = dl.dataset(c.train_data_path,batch_size=config[“batch_size”])<br>
val_loader = dl.dataset(c.val_data_path,batch_size=config[“batch_size”])</p>
<p>for epoch in range(10):<br>
running_loss = 0.0<br>
epoch_step = 0<br>
for inputs,labels,inputs_len,_ in tqdm(train_loader):<br>
labels = torch.tensor(labels,dtype=torch.float32).view(-1,1)<br>
inputs = inputs.to(device)<br>
labels = labels.to(device)<br>
inputs_len = torch.IntTensor(inputs_len).to(device)</p>
<pre><code>  # zero the parameter gradients
  optimizer.zero_grad()

  # forward + backward + optimize
  outputs = model_rnn(inputs,inputs_len)
  loss = criterion(outputs,labels)
  loss.backward()
  optimizer.step()

  #print statistics
  running_loss +=loss.item()
  
#validation loss
val_loss = 0.0
val_steps =0
total = 0
correct =0
for inputs,labels,inputs_len,_ in tqdm(val_loader):
  with torch.no_grad():
    labels = torch.tensor(labels,dtype=torch.float32).view(-1,1)
    inputs = inputs.to(device)
    labels = labels.to(device)
    inputs_len = torch.IntTensor(inputs_len).to(device)

    outputs = model_rnn(inputs,inputs_len)
    loss = criterion(outputs,labels)

    val_loss +=loss.item()
print("training loss :",running_loss/len(train_loader))
print("validation loss :",val_loss/len(val_loader))
session.report({"loss":(val_loss/len(val_loader))})
</code></pre>
<p>print(“finished training”)</p>
<p>def test(model_rnn):<br>
test_loader =dl.dataset(data_path=c.test_data_path,batch_size=4)<br>
correct = 0<br>
total = 0<br>
test_loss =0<br>
criterion = nn.BCELoss()<br>
with torch.no_grad():<br>
for inputs,labels,inputs_len,_ in tqdm(test_loader):<br>
labels = torch.tensor(labels,dtype=torch.float32).view(-1,1)<br>
inputs = inputs.to(device)<br>
labels = labels.to(device)<br>
inputs_len = torch.IntTensor(inputs_len).to(device)<br>
outputs = model_rnn(inputs,inputs_len)<br>
loss = criterion(outputs,labels)</p>
<pre><code>  test_loss +=loss.item()
</code></pre>
<p>return test_loss/len(test_loader)</p>
<p>def main (num_samples = 10,max_num_epochs =10,gpus_per_trial = 2):<br>
config ={<br>
“lr”:tune.loguniform(1e-4,1e-1),<br>
“batch_size”:tune.choice([16,32,64])<br>
}<br>
scheduler = ASHAScheduler(<br>
max_t=max_num_epochs,<br>
grace_period=1,<br>
reduction_factor=2)<br>
tuner = tune.Tuner(<br>
tune.with_resources(<br>
tune.with_parameters(train_fnd),<br>
resources = {“cpu”:2, “gpu”: gpus_per_trial}<br>
),<br>
tune_config = tune.TuneConfig(<br>
metric=“loss”,<br>
mode=“min”,<br>
scheduler=scheduler,<br>
num_samples=num_samples,<br>
),<br>
param_space=config,<br>
)<br>
results = tuner.fit()<br>
best_result = results.get_best_result(“loss”,“min”)</p>
<p>main(num_samples=2, max_num_epochs=2, gpus_per_trial=0)</p>
<p><strong>Error :</strong><br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/c/4/c40052276d8489de3d4b50381ba67e9290e59079.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/c40052276d8489de3d4b50381ba67e9290e59079" title="e1"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/c/4/c40052276d8489de3d4b50381ba67e9290e59079_2_690x387.jpeg" alt="e1" data-base62-sha1="rXUgQEOwoso5v3nkh8RGFYnqe3D" width="690" height="387" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/c/4/c40052276d8489de3d4b50381ba67e9290e59079_2_690x387.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/c/4/c40052276d8489de3d4b50381ba67e9290e59079_2_1035x580.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/c/4/c40052276d8489de3d4b50381ba67e9290e59079.jpeg 2x" data-dominant-color="F2F2F2"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">e1</span><span class="informations">1366×768 310 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>plz help me</p>

username: saxenastar
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/9/8/98f9bf776ebb6da08d5096933dca992aa8a662f9.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/98f9bf776ebb6da08d5096933dca992aa8a662f9" title="e2"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/9/8/98f9bf776ebb6da08d5096933dca992aa8a662f9_2_690x387.jpeg" alt="e2" data-base62-sha1="lPhENa6sO9zArNCKhzUriESL1RT" width="690" height="387" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/9/8/98f9bf776ebb6da08d5096933dca992aa8a662f9_2_690x387.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/9/8/98f9bf776ebb6da08d5096933dca992aa8a662f9_2_1035x580.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/9/8/98f9bf776ebb6da08d5096933dca992aa8a662f9.jpeg 2x" data-dominant-color="F3F3F3"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">e2</span><span class="informations">1366×768 319 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

username: saxenastar
cooked: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/4/c/4ca03da68c753199e1a26b91346f84bd71e3efd1.jpeg" data-download-href="https://discuss.pytorch.org/uploads/default/4ca03da68c753199e1a26b91346f84bd71e3efd1" title="e3"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/4/c/4ca03da68c753199e1a26b91346f84bd71e3efd1_2_690x387.jpeg" alt="e3" data-base62-sha1="aVRBkBbRW2jjyxsKdYuZjgAGPjX" width="690" height="387" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/4/c/4ca03da68c753199e1a26b91346f84bd71e3efd1_2_690x387.jpeg, https://discuss.pytorch.org/uploads/default/optimized/3X/4/c/4ca03da68c753199e1a26b91346f84bd71e3efd1_2_1035x580.jpeg 1.5x, https://discuss.pytorch.org/uploads/default/original/3X/4/c/4ca03da68c753199e1a26b91346f84bd71e3efd1.jpeg 2x" data-dominant-color="F5F5F5"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">e3</span><span class="informations">1366×768 282 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

username: ptrblck
cooked: <p><code>No CUDA GPUs are available</code> indicates that your script or environment has trouble using any GPUs so run a few smoke tests and make sure your system is able to use these.</p>
<p>PS: you can post code snippets by wrapping them into three backticks ``` which makes debugging easier.</p>