-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: expected scalar type Long but found Int #1989
Comments
This should have been fixed (#1954) in the 0.21.3 release. Can you make sure you're using the latest version of Raster Vision? |
yes ,i run the pip list and check the Raster Vision, it is 0.21.3 |
That's strange. Please share your code. |
I run the train.ipynb,and change the train_image_uri 、train_label_uri、val_image_uri、val_label_uri as my local data path and get the error,and my torch is 2.1.0+cu121 |
I am not able to reproduce the error using version 0.21.3 and running the code in |
I ran into this issue as well and found that, in my dataset, adding an albumentations transform like |
Same issue without change the URLs. |
How to add transfom,can you share you code snipe?thanks |
See this discussion for an example |
I change the OS to ubuntu 22.04,and no issue happen,it works well. |
f:\raster-vision\docs\usage\tutorials\train.ipynb cell 41 line 1
----> 1 learner.train(epochs=3)
File d:\Python310\lib\site-packages\rastervision\pytorch_learner\learner.py:391, in Learner.train(self, epochs)
389 for epoch in range(start_epoch, end_epoch):
390 log.info(f'epoch: {epoch}')
--> 391 train_metrics = self.train_epoch(
392 optimizer=self.opt, step_scheduler=self.step_scheduler)
393 if self.epoch_scheduler:
394 self.epoch_scheduler.step()
File d:\Python310\lib\site-packages\rastervision\pytorch_learner\learner.py:415, in Learner.train_epoch(self, optimizer, step_scheduler)
413 batch = (x, y)
414 optimizer.zero_grad()
--> 415 output = self.train_step(batch, batch_ind)
416 output['train_loss'].backward()
417 optimizer.step()
File d:\Python310\lib\site-packages\rastervision\pytorch_learner\semantic_segmentation_learner.py:30, in SemanticSegmentationLearner.train_step(self, batch, batch_ind)
28 x, y = batch
29 out = self.post_forward(self.model(x))
---> 30 return {'train_loss': self.loss(out, y).long()}
...
3051 if size_average is not None or reduce is not None:
3052 reduction = _Reduction.legacy_get_string(size_average, reduce)
-> 3053 return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
RuntimeError: expected scalar type Long but found Int
The text was updated successfully, but these errors were encountered: