unilm icon indicating copy to clipboard operation
unilm copied to clipboard

Post-processing steps

Open MohitTuli opened this issue 6 years ago • 8 comments

Model I am using (LayoutLM): While implementing LayoutLM for custom dataset how do we use the --do predict function and get the test predictions on it? The script will help me identify spans of key and value? How to create a binary classifier based on LayoutLM output embeddings?

Please help and kindly look into the same

Best Regards

MohitTuli avatar Jul 30 '20 11:07 MohitTuli

@MohitTuli Please refer to the FUNSD paper, where they use the embeddings of the spans to create the binary classifier.

wolfshow avatar Jul 31 '20 13:07 wolfshow

@MohitTuli in order to get key pairs, do we need to fine tune on the FUNSD dataset on our end? or is there a way to --do_predict without retraining? I cannot find an example of the syntax provided

elnazsn1988 avatar Aug 03 '20 02:08 elnazsn1988

I had to do the fine-tuning either on our own data or on the FUNSD to get it to work

r000bin avatar Aug 04 '20 09:08 r000bin

@r000bin can you help me fix this issue - When trying to do --do_predict, if I put the output directory in --do_train as an output directory, it says:' FileExistsError: [Errno 17] File exists: 'outest' when I try to put an new empty directory for --do_predict, it says : OSError: Model name 'outputwtf' was not found in tokenizers model name list (bert-base-uncased, bert-large-uncased, bert-base-cased, bert-large-cased, bert-base-multilingual-uncased, bert-base-multilingual-cased, bert-base-chinese, bert-base-german-cased, bert-large-uncased-whole-word-masking, bert-large-cased-whole-word-masking, bert-large-uncased-whole-word-masking-finetuned-squad, bert-large-cased-whole-word-masking-finetuned-squad, bert-base-cased-finetuned-mrpc, bert-base-german-dbmdz-cased, bert-base-german-dbmdz-uncased). We assumed 'outputwtf' was a path or url to a directory containing vocabulary files named ['vocab.txt'] but couldn't find such vocabulary files at this path or url.

can you tell me how you ran the command for --do_predict after completing --do_train

elnazsn1988 avatar Aug 05 '20 00:08 elnazsn1988

Don't change anything in the command beside --do_predict But that's what you tried first, right? And you got the FileExistsError: [Errno 17] File exists: 'outest' after starting --do_predict?

r000bin avatar Aug 05 '20 05:08 r000bin

@elnazsn1988 Facing the same problem. Did you find any solution?

cococedric14 avatar Aug 09 '20 20:08 cococedric14

@cococedric14 so I tried posting elsewhere also, no luck - finally used previously forked older commit, this version works for me with none of the issues : https://github.com/elnazsn1988/unilm/tree/master/layoutlm , however not validated full end-to end yet. Also, changed the a few lines I wrote in the read.me there - there is an issue with the writeout and readin commands which can be edited. hope this helps.

elnazsn1988 avatar Aug 09 '20 21:08 elnazsn1988

@wolfshow @elnazsn1988 @r000bin @mohittuli Hey can you give me overview of how binary classifier can be use use with layoutlm model or where i can change code to make it running with binary classifier. Also how to tackle when key have multiple choice value like checkbox.

kbrajwani avatar Oct 14 '20 11:10 kbrajwani