Can't get to run torchnlp.ner properly
See original GitHub issueThis is the result I get when following installation and running instructions:
>>> train('ner-conll2003', TransformerTagger, conll2003)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "torchnlp/tasks/sequence_tagging/main.py", line 46, in train
dataset = dataset_fn()
File "torchnlp/data/conll.py", line 67, in conll2003_dataset
fields=tuple(fields))
File "/usr/local/lib/python2.7/dist-packages/torchtext/data/dataset.py", line 78, in splits
os.path.join(path, train), **kwargs)
File "/usr/local/lib/python2.7/dist-packages/torchtext/datasets/sequence_tagging.py", line 33, in __init__
examples.append(data.Example.fromlist(columns, fields))
File "/usr/local/lib/python2.7/dist-packages/torchtext/data/example.py", line 50, in fromlist
setattr(ex, n, f.preprocess(val))
File "/usr/local/lib/python2.7/dist-packages/torchtext/data/field.py", line 181, in preprocess
x = Pipeline(six.text_type.lower)(x)
File "/usr/local/lib/python2.7/dist-packages/torchtext/data/pipeline.py", line 37, in __call__
x = pipe.call(x, *args)
File "/usr/local/lib/python2.7/dist-packages/torchtext/data/pipeline.py", line 52, in call
return [self.convert_token(tok, *args) for tok in x]
TypeError: descriptor 'lower' requires a 'unicode' object but received a 'str'
Took conll2003 dataset files from THIS REPO
ENV:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
--------------------------------
torch.__version__: 0.4.1
torchtext.__version__: 0.3.1
--------------------------------
python: 2.7.12
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
kolloldas/torchnlp: Easy to use NLP library built on ... - GitHub
Go to file ... TorchNLP is a deep learning library for NLP tasks. ... The NER task can be run on any dataset...
Read more >Basic Utilities for PyTorch Natural Language Processing for ...
PyTorch-NLP, or torchnlp for short, is a library of basic utilities for PyTorch NLP. torchnlp extends PyTorch to provide you with basic text...
Read more >torchnlp.nn package — PyTorch-NLP 0.5.0 documentation
The neural network nn package torchnlp.nn introduces a set of torch.nn. ... We need this because we can't do shape inference in pytorch,...
Read more >Can't install pytorch with pip on Windows - Stack Overflow
I tried multiple solutions and it wasn't working on Windows 10 until I tried this: pip install torch==1.5.0+cpu -f ...
Read more >PyTorch Tutorials 1.13.1+cu117 documentation
Access PyTorch Tutorials from GitHub. Go To GitHub. Run Tutorials on Google Colab. Learn how to copy tutorial data into Google Drive so...
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 FreeTop 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
Top GitHub Comments
@Alexmac22347 that did the trick. @kolloldas Made a docker with necessary locale settings based on pytorch v0.4.1 runtime docker.
@aleksas Ive ran into the same unicode error. Might be a bit of a hack, running
export LC_CTYPE=en_US.UTF-8
fixed it for me. https://stackoverflow.com/questions/18649512/unicodedecodeerror-ascii-codec-cant-decode-byte-0xe2-in-position-13-ordinal Let me know if that works/doesnt work