marekrei / sequence-labeler Goto Github PK
View Code? Open in Web Editor NEWNeural network sequence labeling model
Neural network sequence labeling model
Hi,
In the laber.py
line 243:
lmcost_bw_mask = tf.sequence_mask(sentence_lengths, maxlen=tf.shape(target_ids)[1])[:,:-1]
The mask have some issue, for example
origin_seq: 1 2 3 4 0 0 0
origin_mask: 1 1 1 1 0 0 0
lmcost_bw_mask: 1 1 1 1 0 0
the correct lmcost_bw_mask here should be: 1 1 1 0 0 0
Could you please share the CoNLL data you use for the model? I found several variations with the same name.
Thanks
How did I get the F score? Which file to run? How to run evaluator.py?
@marekrei Hello, marekrei. It's very nice work, and I want to reproduce your work. But I have some problem in preparing the required format. So could you please provide some parts of the data for me? Thank you very much.
Hi,
Did you mean to pass lowercase_chars
flag when building characters vocabulary here?
Hi,
Thanks for sharing this great implementation.
I know it is possible to get the label probabilities using forward backward algorithm in CRFs. I am finding some difficulties in implementing/modifying the default CRF implementation in tensorflow. For calculation of the partition function, they have only used the forward (message passing) algorithm. Do you have any experience or ideas about how the forward-backward algorithm could be implemented in tf?
Hi,
I'm wondering if you have this problem? I set up the following environment, and run with python experiment.py config.conf.
python (3.5.2)
numpy 1.14.0)
tensorflow (1.4.1)
The program stopped here and the err is in the following. Any thoughts or suggestions on this? Thank you.
Traceback (most recent call last):
File "experiment.py", line 242, in
run_experiment(sys.argv[1])
File "experiment.py", line 153, in run_experiment
config = parse_config("config", config_path)
File "experiment.py", line 56, in parse_config
for key, value in config_parser.items(config_section):
File "/home/wtzhao/.conda/envs/seq_labeling/lib/python3.5/configparser.py", line 846, in items
raise NoSectionError(section)
configparser.NoSectionError: No section: 'config'
Hi,
I don't know why this bug happened, it seems like tensor cannot be sliced by M[:, slice_num*l:(slice_num+1)*l]
File "/Users/Xin/Documents/17_Spring/sequence-labeler-master/sequence_labeling_experiment.py", line 300, in run_experiment
sequencelabeler = SequenceLabeler(config)
File "/Users/Xin/Documents/17_Spring/sequence-labeler-master/sequence_labeler.py", line 42, in init
char_output_tensor = recurrence.create_birnn(char_input_tensor, config["char_embedding_size"], char_mask_reshaped, config["char_recurrent_size"], return_combined=True, fn_create_parameter_matrix=self.create_parameter_matrix, name="char_birnn")
File "/Users/Xin/Documents/17_Spring/sequence-labeler-master/recurrence.py", line 12, in create_birnn
recurrent_size, only_return_final=return_combined, go_backwards=False, fn_create_parameter_matrix=fn_create_parameter_matrix, name=name + "_forward")
File "/Users/Xin/Documents/17_Spring/sequence-labeler-master/recurrence.py", line 74, in create_lstm
go_backwards=go_backwards)
File "/Users/Xin/anaconda/lib/python3.5/site-packages/theano/scan_module/scan.py", line 773, in scan
condition, outputs, updates = scan_utils.get_updates_and_outputs(fn(args))
File "/Users/Xin/Documents/17_Spring/sequence-labeler-master/recurrence.py", line 34, in lstm_mask_step
h_new, c_new = lstm_step(x, h_prev, c_prev, W_x, W_h, b, W_ci, W_cf, W_co)
File "/Users/Xin/Documents/17_Spring/sequence-labeler-master/recurrence.py", line 26, in lstm_step
i = tensor.nnet.sigmoid(_slice(m_xhb, 0, 4) + c_prev * W_ci)
File "/Users/Xin/Documents/17_Spring/sequence-labeler-master/recurrence.py", line 47, in _slice
return M[:, slice_numl:(slice_num+1)*l]
File "/Users/Xin/anaconda/lib/python3.5/site-packages/theano/tensor/var.py", line 519, in getitem
theano.tensor.subtensor.Subtensor.convert(arg)
File "/Users/Xin/anaconda/lib/python3.5/site-packages/theano/tensor/subtensor.py", line 370, in convert
slice_a = Subtensor.convert(a, False)
File "/Users/Xin/anaconda/lib/python3.5/site-packages/theano/tensor/subtensor.py", line 349, in convert
raise TypeError("Expected an integer")
TypeError: Expected an integer
hi,
When I run this code on a sample dataset(only one sentence), the model can not achieve 100 F value. The config file is the same except I change the lr to 0.01.
The sample data is :
I c
saws i
the c
show c
do you have any idea about this?
Hello, @marekrei
Great work!
I’m trying to make use of bidirectional lstm for binary sequence labeling.
Having trained your model on my data, i want to
test it on separate sentence, presumably, not from the training set.
In other words, how to use trained model to get output for one sentence at a time?
I want try to change the code from line 116 in "sequence_labeler.py",
from:
input_vars_train = [word_ids, char_ids, char_mask, label_ids, learningrate]
to
input_vars_train = [word_ids, char_ids, # myowntag_ids, char_mask, # myowntag_mask, label_ids, learningrate]
and then I got this error:
ValueError: dimension mismatch in args to gemm
I don't know why is this happen, can you help me to explain why is this happen?
Thank you very much!
Best Regards!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.