Instructions to use onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM") model = AutoModelForCausalLM.from_pretrained("onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM
- SGLang
How to use onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM with Docker Model Runner:
docker model run hf.co/onnx-internal-testing/tiny-random-ModernBertDecoderForCausalLM
| { | |
| "architectures": [ | |
| "ModernBertDecoderForCausalLM" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "bos_token": "[CLS]", | |
| "bos_token_id": 50281, | |
| "causal_mask": true, | |
| "classifier_activation": "gelu", | |
| "classifier_bias": false, | |
| "classifier_dropout": 0.0, | |
| "classifier_pooling": "mean", | |
| "cls_token_id": 50281, | |
| "decoder_bias": true, | |
| "deterministic_flash_attn": false, | |
| "embedding_dropout": 0.0, | |
| "eos_token": "[SEP]", | |
| "eos_token_id": 50282, | |
| "global_attn_every_n_layers": 3, | |
| "global_rope_theta": 160000.0, | |
| "gradient_checkpointing": false, | |
| "hidden_activation": "gelu", | |
| "hidden_size": 32, | |
| "initializer_cutoff_factor": 2.0, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 32, | |
| "is_causal": true, | |
| "layer_norm_eps": 1e-05, | |
| "layer_types": [ | |
| "full_attention", | |
| "sliding_attention" | |
| ], | |
| "local_rope_theta": 160000.0, | |
| "masked_prediction": false, | |
| "max_position_embeddings": 7999, | |
| "mlp_bias": false, | |
| "mlp_dropout": 0.0, | |
| "model_type": "modernbert-decoder", | |
| "norm_bias": false, | |
| "norm_eps": 1e-05, | |
| "num_attention_heads": 4, | |
| "num_hidden_layers": 2, | |
| "pad_token_id": 50283, | |
| "position_embedding_type": "sans_pos", | |
| "reference_compile": false, | |
| "sep_token_id": 50282, | |
| "sliding_window": 64, | |
| "tokenizer_class": "PreTrainedTokenizerFast", | |
| "torch_dtype": "float32", | |
| "transformers_version": "4.54.0.dev0", | |
| "unk_token": "[UNK]", | |
| "use_cache": true, | |
| "vocab_size": 50368 | |
| } | |