Comments (7)
To perform inference in batch on your device, you can pass a list of sentences instead of single string.
For example,
model = tweetnlp.load('sentiment')
model.sentiment(["sentence 1", "sentence 2", etc])
You can also find how the output would look like on the colab here.
from tweetnlp.
To perform inference in batch on your device, you can pass a list of sentences instead of single string. For example,
model = tweetnlp.load('sentiment') model.sentiment(["sentence 1", "sentence 2", etc])
You can also find how the output would look like on the colab here.
Hi asahi417, it is a great idea to calculate sentences togther but I received a warning for importing tweetnlp, and I hardly can find any information about it when someone met the same issue:
'''cannot import name 'allowed_transitions' from 'allennlp.modules.conditional_random_field'''
(C:\Users\ky002\AppData\Roaming\Python\Python39\site-packages\allennlp\modules\conditional_random_field_init_.py)
Do you have any ideas about it? Or which version of tweetnlp should I choose?
from tweetnlp.
I have found a bug in 'env/lib/python3.8/site-packages/tweetnlp/model_ner/model.py'
the warning results show that 'cannot import name 'allowed_transitions' from 'allennlp.modules.conditional_random_field',
and it works fine it you change the code in 'env/lib/python3.8/site-packages/tweetnlp/model_ner/model.py' lin 12 from 'from allennlp.modules.conditional_random_field import allowed_transitions' to 'from allennlp.modules.conditional_random_field.conditional_random_field import allowed_transitions'.
The reason behind is that there are two 'conditional_random_field' files in the package which have a father-son relationship
from tweetnlp.
@KaiyeYang-git Could you share your version of allennlp library? That library behaves funky sometime... and it might be probably better to just migrate the CRF part into tweetnlp directly and remove the dependency on allennlp.
from tweetnlp.
@KaiyeYang-git Could you share your version of allennlp library? That library behaves funky sometime... and it might be probably better to just migrate the CRF part into tweetnlp directly and remove the dependency on allennlp.
Here comes all information about library allennlp:
pip show allennlp
Name: allennlp
Version: 2.10.0
Summary: An open-source NLP research library, built on PyTorch.
Home-page: https://github.com/allenai/allennlp
Author: Allen Institute for Artificial Intelligence
Author-email: [email protected]
License: Apache
Location: c:\users\ky002\appdata\roaming\python\python39\site-packages
Requires: base58, cached-path, dill, fairscale, filelock, h5py, huggingface-hub, lmdb, more-itertools, nltk, numpy, protobuf, pytest, requests, rich, sacremoses, scikit-learn, scipy, sentencepiece, spacy, tensorboardX, termcolor, torch, torchvision, tqdm, traitlets, transformers, typer, wandb
Required-by: tweetnlp
from tweetnlp.
Thanks! Please allow me to take a bit more time to look into the issue. Sorry for the inconvenience 🙏
from tweetnlp.
It seems that from allennlp version 2.10.0, they use different way of loading a module we used in NER script. I fixed by changing the way of loading it depending on the version.
from tweetnlp.
Related Issues (18)
- pip install tweetnlp -> UnicodeDecodeError: 'charmap' HOT 1
- I don't know why I can't load model in tweetnlp HOT 2
- Train on my dataset HOT 1
- "Some weights of the model checkpoint were not used" HOT 2
- Proposal: Add Support for Apple Silicon Chips Using MPS for GPU Acceleration HOT 3
- OSError in loading model HOT 4
- Use CPU instead of unsupported GPU
- libcublas.so.*[0-9] not found in the system path on CPU-only machine
- ImportError: cannot import name 'OrderedDict' HOT 1
- tweetNLP online demo HOT 1
- freeze model
- String preprocessor account regex catches only fully-capitalized/numeric account handles
- Is Turkish included for sentiment prediction and topic classification? HOT 2
- transformers<=4.21.2 causing install errors HOT 1
- AttributeError: module 'enum' has no attribute 'IntFlag' HOT 1
- ImportError: cannot import name 'storage' from 'google.cloud' (unknown location) HOT 10
- HF models are not available anymore HOT 3
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 tweetnlp.