Skip to content

Instantly share code, notes, and snippets.

@manycoding
Created January 14, 2020 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manycoding/073caeaf9579d26ced2460f027325f77 to your computer and use it in GitHub Desktop.
Save manycoding/073caeaf9579d26ced2460f027325f77 to your computer and use it in GitHub Desktop.
colab fastai text
TypeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/fastai/basic_train.py in fit(epochs, learn, callbacks, metrics)
107 else: val_loss=None
--> 108 if cb_handler.on_epoch_end(val_loss): break
109 except Exception as e:
17 frames
/usr/local/lib/python3.6/dist-packages/fastai/callback.py in on_epoch_end(self, val_loss)
316 self.state_dict['last_metrics'] = [val_loss] if val_loss is not None else [None]
--> 317 self('epoch_end', call_mets = val_loss is not None)
318 self.state_dict['epoch'] += 1
/usr/local/lib/python3.6/dist-packages/fastai/callback.py in __call__(self, cb_name, call_mets, **kwargs)
250 for met in self.metrics: self._call_and_update(met, cb_name, **kwargs)
--> 251 for cb in self.callbacks: self._call_and_update(cb, cb_name, **kwargs)
252
/usr/local/lib/python3.6/dist-packages/fastai/callback.py in _call_and_update(self, cb, cb_name, **kwargs)
240 "Call `cb_name` on `cb` and update the inner state."
--> 241 new = ifnone(getattr(cb, f'on_{cb_name}')(**self.state_dict, **kwargs), dict())
242 for k,v in new.items():
/usr/local/lib/python3.6/dist-packages/fastai/callbacks/tracker.py in on_epoch_end(self, epoch, **kwargs)
96 current = self.get_monitor_value()
---> 97 if current is not None and self.operator(current, self.best):
98 print(f'Better model found at epoch {epoch} with {self.monitor} value: {current}.')
/usr/local/lib/python3.6/dist-packages/torch/tensor.py in __array__(self, dtype)
448 if dtype is None:
--> 449 return self.numpy()
450 else:
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment