Text Classification
Transformers
Safetensors
English
roformer
binary-analysis
file-type-detection
byte-level
classification
mime-type
rope
security
custom_code
Eval Results (legacy)
Instructions to use mjbommar/magic-bert-50m-roformer-classification with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mjbommar/magic-bert-50m-roformer-classification with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="mjbommar/magic-bert-50m-roformer-classification", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("mjbommar/magic-bert-50m-roformer-classification", trust_remote_code=True) model = AutoModelForSequenceClassification.from_pretrained("mjbommar/magic-bert-50m-roformer-classification", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
| """RoFormer configuration for classification with projection head.""" | |
| from transformers import RoFormerConfig | |
| class RoFormerClassificationConfig(RoFormerConfig): | |
| """Configuration for RoFormer with contrastive projection head. | |
| Extends RoFormerConfig with additional parameters for the projection head | |
| used in contrastive learning for file type classification. | |
| """ | |
| model_type = "roformer-classification" | |
| def __init__( | |
| self, | |
| projection_dim: int = 256, | |
| num_labels: int = 106, | |
| **kwargs, | |
| ): | |
| """Initialize configuration. | |
| Args: | |
| projection_dim: Dimension of the projection head output (for embeddings) | |
| num_labels: Number of classification labels (MIME types) | |
| **kwargs: Additional arguments passed to RoFormerConfig | |
| """ | |
| super().__init__(**kwargs) | |
| self.projection_dim = projection_dim | |
| self.num_labels = num_labels | |