Instructions to use hf-tiny-model-private/tiny-random-MegaForCausalLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hf-tiny-model-private/tiny-random-MegaForCausalLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hf-tiny-model-private/tiny-random-MegaForCausalLM")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("hf-tiny-model-private/tiny-random-MegaForCausalLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hf-tiny-model-private/tiny-random-MegaForCausalLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hf-tiny-model-private/tiny-random-MegaForCausalLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hf-tiny-model-private/tiny-random-MegaForCausalLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hf-tiny-model-private/tiny-random-MegaForCausalLM
- SGLang
How to use hf-tiny-model-private/tiny-random-MegaForCausalLM 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 "hf-tiny-model-private/tiny-random-MegaForCausalLM" \ --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": "hf-tiny-model-private/tiny-random-MegaForCausalLM", "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 "hf-tiny-model-private/tiny-random-MegaForCausalLM" \ --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": "hf-tiny-model-private/tiny-random-MegaForCausalLM", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hf-tiny-model-private/tiny-random-MegaForCausalLM with Docker Model Runner:
docker model run hf.co/hf-tiny-model-private/tiny-random-MegaForCausalLM
| { | |
| "activation": "silu", | |
| "add_lm_hidden_dense_layer": true, | |
| "add_token_type_embeddings": true, | |
| "architectures": [ | |
| "MegaForCausalLM" | |
| ], | |
| "attention_activation": "softmax", | |
| "attention_probs_dropout_prob": 0.1, | |
| "bidirectional": false, | |
| "bos_token_id": 0, | |
| "chunk_size": 32, | |
| "classifier_dropout": null, | |
| "dropout_prob": 0.1, | |
| "ema_beta_range": 0.02, | |
| "ema_delta_alpha_range": 0.2, | |
| "ema_gamma_omega_range": 1.0, | |
| "ema_projection_size": 16, | |
| "eos_token_id": 2, | |
| "hidden_dropout_prob": 0.1, | |
| "hidden_size": 32, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 37, | |
| "is_decoder": true, | |
| "max_positions": 1024, | |
| "model_type": "mega", | |
| "nffn_activation_dropout_prob": 0.1, | |
| "nffn_hidden_size": 24, | |
| "norm_affine": true, | |
| "normalization_type": "scalenorm", | |
| "normalize_before_ffn": true, | |
| "normalize_before_mega": true, | |
| "num_attention_heads": 1, | |
| "num_hidden_layers": 5, | |
| "pad_token_id": 1, | |
| "relative_positional_bias": "rotary", | |
| "shared_representation_size": 64, | |
| "torch_dtype": "float32", | |
| "transformers_version": "4.28.0.dev0", | |
| "truncation": null, | |
| "type_vocab_size": 2, | |
| "use_cache": true, | |
| "use_chunking": false, | |
| "use_feature_dropout": false, | |
| "use_normalized_ffn": true, | |
| "vocab_size": 1024 | |
| } | |