Comments (4)
Thanks a lot, this is exactly what I need, I have learned so much from your code, thank you again
from tf_ner.
Hi @cedar33 ,
Yes, there is an efficient way to predict. Have a look at the serve.py
script. It provides an example of how to use a predictor on a batch of size 1. You can create bigger batches as long as you pad the inputs. It will be efficient.
from tf_ner.
After batch size =50 we read 50 lines from file so server.py code will be like this ????
def file_read_from_head(fname, nlines):
from itertools import islice
with open(fname) as f:
for line in islice(f, nlines):
print(line)
return nlines
fifty_LINE= file_read_from_head('example1.txt', 50) #we read 50 line from file
if __name__ == '__main__':
export_dir = 'saved_model'
subdirs = [x for x in Path(export_dir).iterdir()
if x.is_dir() and 'temp' not in str(x)]
latest = str(sorted(subdirs)[-1])
predict_fn = predictor.from_saved_model(latest)
for LINE in fifty_LINE:
words = [w.encode() for w in LINE.split()]
nwords = len(words)
predictions = predict_fn({'words': [words], 'nwords': [nwords]})
print(predictions)
#Loop over each line ??? or just
#words = [w.encode() for w in fifty_LINE.split()] is enough
from tf_ner.
Thanks a lot, this is exactly what I need, I have learned so much from your code, thank you again
Much appreciated Brother
Kind regards Ahmad
from tf_ner.
Related Issues (20)
- InvalidArgumentError HOT 1
- Question: Effect of missing word in pre-trained word embeddings on model performance. HOT 1
- Is the evaluation metric the same as the ones in the papers?
- Does this evaluation script apply to BIO or BIES? HOT 1
- The pred_ids of `<pad>` is always zero
- 0 precision 0 recall for some custom tags HOT 2
- Why the result is better than that in the papers? #87 HOT 1
- batch size is creating confusion [ when we compare with Research Paper ]
- tensorflow.contrib.estimator HOT 6
- For models/lstm_crf/main.py, Line 171
- Support for TF 2.0 HOT 6
- InvalidArgumentError: labels contains negative values
- has no attribute 'stop_if_no_increase_hook' for tensorflow 1.9 HOT 1
- Which version of numpy will work HOT 1
- There are issues when I use my own datasets HOT 1
- Thanks for your amazing work!
- Visualizing embeddings & improving accuracy
- In reported result, what is difference between best and abs. best ? Also mean + std. deviation doesnt matches with the best result reported in the github page ? HOT 1
- same result on F1, Accuracy, precision
- Prediction script for single line statements
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 tf_ner.