Questions tagged [allennlp]

An open-source NLP research library, built on PyTorch

An Apache 2.0 NLP research library, built on PyTorch, for developing state-of-the-art deep learning models on a wide variety of linguistic tasks.

Quick Links

210 questions
2
votes
1 answer

ModuleNotFoundError: No module named 'allennlp.commands.elmo'

I installed the allennlp package by using pip install allennlp. But when I tried to import it from Jupyter Notebook using this command from allennlp.commands.elmo import ElmoEmbedder, it gave me an error ModuleNotFoundError: No module named…
CodingStark
  • 199
  • 3
  • 17
2
votes
2 answers

How to merge multiword NER tags?

I am using allennlp for NER tagging currently. Code: from allennlp.predictors.predictor import Predictor predictor = Predictor.from_path("...path to model...") sentence = "Top Gun was inspired by a newspaper article." result =…
2
votes
0 answers

Exception: bad escape \p at position x

I am trying to run allennlp package's prediction using a model which I have trained over my training data. However, at the beginning of the process, this exception comes up and halts the program. raise source.error('bad escape %s' % escape,…
inverted_index
  • 2,329
  • 21
  • 40
2
votes
1 answer

How can I train the semantic role labeling model in AllenNLP?

How can I train the semantic role labeling model in AllenNLP? I am aware of the allennlp.training.trainer function but I don't know how to use it to train the semantic role labeling model. Let's assume that the training samples are BIO tagged,…
Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
2
votes
1 answer

Saving/Loading models in AllenNLP package

I am trying to load an AllenNLP model weights. I could not find any documentation on how to save/load a whole model, so playing with weights only. from allennlp.nn import util model_state = torch.load(filename_model,…
Dima Lituiev
  • 12,544
  • 10
  • 41
  • 58
2
votes
1 answer

How to use Elmo word embedding with the original pre-trained model (5.5B) in interactive mode

I am trying to learn how to use Elmo embeddings via this tutorial: https://github.com/allenai/allennlp/blob/master/tutorials/how_to/elmo.md I am specifically trying to use the interactive mode as described like this: $ ipython > from…
2
votes
1 answer

How can I use JupyterLab with allennlp==0.3.0?

How can I use JupyterLab with allennlp==0.3.0? When I go to jupyterlab through my browser, the python kernel dies: notebook_1 | from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout,…
Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
2
votes
0 answers

pytorch AttributeError: module 'torch.optim.lr_scheduler' has no attribute 'CosineAnnealingLR'

When trying to run a python notebook on google colab, mentioned in https://medium.com/@markn_67491/run-allennlp-models-on-free-gpus-using-googles-colab-notebooks-4db9359970c1 available from:…
Oren Bochman
  • 1,173
  • 3
  • 16
  • 37
1
vote
2 answers

Is AllenNLP biased towards BERT?

At my University's research group we have been pre-training a RoBERTa model for Portuguese and also a domain-specific one, also based on RoBERTa. We have been conducting a series of benchmarks using huggingface's transformers library, and the…
1
vote
1 answer

Allennlp: How to use CPU instead of GPU?

I'm running some code that works when there is GPU. But I'm trying to figure out how to run it locally with CPU. Here's the error: 2022-07-06 17:58:39,042 - INFO - allennlp.common.plugins - Plugin allennlp_models available Traceback (most recent…
1
vote
1 answer

RuntimeError: Expected 3-dimensional tensor, but got 2-dimensional tensor for argument

I have two tensors names: 'wy' and 'x', both of them with size 8: wy= tensor([[ 74.2090, -92.9444, 45.2677, -38.4132, -39.8641, -6.9193, 67.4830, -80.1534]], grad_fn=) x= tensor([[ 70., 77., 101., 75., 40., 83., 48., …
kaloon
  • 157
  • 4
  • 15
1
vote
1 answer

OOM issues with AllenNLP coreference resolution training and substituting models

I have a few questions about training and evaluating AllenNLP's coreference resolution model. Are there any constraints/specifications on what GPUs should be used for training? I get an OOM issue midway through training on a Titan RTX GPU with…
1
vote
1 answer

can't import OrderedDict ImportError: cannot import name 'OrderedDict'

I'm trying to run a repo using allennlp. As I run it, I can't import from typing import OrderedDict in ddp_accelerator.py file. Traceback (most recent call last): File "train.py", line 10, in from models.newmodel import model File…
devotchka
  • 11
  • 1
  • 2
1
vote
1 answer

Allennlp: How to load a pretrained ELMo as the embedding of allennlp model?

I am new in allennlp. I trained an elmo model to apply it to other allennlp models as the embedding but failed. It seems that my model is not compatible to the interface the config gives. What can I do? My elmo is trained by allennlp with the…
IshiKura-a
  • 13
  • 2
1
vote
1 answer

I'm having trouble downloading allennlp ERROR: No matching distribution found for torch<1.6.0,>=1.5.0

when I try to download pip install allennlp==1.0.0 allennlp-models==1.0. I am facing this problem : Microsoft Windows [Version 10.0.22000.469] (c) Microsoft Corporation. All rights reserved. C:\Users\Ahmad Sadek>pip install allennlp==1.0.0…
1 2
3
13 14