-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zhiyuan Chen <[email protected]>
- Loading branch information
1 parent
bfc060c
commit 3188088
Showing
14 changed files
with
201 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
from . import models | ||
from transformers import AutoTokenizer | ||
|
||
__all__ = ["models"] | ||
from . import models, tokenizers | ||
from .models import RnaBertConfig | ||
from .tokenizers import RnaTokenizer | ||
|
||
AutoTokenizer.register(RnaBertConfig, RnaTokenizer) | ||
|
||
|
||
__all__ = ["models", "tokenizers"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .rnabert import RnaBertConfig, RnaBertModel, RnaBertTokenizer | ||
from .rnabert import RnaBertConfig, RnaBertModel | ||
|
||
__all__ = ["RnaBertConfig", "RnaBertModel", "RnaBertTokenizer"] | ||
__all__ = ["RnaBertConfig", "RnaBertModel"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
from transformers import AutoConfig, AutoModel, AutoTokenizer | ||
|
||
from multimolecule.tokenizers.rna import RnaTokenizer | ||
|
||
from .configuration_rnabert import RnaBertConfig | ||
from .modeling_rnabert import RnaBertModel | ||
from .tokenization_rnabert import RnaBertTokenizer | ||
|
||
__all__ = ["RnaBertConfig", "RnaBertModel", "RnaBertTokenizer"] | ||
__all__ = ["RnaBertConfig", "RnaBertModel"] | ||
|
||
AutoConfig.register("rnabert", RnaBertConfig) | ||
AutoModel.register(RnaBertConfig, RnaBertModel) | ||
AutoTokenizer.register(RnaBertConfig, RnaBertTokenizer) | ||
AutoTokenizer.register(RnaBertConfig, RnaTokenizer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .rna import RnaTokenizer | ||
|
||
__all__ = ["RnaTokenizer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from .tokenization_rna import RnaTokenizer | ||
|
||
__all__ = ["RnaTokenizer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
def get_vocab_list(): | ||
return VOCAB_LIST | ||
|
||
|
||
def get_special_tokens_map(): | ||
return SPECIAL_TOKENS_MAP | ||
|
||
|
||
def get_tokenizer_config(): | ||
config = TOKENIZER_CONFIG | ||
config.setdefault("added_tokens_decoder", {}) | ||
for i, v in enumerate(SPECIAL_TOKENS_MAP.values()): | ||
config["added_tokens_decoder"][str(i)] = v | ||
return config | ||
|
||
|
||
VOCAB_LIST = [ | ||
"<pad>", | ||
"<cls>", | ||
"<eos>", | ||
"<unk>", | ||
"<mask>", | ||
"<null>", | ||
"A", | ||
"C", | ||
"G", | ||
"U", | ||
"N", | ||
"X", | ||
"V", | ||
"H", | ||
"D", | ||
"B", | ||
"M", | ||
"R", | ||
"W", | ||
"S", | ||
"Y", | ||
"K", | ||
".", | ||
"*", | ||
"-", | ||
] | ||
|
||
SPECIAL_TOKENS_MAP = { | ||
"pad_token": { | ||
"content": "<pad>", | ||
"lstrip": False, | ||
"normalized": False, | ||
"rstrip": False, | ||
"single_word": False, | ||
"special": True, | ||
}, | ||
"cls_token": { | ||
"content": "<cls>", | ||
"lstrip": False, | ||
"normalized": False, | ||
"rstrip": False, | ||
"single_word": False, | ||
"special": True, | ||
}, | ||
"eos_token": { | ||
"content": "<eos>", | ||
"lstrip": False, | ||
"normalized": False, | ||
"rstrip": False, | ||
"single_word": False, | ||
"special": True, | ||
}, | ||
"unk_token": { | ||
"content": "<unk>", | ||
"lstrip": False, | ||
"normalized": False, | ||
"rstrip": False, | ||
"single_word": False, | ||
"special": True, | ||
}, | ||
"mask_token": { | ||
"content": "<mask>", | ||
"lstrip": False, | ||
"normalized": False, | ||
"rstrip": False, | ||
"single_word": False, | ||
"special": True, | ||
}, | ||
} | ||
|
||
TOKENIZER_CONFIG = { | ||
"tokenizer_class": "RnaTokenizer", | ||
"clean_up_tokenization_spaces": True, | ||
} |
Oops, something went wrong.