Text Classification
Transformers
Safetensors
modernbert
tiny
random
test
testing
text-embeddings-inference
Instructions to use VINAY-UMRETHE/tiny-refusal-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VINAY-UMRETHE/tiny-refusal-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="VINAY-UMRETHE/tiny-refusal-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("VINAY-UMRETHE/tiny-refusal-classifier") model = AutoModelForSequenceClassification.from_pretrained("VINAY-UMRETHE/tiny-refusal-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from VINAY-UMRETHE/tiny-refusal-classifier: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/VINAY-UMRETHE/tiny-refusal-classifier/resolve/main/README.md
- Command line
-
hf download hf://VINAY-UMRETHE/tiny-refusal-classifier/README.md
-
curl -L -o README.md https://huggingface.co/VINAY-UMRETHE/tiny-refusal-classifier/resolve/main/README.md
2.57 kB
| library_name: transformers | |
| base_model: | |
| - VINAY-UMRETHE/Refusal-Classifier | |
| license: apache-2.0 | |
| pipeline_tag: text-classification | |
| tags: | |
| - tiny | |
| - random | |
| - test | |
| - testing | |
| # Tiny Randomly Initialized | |
| **Base Model:** [VINAY-UMRETHE/Refusal-Classifier](https://huggingface.co/VINAY-UMRETHE/Refusal-Classifier) | |
| ## Purpose | |
| This is a tiny, randomly initialized model that has **not** been trained on any dataset, so do *not* use this model for any real refusal classification tasks. It is used for **testing** in the GitHub CI of [p-e-w/heretic](https://github.com/p-e-w/heretic) *(implemented in [feat: Generic BERT Classifier scorer plugin #500](https://github.com/p-e-w/heretic/pull/500))*, similar to how the other reproduction tests use models from the [tiny-random](https://huggingface.co/tiny-random) organization. | |
| You can also use this model for debugging without loading the real models *(e.g. [VINAY-UMRETHE/Refusal-Classifier](https://huggingface.co/VINAY-UMRETHE/Refusal-Classifier), [VINAY-UMRETHE/Refusal-Classifier-V2](https://huggingface.co/VINAY-UMRETHE/Refusal-Classifier-V2), etc.)*, as they share the same architecture and configuration ([ModernBERT](https://huggingface.co/docs/transformers/en/model_doc/modernbert)). | |
| ## How this model was created | |
| ```python | |
| from typing import cast | |
| import torch | |
| from transformers import ( | |
| AutoConfig, | |
| AutoTokenizer, | |
| ModernBertForSequenceClassification, | |
| PreTrainedTokenizerBase, | |
| set_seed, | |
| ) | |
| source_model_id = "VINAY-UMRETHE/Refusal-Classifier" | |
| save_folder = "tiny-refusal-classifier" | |
| tokenizer = cast( | |
| PreTrainedTokenizerBase, | |
| AutoTokenizer.from_pretrained(source_model_id), | |
| ) | |
| tokenizer.save_pretrained(save_folder) | |
| config = AutoConfig.from_pretrained(source_model_id) | |
| config.hidden_size = 32 | |
| config.intermediate_size = 128 | |
| config.num_attention_heads = 1 | |
| config.num_hidden_layers = 2 | |
| config.layer_types = config.layer_types[:2] | |
| model = ModernBertForSequenceClassification(config) | |
| # FP32, matching the source model's dtype. | |
| # Expected: torch.float32 | |
| print(next(model.parameters()).dtype) | |
| set_seed(75) | |
| with torch.no_grad(): | |
| for name, parameter in sorted(model.named_parameters()): | |
| torch.nn.init.normal_(parameter, 0, 0.5) | |
| print(name, parameter.shape) | |
| model.save_pretrained(save_folder) | |
| # Upload: | |
| # model.push_to_hub(repo_id="VINAY-UMRETHE/tiny-refusal-classifier") | |
| # tokenizer.push_to_hub(repo_id="VINAY-UMRETHE/tiny-refusal-classifier") | |
| ``` | |
| ## License | |
| Copyright © 2026 Vinay Umrethe. | |
| This model is licensed under the **Apache License 2.0** License. |