microsoft/BioGPT được TopGit xếp vào nhóm dự án mã nguồn mở, với 4.5k sao trên GitHub, viết chủ yếu bằng Python.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
This repository contains the implementation of BioGPT: Generative Pre-trained Transformer for Biomedical Text Generation and Mining, by Renqian Luo, Liai Sun, Yingce Xia, Tao Qin, Sheng Zhang, Hoifung Poon and Tie-Yan Liu.
Requirements and Installation
PyTorch version == 1.12.0
Python version == 3.10
fairseq version == 0.12.0:
git clone https://github.com/pytorch/fairseq
cd fairseq
git checkout v0.12.0
pip install .
python setup.py build_ext --inplace
cd ..
git clone https://github.com/glample/fastBPE.git
export FASTBPE=${PWD}/fastBPE
cd fastBPE
g++ -std=c++11 -pthread -O3 fastBPE/main.cc -IfastBPE -o fast
sacremoses
pip install sacremoses
sklearn
pip install scikit-learn
Remember to set the environment variables MOSES and FASTBPE to the path of Moses and fastBPE respetively, as they will be required later.
Getting Started
Pre-trained models
We provide our pre-trained BioGPT model checkpoints along with fine-tuned checkpoints for downstream tasks, available both through URL download as well as through the Hugging Face 🤗 Hub.
Model
Description
URL
🤗 Hub
BioGPT
Pre-trained BioGPT model checkpoint
link
link
BioGPT-Large
Pre-trained BioGPT-Large model checkpoint
link
link
BioGPT-QA-PubMedQA-BioGPT
Fine-tuned BioGPT for question answering task on PubMedQA
link
BioGPT-QA-PubMedQA-BioGPT-Large
Fine-tuned BioGPT-Large for question answering task on PubMedQA
link
BioGPT-RE-BC5CDR
Fine-tuned BioGPT for relation extraction task on BC5CDR
link
BioGPT-RE-DDI
Fine-tuned BioGPT for relation extraction task on DDI
link
BioGPT-RE-DTI
Fine-tuned BioGPT for relation extraction task on KD-DTI
link
BioGPT-DC-HoC
Fine-tuned BioGPT for document classification task on HoC
link
Download them and extract them to the checkpoints folder of this project.
For example:
mkdir checkpoints
cd checkpoints
wget https://msralaphilly2.blob.core.windows.net/release/BioGPT/checkpoints/Pre-trained-BioGPT.tgz?sp=r&st=2023-11-13T15:37:35Z&se=2099-12-30T23:37:35Z&spr=https&sv=2022-11-02&sr=b&sig=3CcG1TOhqJPBhkVutvVn3PtUq0vPyLBgwggUfojypfY%3D
tar -zxvf Pre-trained-BioGPT.tgz
BioGPT has also been integrated into the Hugging Face transformers library, and model checkpoints are available on the Hugging Face Hub.
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we set a seed for reproducibility:
from transformers import pipeline, set_seed
from transformers import BioGptTokenizer, BioGptForCausalLM
model = BioGptForCausalLM.from_pretrained("microsoft/biogpt")
tokenizer = BioGptTokenizer.from_pretrained("microsoft/biogpt")
generator = pipeline('text-generation', model=model, tokenizer=tokenizer)
set_seed(42)
generator("COVID-19 is", max_length=20, num_return_sequences=5, do_sample=True)
Here is how to use this model to get the features of a given text in PyTorch:
from transformers import BioGptTokenizer, BioGptForCausalLM
tokenizer = BioGptTokenizer.from_pretrained("microsoft/biogpt")
model = BioGptForCausalLM.from_pretrained("microsoft/biogpt")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
For more information, please see the documentation on the Hugging Face website.
Demos
Check out these demos on Hugging Face Spaces:
Text Generation with BioGPT-Large
Question Answering with BioGPT-Large-PubMedQA
License
BioGPT is MIT-licensed.
The license applies to the pre-trained models as well.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct.
For more information see the Code of Conduct FAQ or
contact [email protected] with any additional questions or comments.
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
Microsoft's Trademark & Brand Guidelines.
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/microsoft/BioGPT là nguồn chính thức.
microsoft/BioGPT có phải mã nguồn mở không?
Có — microsoft/BioGPT phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/microsoft/BioGPT.
microsoft/BioGPT là gì?
microsoft/BioGPT (microsoft/BioGPT) là dự án Python TopGit theo dõi. Tính tới lần đồng bộ gần nhất, repo có 4.5k sao.
Đọc đầy đủ README ở tab phía trên.
BioGPT có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về BioGPT.