-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run NER in inference mode #54
Comments
Hi please check this comment from issue #39 |
I can confirm this issue. Trying the workaround with Edit: I dug a little bit. Running |
Hi all, |
I experienced similar behavior because my test file didn't have a blank newline at the end. |
@Anushka1610 Interesting. Could you describe the structure of your test file? Intuitively, I assume it should only hold one word or one sentence per line. Is this correct? |
@yrahul3910 The structure of your
For example, let's
|
@Anushka1610 Thanks for clarifying! How do you run prediction then? Given a sequence of words, I'd like to predict their class; so it feels odd to me that I need to provide classes for the test files. Is there a way around this? Alternatively, do you think I could simply give them all a random class and just look at the predictions generated by the model? |
I still can't get this to work. In my |
I would like to add a question to this though. Line 586 says If FLAGS.do_predict, so it seems that during prediction the token_text.txt is deleted. I agree that token_test.txt is created during the fine-tuning process, and I have created that file, but why would this file be deleted during prediction? I cannot see another place before the fatal error in line 615 when we try to read token_test.txt where the file token_test.txt would be created again. If I comment out the remove portion, I get the same token_test.txt with the timestamp of when the prediction completed. Must there be a new token_test.txt file generated during this prediction phase? If I comment out as indicated, the detokenizer in brocades will not work because of unequal length between the label and the token file. |
As understand for predicting what we will change in predicting stage just write( --do_predict=true ) instead of ( --do_eval=true ) and put smaller number for num_train_epochs right? so when I fune tuned and tried to predict like I wrote above WARNING:tensorflow:From /content/drive/My Drive/Colab Notebooks/Bert/BioBert/biobert-master/optimization.py:87: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead. /usr/local/lib/python3.6/dist-packages/absl/flags/_validators.py:359: UserWarning: Flag --task_name has a non-None default value; therefore, mark_flag_as_required will pass even if flag is not specified in the command line! Traceback (most recent call last): During handling of the above exception, another exception occurred: Traceback (most recent call last): what should I do in this case? |
Fix known bugs about NER task. 1. NER inference mode (only predict) #39 #50 #54 2. Check OUTPUT dir and make it if not exists 3. Fixed "missing labels" problem. 3-1. See Line 631 of run_ner.py for [PAD] related problem 3-2. See biocodes/ner_detokenize.py for max_seq_length related problems 4. Refactored a few lines (ex. os.path.join, replaced **NULL** with [PAD]) 5. Functionize detokenizer (See biocodes/ner_detokenize.py for details) 6. misc If you wish to use previous version, pleas use tag v20200409 https://github.com/dmis-lab/biobert/tree/v20200409
I trained the BioBERT model using the v1.1 weights found in the NAVER Github repository. I followed the instructions provided, but had to modify "--init_checkpoint=$BIOBERT_DIR/biobert_model.ckpt" part of the code to "--init_checkpoint=$BIOBERT_DIR/model.ckpt-1000000." Once the model had been trained, I tried running it in inference mode with "--do_train=false --do_eval=true --do_predict=true" and everything else the same as when I trained the model. I am able to see the token-level evaluation result printed as stdout format. However, this does not create the "token_test.txt and label_test.txt in output_dir." I'm not sure if I'm doing something wrong. Any help would be appreciated!
The text was updated successfully, but these errors were encountered: