Comments (7)
How are you making your databunch?
from fastai_dev.
` def get_y_fun(input):
im_name = os.path.basename(input) # 'staffordshire_bull_terrier_54.jpg'
class_name = im_name[:im_name.rfind('_')]
return class_name
pets = DataBlock(blocks=(ImageBlock, CategoryBlock),
get_items=get_image_files,
splitter=RandomSplitter(),
get_y=get_y_fun)
dbunch = pets.databunch(untar_data(URLs.PETS) / "images", item_tfms=Resize(args.input_size),
batch_tfms=aug_transforms(), num_workers=args.num_workers)
`
btw, the regexpr
pat = r'/([^/]+)_\d+.jpg$'
is not cross platform
from fastai_dev.
I did some testing.
this happens in windows, but not in linux.
its a dataloader issue, nowhere in the datalodaer the targets are casted directly to int64
from fastai_dev.
Are you sure you are using PyTorch 1.3? The type-promotion should get rid of those errors. On Linux, I can do x==y
with a tensor of type Int and a tensor of type Long.
from fastai_dev.
The first error should be fixed now btw.
from fastai_dev.
@sgugger, thanks or the feedback.
Are you sure you are using PyTorch 1.3? The type-promotion should get rid of those errors. On Linux, I can do
x==y
with a tensor of type Int and a tensor of type Long.
i upgraded my pytorch to 1.3.1 (requirements are currently 1.2.0).
the first problem remains.
i will pull the latest version of fastaiV2 with your commit that fixes the label smoothing,
maybe it is better to explicitly convert the targets to int64 in the collate function?
it is a common practice in some repositories, for examples
https://github.com/NVIDIA/apex/blob/master/examples/imagenet/main_amp.py
def fast_collate(batch):
imgs = [img[0] for img in batch]
targets = torch.tensor([target[1] for target in batch], dtype=torch.int64)
from fastai_dev.
We don't want to automatically convert to int64 tensors for users because it takes twice the space in GPU memory and sometimes they don't need the int64.
I can't reproduce the error on windows with PyTorch 1.3.1. When asking for the accuracy between a tensor of type Int (int32) and a tensor of type Long (int64), I don't have any error.
from fastai_dev.
Related Issues (20)
- Found a bug in dev/local/vision/augment.py HOT 1
- Is there a way to select different loss functions for different targets? HOT 2
- Fastai2 Lesson One Import Problem HOT 5
- Possible regression when declaring a SequentialRNN
- Passing Pipeline to item_tfms causes 'TypeError: '<' not supported between instances of 'L' and 'int'' HOT 2
- Colab Specific: RuntimeError: inverse_cuda: For batch 0: U(17437184,17437184) is zero, singular U. HOT 3
- skip_start argument of the plot_loss Recorder method only affects train loss HOT 2
- skimage missing in README HOT 2
- Error on pip install git+https://github.com/fastai/fastai_dev on Kaggle HOT 2
- 'pip install git+https://github.com/fastai/fastai_dev' doen't work HOT 1
- Can't import fastai2 on 11/23/2019 HOT 1
- 'from fastai2.torch_basics import * ' problem(ModuleNotFoundError) on the Kaggle platform HOT 3
- ImageDataBunch is not found HOT 3
- DataSource error message
- Remove references to `Dataset`
- Keep-Alive-Actions
- Keep-Alive-Actions
- Keep-Alive-Actions
- get_class_mAP function not working if databunch is created from labellist on MIDOG 2021 dataset
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastai_dev.