deskull commited on
Commit
fd7e297
·
verified ·
1 Parent(s): ec16f6a

Add model card

Browse files
Files changed (1) hide show
  1. README.md +71 -0
README.md ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - pytorch
5
+ - bert
6
+ - protein
7
+ pipeline_tag: fill-mask
8
+ ---
9
+
10
+ # molcrawl-protein-sequence-bert-medium
11
+
12
+ ## Model Description
13
+
14
+ GPT-2 medium (345M parameters) foundation model pre-trained on protein amino acid sequences from the MolCrawl dataset.
15
+
16
+ - **Model Type**: bert
17
+ - **Data Type**: Protein
18
+ - **Training Date**: 2026-05-11
19
+
20
+ ## Usage
21
+
22
+ ```python
23
+ from transformers import AutoModelForMaskedLM, AutoTokenizer
24
+ import torch
25
+
26
+ model = AutoModelForMaskedLM.from_pretrained("kojima-lab/molcrawl-protein-sequence-bert-medium")
27
+ tokenizer = AutoTokenizer.from_pretrained("kojima-lab/molcrawl-protein-sequence-bert-medium")
28
+
29
+ # Predict masked amino acid
30
+ # Use tokenizer.mask_token instead of hardcoded "[MASK]":
31
+ # BERT-style tokenizers vary ("[MASK]", "<mask>", etc.)
32
+ if tokenizer.mask_token is None:
33
+ raise ValueError("This tokenizer has no mask_token; masked LM inference is not supported.")
34
+ prompt = "MKTAYIAK{MASK}RQISFVKSHFSRQ".replace("{MASK}", tokenizer.mask_token)
35
+ inputs = tokenizer(prompt, return_tensors="pt")
36
+ mask_index = (inputs["input_ids"] == tokenizer.mask_token_id).nonzero(as_tuple=True)[1]
37
+
38
+ with torch.no_grad():
39
+ outputs = model(**inputs)
40
+ logits = outputs.logits
41
+
42
+ predicted_token_id = logits[0, mask_index].argmax(dim=-1)
43
+ predicted_token = tokenizer.decode(predicted_token_id)
44
+ result = prompt.replace(tokenizer.mask_token, predicted_token)
45
+ print(f"Predicted: {result}")
46
+
47
+ ```
48
+
49
+ ## Source Code
50
+
51
+ Training pipeline, configuration files, and data preparation scripts are
52
+ available in the MolCrawl GitHub repository:
53
+ [https://github.com/mmai-framework-lab/MolCrawl](https://github.com/mmai-framework-lab/MolCrawl)
54
+
55
+ ## License
56
+
57
+ This model is released under the APACHE-2.0 license.
58
+
59
+ ## Citation
60
+
61
+ If you use this model, please cite:
62
+
63
+ ```bibtex
64
+ @misc{molcrawl_protein_sequence_bert_medium,
65
+ title={molcrawl-protein-sequence-bert-medium},
66
+ author={{RIKEN}},
67
+ year={2026},
68
+ publisher={{Hugging Face}},
69
+ url={{https://huggingface.co/kojima-lab/molcrawl-protein-sequence-bert-medium}}
70
+ }
71
+ ```