Apply BERTose display capitalization
Browse files- README.md +5 -5
- SHA256SUMS +4 -4
- config.json +1 -1
- src/bertose_layers.py +3 -3
- src/bertose_model.py +5 -5
README.md
CHANGED
|
@@ -9,16 +9,16 @@ tags:
|
|
| 9 |
- pytorch
|
| 10 |
---
|
| 11 |
|
| 12 |
-
#
|
| 13 |
|
| 14 |
-
This repository contains the
|
| 15 |
|
| 16 |
## Files
|
| 17 |
|
| 18 |
-
- `checkpoints/bertose_glycan_encoder.pt` -
|
| 19 |
- `vocab/bpe_vocabulary.json` - WURCS BPE vocabulary.
|
| 20 |
-
- `src/bertose_model.py` -
|
| 21 |
-
- `src/bertose_layers.py` - Transformer layers used by
|
| 22 |
- `src/wurcs_bpe_tokenizer.py` - WURCS BPE tokenizer.
|
| 23 |
|
| 24 |
## Input
|
|
|
|
| 9 |
- pytorch
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# BERTose Glycan Encoder
|
| 13 |
|
| 14 |
+
This repository contains the BERTose checkpoint for WURCS glycan embedding inference. It is the release-facing glycan representation model used by the companion notebook.
|
| 15 |
|
| 16 |
## Files
|
| 17 |
|
| 18 |
+
- `checkpoints/bertose_glycan_encoder.pt` - BERTose glycan encoder checkpoint.
|
| 19 |
- `vocab/bpe_vocabulary.json` - WURCS BPE vocabulary.
|
| 20 |
+
- `src/bertose_model.py` - BERTose model definition.
|
| 21 |
+
- `src/bertose_layers.py` - Transformer layers used by BERTose.
|
| 22 |
- `src/wurcs_bpe_tokenizer.py` - WURCS BPE tokenizer.
|
| 23 |
|
| 24 |
## Input
|
SHA256SUMS
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
622368f62c23e97e9137c277eaadcc93ee3901cbb420b591422bb1c2e19689a5 ./.gitattributes
|
| 2 |
-
|
| 3 |
9ff260796c28e9f254d87da95592c686874d3954429d926d99afd2a8f9b6c08f ./checkpoints/bertose_glycan_encoder.pt
|
| 4 |
-
|
| 5 |
6a56e6f73b8f874470ecde6e538f3f5029ae23aa6c10559817d1c2a8b59b7c0f ./requirements.txt
|
| 6 |
-
|
| 7 |
-
|
| 8 |
0bc54399362945601bcfd403441fc80968d173200dd0561f57568b2053a94839 ./src/wurcs_bpe_tokenizer.py
|
| 9 |
6a572afdf53f1494ab96c896876b824ca7ea749777352606aa9f96bf270ceecc ./vocab/bpe_vocabulary.json
|
|
|
|
| 1 |
622368f62c23e97e9137c277eaadcc93ee3901cbb420b591422bb1c2e19689a5 ./.gitattributes
|
| 2 |
+
a48dc3bc0dbe330ceddf8a9e32be9f699043c17a74956e852fb658c2ef233bc4 ./README.md
|
| 3 |
9ff260796c28e9f254d87da95592c686874d3954429d926d99afd2a8f9b6c08f ./checkpoints/bertose_glycan_encoder.pt
|
| 4 |
+
d5854b5960b949bee17dcae3078ad15641dd24516a6c73835784518d73adf979 ./config.json
|
| 5 |
6a56e6f73b8f874470ecde6e538f3f5029ae23aa6c10559817d1c2a8b59b7c0f ./requirements.txt
|
| 6 |
+
3587aa789041e4ee215dcaa0286847d45621e9514c0ed3efa314fb89cf40f4d7 ./src/bertose_layers.py
|
| 7 |
+
773023d70be02ecf4a26b79b18b2b70ee1b39e01ec287386cb162590aaf90767 ./src/bertose_model.py
|
| 8 |
0bc54399362945601bcfd403441fc80968d173200dd0561f57568b2053a94839 ./src/wurcs_bpe_tokenizer.py
|
| 9 |
6a572afdf53f1494ab96c896876b824ca7ea749777352606aa9f96bf270ceecc ./vocab/bpe_vocabulary.json
|
config.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
{
|
| 2 |
-
"model_family": "
|
| 3 |
"release_name": "bertose-glycan-encoder",
|
| 4 |
"checkpoint": "checkpoints/bertose_glycan_encoder.pt",
|
| 5 |
"vocabulary": "vocab/bpe_vocabulary.json",
|
|
|
|
| 1 |
{
|
| 2 |
+
"model_family": "BERTose",
|
| 3 |
"release_name": "bertose-glycan-encoder",
|
| 4 |
"checkpoint": "checkpoints/bertose_glycan_encoder.pt",
|
| 5 |
"vocabulary": "vocab/bpe_vocabulary.json",
|
src/bertose_layers.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
-
|
| 3 |
|
| 4 |
Transformer blocks adapted for WURCS glycan tokenization.
|
| 5 |
"""
|
|
@@ -10,7 +10,7 @@ import math
|
|
| 10 |
|
| 11 |
|
| 12 |
class GlycanBERTConfig:
|
| 13 |
-
"""Configuration for the
|
| 14 |
|
| 15 |
def __init__(
|
| 16 |
self,
|
|
@@ -202,7 +202,7 @@ class GlycanBERTLayer(nn.Module):
|
|
| 202 |
|
| 203 |
class GlycanBERT(nn.Module):
|
| 204 |
"""
|
| 205 |
-
|
| 206 |
"""
|
| 207 |
|
| 208 |
def __init__(self, config: GlycanBERTConfig):
|
|
|
|
| 1 |
"""
|
| 2 |
+
BERTose transformer layers.
|
| 3 |
|
| 4 |
Transformer blocks adapted for WURCS glycan tokenization.
|
| 5 |
"""
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
class GlycanBERTConfig:
|
| 13 |
+
"""Configuration for the BERTose transformer stack."""
|
| 14 |
|
| 15 |
def __init__(
|
| 16 |
self,
|
|
|
|
| 202 |
|
| 203 |
class GlycanBERT(nn.Module):
|
| 204 |
"""
|
| 205 |
+
BERTose transformer stack for masked language modeling.
|
| 206 |
"""
|
| 207 |
|
| 208 |
def __init__(self, config: GlycanBERTConfig):
|
src/bertose_model.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
"""
|
| 2 |
-
|
| 3 |
|
| 4 |
Core glycan representation model with three modalities:
|
| 5 |
- Sequence (WURCS atomic tokenization)
|
|
@@ -148,7 +148,7 @@ def create_residue_level_mask(
|
|
| 148 |
|
| 149 |
|
| 150 |
class MultimodalGlycanBERTConfig:
|
| 151 |
-
"""Configuration for the
|
| 152 |
|
| 153 |
def __init__(
|
| 154 |
self,
|
|
@@ -610,7 +610,7 @@ class CrossAttentionLayer(nn.Module):
|
|
| 610 |
|
| 611 |
class MultimodalGlycanBERT(nn.Module):
|
| 612 |
"""
|
| 613 |
-
|
| 614 |
|
| 615 |
Architecture:
|
| 616 |
1. Separate encoders for each modality (sequence, MS, 3D structure)
|
|
@@ -722,7 +722,7 @@ class MultimodalGlycanBERT(nn.Module):
|
|
| 722 |
return_dict: bool = True,
|
| 723 |
) -> Dict[str, torch.Tensor]:
|
| 724 |
"""
|
| 725 |
-
Forward pass for
|
| 726 |
|
| 727 |
Args:
|
| 728 |
seq_token_ids: (batch_size, seq_len) - Sequence token IDs
|
|
@@ -970,7 +970,7 @@ class MultimodalGlycanBERT(nn.Module):
|
|
| 970 |
if __name__ == "__main__":
|
| 971 |
# Test the model
|
| 972 |
print("="*80)
|
| 973 |
-
print("Testing
|
| 974 |
print("="*80)
|
| 975 |
|
| 976 |
# Create config
|
|
|
|
| 1 |
"""
|
| 2 |
+
BERTose model
|
| 3 |
|
| 4 |
Core glycan representation model with three modalities:
|
| 5 |
- Sequence (WURCS atomic tokenization)
|
|
|
|
| 148 |
|
| 149 |
|
| 150 |
class MultimodalGlycanBERTConfig:
|
| 151 |
+
"""Configuration for the BERTose model."""
|
| 152 |
|
| 153 |
def __init__(
|
| 154 |
self,
|
|
|
|
| 610 |
|
| 611 |
class MultimodalGlycanBERT(nn.Module):
|
| 612 |
"""
|
| 613 |
+
BERTose model for glycan representation learning.
|
| 614 |
|
| 615 |
Architecture:
|
| 616 |
1. Separate encoders for each modality (sequence, MS, 3D structure)
|
|
|
|
| 722 |
return_dict: bool = True,
|
| 723 |
) -> Dict[str, torch.Tensor]:
|
| 724 |
"""
|
| 725 |
+
Forward pass for BERTose.
|
| 726 |
|
| 727 |
Args:
|
| 728 |
seq_token_ids: (batch_size, seq_len) - Sequence token IDs
|
|
|
|
| 970 |
if __name__ == "__main__":
|
| 971 |
# Test the model
|
| 972 |
print("="*80)
|
| 973 |
+
print("Testing BERTose model")
|
| 974 |
print("="*80)
|
| 975 |
|
| 976 |
# Create config
|