Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2022
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.08 KB | None | 0 0
  1. ---------------------------------------------------------------------------
  2. ValueError Traceback (most recent call last)
  3. Cell In [17], 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:54, in BaseLoss.__call__(self, inp, targ, **kwargs)
  68. 52 if targ.dtype in [torch.int8, torch.int16, torch.int32]: targ = targ.long()
  69. 53 if self.flatten: inp = inp.view(-1,inp.shape[-1]) if self.is_2d else inp.view(-1)
  70. ---> 54 return self.func.__call__(inp, targ.view(-1) if self.flatten else targ, **kwargs)
  71.  
  72. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\nn\modules\module.py:1130, in Module._call_impl(self, *input, **kwargs)
  73. 1126 # If we don't have any hooks, we want to skip the rest of the logic in
  74. 1127 # this function, and just call forward.
  75. 1128 if not (self._backward_hooks or self._forward_hooks or self._forward_pre_hooks or _global_backward_hooks
  76. 1129 or _global_forward_hooks or _global_forward_pre_hooks):
  77. -> 1130 return forward_call(*input, **kwargs)
  78. 1131 # Do not call functions when jit is used
  79. 1132 full_backward_hooks, non_full_backward_hooks = [], []
  80.  
  81. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\nn\modules\loss.py:1164, in CrossEntropyLoss.forward(self, input, target)
  82. 1163 def forward(self, input: Tensor, target: Tensor) -> Tensor:
  83. -> 1164 return F.cross_entropy(input, target, weight=self.weight,
  84. 1165 ignore_index=self.ignore_index, reduction=self.reduction,
  85. 1166 label_smoothing=self.label_smoothing)
  86.  
  87. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\nn\functional.py:3000, in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction, label_smoothing)
  88. 2934 r"""This criterion computes the cross entropy loss between input and target.
  89. 2935
  90. 2936 See :class:`~torch.nn.CrossEntropyLoss` for details.
  91. (...)
  92. 2997 >>> loss.backward()
  93. 2998 """
  94. 2999 if has_torch_function_variadic(input, target, weight):
  95. -> 3000 return handle_torch_function(
  96. 3001 cross_entropy,
  97. 3002 (input, target, weight),
  98. 3003 input,
  99. 3004 target,
  100. 3005 weight=weight,
  101. 3006 size_average=size_average,
  102. 3007 ignore_index=ignore_index,
  103. 3008 reduce=reduce,
  104. 3009 reduction=reduction,
  105. 3010 label_smoothing=label_smoothing,
  106. 3011 )
  107. 3012 if size_average is not None or reduce is not None:
  108. 3013 reduction = _Reduction.legacy_get_string(size_average, reduce)
  109.  
  110. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\overrides.py:1498, in handle_torch_function(public_api, relevant_args, *args, **kwargs)
  111. 1492 warnings.warn("Defining your `__torch_function__ as a plain method is deprecated and "
  112. 1493 "will be an error in future, please define it as a classmethod.",
  113. 1494 DeprecationWarning)
  114. 1496 # Use `public_api` instead of `implementation` so __torch_function__
  115. 1497 # implementations can do equality/identity comparisons.
  116. -> 1498 result = torch_func_method(public_api, types, args, kwargs)
  117. 1500 if result is not NotImplemented:
  118. 1501 return result
  119.  
  120. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\fastai\torch_core.py:376, in TensorBase.__torch_function__(cls, func, types, args, kwargs)
  121. 374 if cls.debug and func.__name__ not in ('__str__','__repr__'): print(func, types, args, kwargs)
  122. 375 if _torch_handled(args, cls._opt, func): types = (torch.Tensor,)
  123. --> 376 res = super().__torch_function__(func, types, args, ifnone(kwargs, {}))
  124. 377 dict_objs = _find_args(args) if args else _find_args(list(kwargs.values()))
  125. 378 if issubclass(type(res),TensorBase) and dict_objs: res.set_meta(dict_objs[0],as_copy=True)
  126.  
  127. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\_tensor.py:1121, in Tensor.__torch_function__(cls, func, types, args, kwargs)
  128. 1118 return NotImplemented
  129. 1120 with _C.DisableTorchFunction():
  130. -> 1121 ret = func(*args, **kwargs)
  131. 1122 if func in get_default_nowrap_functions():
  132. 1123 return ret
  133.  
  134. File c:\Users\teamt\miniconda3\envs\fastai\lib\site-packages\torch\nn\functional.py:3014, in cross_entropy(input, target, weight, size_average, ignore_index, reduce, reduction, label_smoothing)
  135. 3012 if size_average is not None or reduce is not None:
  136. 3013 reduction = _Reduction.legacy_get_string(size_average, reduce)
  137. -> 3014 return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
  138.  
  139. ValueError: Expected input batch_size (0) to match target batch_size (8).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement