Comments (7)
I've been using it with bert-as-service myself! The only thing you need to do is change the checkpoint names from biobert.ckpt to bert.cpkt after all BioBERT was designed to maximize compatibility with the original BERT models.
from biobert-pretrained.
I've been using it with bert-as-service myself! The only thing you need to do is change the checkpoint names from biobert.ckpt to bert.cpkt after all BioBERT was designed to maximize compatibility with the original BERT models.
Thank you for your answer. I did that indeed but unfortunately, when I run this code:
bert-serving-start -model_dir=C:\ML\BERT\uncased_L-24_H-1024_A-16 -tuned_model_dir=C:\ML\BERT\BioBERT\pubmed_pmc_470k -ckpt_name=biobert_model.ckpt -max_seq_len=NONE
I get this:
Traceback (most recent call last):
File "c:\program files\python37\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\program files\python37\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Program Files\Python37\Scripts\bert-serving-start.exe_main.py", line 9, in
File "c:\program files\python37\lib\site-packages\bert_serving\server\cli_init.py", line 4, in main
with BertServer(get_run_args()) as server:
File "c:\program files\python37\lib\site-packages\bert_serving\server_init_.py", line 70, in init
self.graph_path, self.bert_config = pool.apply(optimize_graph, (self.args,))
TypeError: cannot unpack non-iterable NoneType object
from biobert-pretrained.
I also changed the names as you suggested but still I get the same error...
This is the content of my model folder:
Directory of C:\ML\BERT\BioBERT\pubmed_pmc_470k
30/04/2019 08:38
.30/04/2019 08:38 ..
23/01/2019 08:00 212 ._bert_config.json
21/01/2019 04:21 1.307.195.224 bert.ckpt.data-00000-of-00001
21/01/2019 04:04 24.074 bert.ckpt.index
21/01/2019 04:05 52.248.151 bert.ckpt.meta
23/01/2019 08:00 313 bert_config.json
23/01/2019 08:00 213.450 vocab.txt
from biobert-pretrained.
Interesting, I might've done it wrong myself. I just point the model directory directly to the BioBERT folder, but keep in mind that BioBERT is slightly different from BERT since it doesn't have the same Adam optimizer, which is why your command is not likely working (and getting that Nonetype error). Apart from modifying bert-as-service's source code, I recommend just running this instead:
bert-serving-start -model_dir=C:\ML\BERT\BioBERT\pubmed_pmc_470k -max_seq_len=NONE
Seeing that we're not really doing any training, I don't think there should be an issue. Also, I rename the checkpoint just because bert-as-service hardcodes bert.cpkt.
from biobert-pretrained.
it works now but then I wonder...would this still be fine-tuning? In this case we are loading directly the BioBERT model but not on top of BERT large...
I'm totally newbie in this so sorry if this sounds like total bs :D
from biobert-pretrained.
That's all good, I'm somewhat of a newbie myself. But BioBERT are pre-trained models rather than fine-tuned, you can fine-tune with some task (and a smaller dataset) like Named Entity Recognition and then use it from there. So I assume it's safe to use them like this because they don't have task-specific layers added to them.
I assume the reason why there is a separate option for fine-tuning is because there is a task-specific layer that is added when doing fine-tuning and the way bert-as-service works is by pooling on the final layers of the original bert model which will change if you fine-tune because more layers are added. So what the checkpoint is for is to change the shared layer weights of the bert model to be used with the bert-as-service.
Hopefully, someone else with more experience can chime in, but this is what I think is happening.
Though I would be careful using bert-as-service to encode sentences, as from my experience the past few weeks, the distances between vectors is incredibly small and don't make much sense. I would recommend using the regular old word embeddings techniques like CBOW as it might already be sufficient for what you want to do.
from biobert-pretrained.
thank you for your comment @Ayuei !
from biobert-pretrained.
Related Issues (20)
- total time require for training HOT 3
- Files for BioBERT tokenizer HOT 4
- Regarding Relation Extraction (RE), does it mean it's classifying whether the two marked entities have the defined relations? HOT 1
- Problem with loading model HOT 1
- Has Pre-training corpus chinese? HOT 1
- Pre-trained BioBERT를 distilBERT처럼 사용하려면 HOT 1
- Are there Chinese version bio-bert pretrained model? HOT 1
- BIOBERT corpus HOT 5
- Biobert custom vocab HOT 1
- KeyError when running NER on pretrained BioBERT model HOT 1
- License HOT 1
- I cant open five links of fine-tuning BioBERT HOT 1
- Question: Which part of PMC is used?
- using pretrained biobert matrix
- How do you pre-process the PMC articles?
- Any plan to have updated pretrained model? HOT 1
- Are these cased or uncased models? HOT 2
- Failed to find any matching files for biobert-pretrained/biobert_v1.1_pubmed/biobert_model.ckpt HOT 7
- Can't download the pre-trained weight from "release" section HOT 2
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 biobert-pretrained.