TypeError: 'generator' object is not callable
See original GitHub issueI’m getting the exception TypeError: ‘generator’ object is not callable when I train with multiple GPU’s
I’m not sure where it’s coming from, my datasets are subclasses of torchtext.data.Dataset and the data loaders are torchtext.data.BucketIterator.
What’s the easiest way of identifying what’s causing the exception?
# create trainer
mlflow = loggers.MLFlowLogger("Transformer")
trainer = pl.Trainer.from_argparse_args(args, early_stop_callback=True, min_epochs=10, logger=mlflow, gpus=[0,1])
# prepare data
train_dataset, val_dataset = load_datasets(path=args.path, files=args.files)
train_loader, val_loader = create_dataloaders(train_dataset, val_dataset, batch_size=args.batch_size)
# init the model
hparams = vars(args)
transformer = Transformer(src_vocab=train_dataset.vocab, tgt_vocab=val_dataset.vocab, **hparams)
# train
trainer.fit(transformer, train_loader, val_dataloaders=val_loader)
transformer.freeze()
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
TypeError: 'generator' object is not callable - Stack Overflow
A parameter passed to the somefun function is then bound to the local lengen variable instead of lengths , to make it clear...
Read more >TypeError: 'generator' object is not callable #3379 - GitHub
I'm getting the exception TypeError: 'generator' object is not callable when I train with multiple GPU's I'm not sure where it's coming from ......
Read more >Generator Functions - Lazy Looping in Python
When the function is called, it returns a generator object. ... line 1, in <module> TypeError: 'generator' object is not callable >>> c[0]...
Read more >Generator object not callable (sorry about the messy code)
I cant figure out how to use yield to return from a while-loop without breaking from the function. Is there anything i'm missing...
Read more >Error occured when using sidebar - Streamlit
... and when it comes to sidebar, it suddenly can not work ,the error is TypeError: 'DeltaGenerator' object is not callable.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@awaelchli mind taking a look?
@awaelchli thanks for looking. I need to refactor this anyway since as I mentioned
torchtext
has started to deprecate their DataLoader / Dataset in place of thetorch
equivalents. I’ve been putting it off since they’ve not yet provided a migration path for custom datasets (frustratingly they seem to be focusing on migrating the built-in datasets using private pipeline methods - I feel they should have created a migration pathway first and then used it to migrate their datasets).@mateuszpieniak any pointers would be useful - I need to add ‘<sos>’ and ‘<eos>’ tokens to each example and then pad each batch. Ideally, by using high-performance code someone has already thoroughly tested