Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2022
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.20 KB | None | 0 0
  1. ---------------------------------------------------------------------------
  2. RuntimeError Traceback (most recent call last)
  3. Cell In [19], line 1
  4. ----> 1 learn.fit(10, lr=0.1)
  5.  
  6. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:256, in Learner.fit(self, n_epoch, lr, wd, cbs, reset_opt, start_epoch)
  7. 254 self.opt.set_hypers(lr=self.lr if lr is None else lr)
  8. 255 self.n_epoch = n_epoch
  9. --> 256 self._with_events(self._do_fit, 'fit', CancelFitException, self._end_cleanup)
  10.  
  11. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:193, in Learner._with_events(self, f, event_type, ex, final)
  12. 192 def _with_events(self, f, event_type, ex, final=noop):
  13. --> 193 try: self(f'before_{event_type}'); f()
  14. 194 except ex: self(f'after_cancel_{event_type}')
  15. 195 self(f'after_{event_type}'); final()
  16.  
  17. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:245, in Learner._do_fit(self)
  18. 243 for epoch in range(self.n_epoch):
  19. 244 self.epoch=epoch
  20. --> 245 self._with_events(self._do_epoch, 'epoch', CancelEpochException)
  21.  
  22. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:193, in Learner._with_events(self, f, event_type, ex, final)
  23. 192 def _with_events(self, f, event_type, ex, final=noop):
  24. --> 193 try: self(f'before_{event_type}'); f()
  25. 194 except ex: self(f'after_cancel_{event_type}')
  26. 195 self(f'after_{event_type}'); final()
  27.  
  28. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:239, in Learner._do_epoch(self)
  29. 238 def _do_epoch(self):
  30. --> 239 self._do_epoch_train()
  31. 240 self._do_epoch_validate()
  32.  
  33. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:231, in Learner._do_epoch_train(self)
  34. 229 def _do_epoch_train(self):
  35. 230 self.dl = self.dls.train
  36. --> 231 self._with_events(self.all_batches, 'train', CancelTrainException)
  37.  
  38. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:193, in Learner._with_events(self, f, event_type, ex, final)
  39. 192 def _with_events(self, f, event_type, ex, final=noop):
  40. --> 193 try: self(f'before_{event_type}'); f()
  41. 194 except ex: self(f'after_cancel_{event_type}')
  42. 195 self(f'after_{event_type}'); final()
  43.  
  44. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:199, in Learner.all_batches(self)
  45. 197 def all_batches(self):
  46. 198 self.n_iter = len(self.dl)
  47. --> 199 for o in enumerate(self.dl): self.one_batch(*o)
  48.  
  49. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:227, in Learner.one_batch(self, i, b)
  50. 225 b = self._set_device(b)
  51. 226 self._split(b)
  52. --> 227 self._with_events(self._do_one_batch, 'batch', CancelBatchException)
  53.  
  54. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:193, in Learner._with_events(self, f, event_type, ex, final)
  55. 192 def _with_events(self, f, event_type, ex, final=noop):
  56. --> 193 try: self(f'before_{event_type}'); f()
  57. 194 except ex: self(f'after_cancel_{event_type}')
  58. 195 self(f'after_{event_type}'); final()
  59.  
  60. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\learner.py:208, in Learner._do_one_batch(self)
  61. 206 self('after_pred')
  62. 207 if len(self.yb):
  63. --> 208 self.loss_grad = self.loss_func(self.pred, *self.yb)
  64. 209 self.loss = self.loss_grad.clone()
  65. 210 self('after_loss')
  66.  
  67. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\losses.py:71, in CrossEntropyLossFlat.__init__(self, axis, *args, **kwargs)
  68. 65 @use_kwargs_dict(keep=True, weight=None, ignore_index=-100, reduction='mean')
  69. 66 def __init__(self,
  70. 67 *args,
  71. 68 axis:int=-1, # Class axis
  72. 69 **kwargs
  73. 70 ):
  74. ---> 71 super().__init__(nn.CrossEntropyLoss, *args, axis=axis, **kwargs)
  75.  
  76. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\losses.py:28, in BaseLoss.__init__(self, loss_cls, axis, flatten, floatify, is_2d, *args, **kwargs)
  77. 18 def __init__(self,
  78. 19 loss_cls, # Uninitialized PyTorch-compatible loss
  79. 20 *args,
  80. (...)
  81. 25 **kwargs
  82. 26 ):
  83. 27 store_attr("axis,flatten,floatify,is_2d")
  84. ---> 28 self.func = loss_cls(*args,**kwargs)
  85. 29 functools.update_wrapper(self, self.func)
  86.  
  87. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\nn\modules\loss.py:1159, in CrossEntropyLoss.__init__(self, weight, size_average, ignore_index, reduce, reduction, label_smoothing)
  88. 1157 def __init__(self, weight: Optional[Tensor] = None, size_average=None, ignore_index: int = -100,
  89. 1158 reduce=None, reduction: str = 'mean', label_smoothing: float = 0.0) -> None:
  90. -> 1159 super(CrossEntropyLoss, self).__init__(weight, size_average, reduce, reduction)
  91. 1160 self.ignore_index = ignore_index
  92. 1161 self.label_smoothing = label_smoothing
  93.  
  94. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\nn\modules\loss.py:25, in _WeightedLoss.__init__(self, weight, size_average, reduce, reduction)
  95. 24 def __init__(self, weight: Optional[Tensor] = None, size_average=None, reduce=None, reduction: str = 'mean') -> None:
  96. ---> 25 super(_WeightedLoss, self).__init__(size_average, reduce, reduction)
  97. 26 self.register_buffer('weight', weight)
  98. 27 self.weight: Optional[Tensor]
  99.  
  100. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\nn\modules\loss.py:18, in _Loss.__init__(self, size_average, reduce, reduction)
  101. 16 super(_Loss, self).__init__()
  102. 17 if size_average is not None or reduce is not None:
  103. ---> 18 self.reduction: str = _Reduction.legacy_get_string(size_average, reduce)
  104. 19 else:
  105. 20 self.reduction = reduction
  106.  
  107. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\nn\_reduction.py:35, in legacy_get_string(size_average, reduce, emit_warning)
  108. 32 if reduce is None:
  109. 33 reduce = True
  110. ---> 35 if size_average and reduce:
  111. 36 ret = 'mean'
  112. 37 elif reduce:
  113.  
  114. RuntimeError: Boolean value of Tensor with more than one value is ambiguous
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement