question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't get to run torchnlp.ner properly

See original GitHub issue

This 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:closed
  • Created 5 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
aleksascommented, Dec 2, 2018
2reactions
Alexmac22347commented, Dec 2, 2018

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found