Open guixermo opened 4 years ago
I had the same issue when I run it on local. Then I fixed it by running it on Sagemaker. The differences I found:
pytorch version was 1.5 on local, but 1.4 on cloud. You can check version:
import torch
print(torch.__version__)
I did not use GPU on local, but "by default it will provision a SageMaker notebook instance of type ml.p2.xlarge which has the Nvidia K80 GPU and 50 GB of EBS disk space".
You can check if your pytorch is using GPU:
torch.cuda.is_available()
I will suggest you try to run the lesson on cloud since the environment is set up for you.
I had the same issue when I run it on local. Then I fixed it by running it on Sagemaker. The differences I found:
- pytorch version was 1.5 on local, but 1.4 on cloud. You can check version:
import torch print(torch.__version__)
- I did not use GPU on local, but "by default it will provision a SageMaker notebook instance of type ml.p2.xlarge which has the Nvidia K80 GPU and 50 GB of EBS disk space".
You can check if your pytorch is using GPU:
torch.cuda.is_available()
I will suggest you try to run the lesson on cloud since the environment is set up for you.
Thank you for your advice. I'm working on colab and the pytorch version was 1.5. I downgraded to 1.4.0 as weell as torchvision to 0.5.0. Now it works.
You can look your version with:
import torch print(torch.version)
I downgraded with:
!pip install torch==1.4.0
Then restart and installed torchvision with
!pip install torchvision==0.5.0
I had the same issue when I run it on local. Then I fixed it by running it on Sagemaker. The differences I found:
- pytorch version was 1.5 on local, but 1.4 on cloud. You can check version:
import torch print(torch.__version__)
- I did not use GPU on local, but "by default it will provision a SageMaker notebook instance of type ml.p2.xlarge which has the Nvidia K80 GPU and 50 GB of EBS disk space".
You can check if your pytorch is using GPU:
torch.cuda.is_available()
I will suggest you try to run the lesson on cloud since the environment is set up for you.
Thank you for your advice. I'm working on colab and the pytorch version was 1.5. I downgraded to 1.4.0 as weell as torchvision to 0.5.0. Now it works.
You can look your version with:
import torch print(torch.version)
I downgraded with:
pip install torch==1.4.0
Then restart and installed torchvision withpip install torchvision==0.5.0
This works for me too. Thanks!
I received the error with pyTorch on my local system and solved the issue by using (float) with the train data after looking it up on StackOverFlow. Is it a requirement in the latest pyTorch version ?
I received the error with pyTorch on my local system and solved the issue by using (float) with the train data after looking it up on StackOverFlow. Is it a requirement in the latest pyTorch version ?
How did you solve it? I tried using float but it didnt work for me so i created this issue.
With only torch on colab to train a model I used type conversion while passing the feature data tensor to the model. I couldn't solve the issue with fast.ai with the latest version as well. So I think this is a requirement in the latest version
Great, thanks. I've chaged from colab to local and with 1.5.0 it only gives me a warning but it works so maybe is just colab.
@guixermo @someshwarrc Can you give us some code? How would you modify the course notebook?
@guixermo @someshwarrc Can you give us some code? How would you modify the course notebook?
You dont have to modify it, you just need to downgrade the pytorch and torchvision versions with the comands i wrote above.
Well that’s not what I call a solution.
Thanks for your reply.
getting error while trying to transform the images to 224 size
`--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) /usr/local/lib/python3.6/dist-packages/fastai/data_block.py in _check_kwargs(ds, tfms, kwargs) 593 x = ds[0] --> 594 try: x.apply_tfms(tfms, kwargs) 595 except Exception as e:
11 frames /usr/local/lib/python3.6/dist-packages/fastai/vision/image.py in apply_tfms(self, tfms, do_resolve, xtra, size, resize_method, mult, padding_mode, mode, remove_out) 122 x = tfm(x, size=_get_crop_target(size,mult=mult), padding_mode=padding_mode) --> 123 else: x = tfm(x) 124 return x.refresh()
/usr/local/lib/python3.6/dist-packages/fastai/vision/image.py in call(self, x, *args, *kwargs) 523 "Randomly execute our tfm on
x
." --> 524 return self.tfm(x, args, {self.resolved, **kwargs}) if self.do_run else x 525/usr/local/lib/python3.6/dist-packages/fastai/vision/image.py in call(self, p, is_random, use_on_y, *args, *kwargs) 469 "Calc now if
args
passed; else create a transform called probp
ifrandom
." --> 470 if args: return self.calc(args, **kwargs) 471 else: return RandTransform(self, kwargs=kwargs, is_random=is_random, use_on_y=use_on_y, p=p)/usr/local/lib/python3.6/dist-packages/fastai/vision/image.py in calc(self, x, *args, kwargs) 474 "Apply to image
x
, wrapping it if necessary." --> 475 if self._wrap: return getattr(x, self._wrap)(self.func, *args, *kwargs) 476 else: return self.func(x, args, kwargs)/usr/local/lib/python3.6/dist-packages/fastai/vision/image.py in affine(self, func, *args, *kwargs) 182 m = tensor(func(args, **kwargs)).to(self.device) --> 183 self.affine_mat = self.affine_mat @ m 184 return self
RuntimeError: Expected object of scalar type Float but got scalar type Double for argument #3 'mat2' in call to _th_addmm_out
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)