root commited on
Commit
10e8e91
1 Parent(s): 2dc3ee3

Add SciFive MedNLI models

Browse files
Files changed (6) hide show
  1. README.md +48 -0
  2. config.json +38 -0
  3. pytorch_model.bin +3 -0
  4. spiece.model +3 -0
  5. tf_model.h5 +3 -0
  6. tokenizer.json +0 -0
README.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+
5
+ tags:
6
+ - token-classification
7
+ - text-classification
8
+ - question-answering
9
+ - text2text-generation
10
+ - text-generation
11
+
12
+ datasets:
13
+ - pubmed
14
+ - pmc/open_access
15
+
16
+ ---
17
+
18
+ # SciFive Pubmed+PMC Large
19
+
20
+ ## Introduction
21
+ Paper: [SciFive: a text-to-text transformer model for biomedical literature](https://arxiv.org/abs/2106.03598)
22
+
23
+ Authors: _Long N. Phan, James T. Anibal, Hieu Tran, Shaurya Chanana, Erol Bahadroglu, Alec Peltekian, Grégoire Altan-Bonnet_
24
+
25
+ ## How to use
26
+ For more details, do check out [our Github repo](https://github.com/justinphan3110/SciFive).
27
+ ```python
28
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
29
+
30
+ tokenizer = AutoTokenizer.from_pretrained("razent/SciFive-large-Pubmed_PMC")
31
+ model = AutoModelForSeq2SeqLM.from_pretrained("razent/SciFive-large-Pubmed_PMC")
32
+
33
+ sentence = "Identification of APC2 , a homologue of the adenomatous polyposis coli tumour suppressor ."
34
+ text = "ncbi_ner: " + sentence + " </s>"
35
+
36
+ encoding = tokenizer.encode_plus(text, pad_to_max_length=True, return_tensors="pt")
37
+ input_ids, attention_masks = encoding["input_ids"].to("cuda"), encoding["attention_mask"].to("cuda")
38
+
39
+ outputs = model.generate(
40
+ input_ids=input_ids, attention_mask=attention_masks,
41
+ max_length=256,
42
+ early_stopping=True
43
+ )
44
+
45
+ for output in outputs:
46
+ line = tokenizer.decode(output, skip_special_tokens=True, clean_up_tokenization_spaces=True)
47
+ print(line)
48
+ ```
config.json ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "T5ForConditionalGeneration"
4
+ ],
5
+ "d_ff": 4096,
6
+ "d_kv": 64,
7
+ "d_model": 1024,
8
+ "decoder_start_token_id": 0,
9
+ "dropout_rate": 0.1,
10
+ "eos_token_id": 1,
11
+ "feed_forward_proj": "relu",
12
+ "gradient_checkpointing": false,
13
+ "initializer_factor": 1.0,
14
+ "is_encoder_decoder": true,
15
+ "layer_norm_epsilon": 1e-06,
16
+ "model_type": "t5",
17
+ "n_positions": 1024,
18
+ "num_decoder_layers": 24,
19
+ "num_heads": 16,
20
+ "num_layers": 24,
21
+ "output_past": true,
22
+ "pad_token_id": 0,
23
+ "relative_attention_num_buckets": 32,
24
+ "task_specific_params": {
25
+ "nli": {
26
+ "early_stopping": true,
27
+ "length_penalty": 2.0,
28
+ "max_length": 256,
29
+ "no_repeat_ngram_size": 3,
30
+ "num_beams": 4,
31
+ "prefix": "mednli: "
32
+ }
33
+ },
34
+ "torch_dtype": "float32",
35
+ "transformers_version": "4.17.0",
36
+ "use_cache": true,
37
+ "vocab_size": 32128
38
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a348b5c18206449576ce89e97932fa62777db440dd1194407e90fe85ca78eae
3
+ size 2950897543
spiece.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d60acb128cf7b7f2536e8f38a5b18a05535c9e14c7a355904270e15b0945ea86
3
+ size 791656
tf_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68ed08a95f635e6d2de102d21db1b8c831782659dd8ceec55c655044ae302780
3
+ size 2951711704
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff