Instructions to use rbln/tiny-Llama4ForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use rbln/tiny-Llama4ForConditionalGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="rbln/tiny-Llama4ForConditionalGeneration")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("rbln/tiny-Llama4ForConditionalGeneration") model = AutoModelForMultimodalLM.from_pretrained("rbln/tiny-Llama4ForConditionalGeneration", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use rbln/tiny-Llama4ForConditionalGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "rbln/tiny-Llama4ForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "rbln/tiny-Llama4ForConditionalGeneration", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/rbln/tiny-Llama4ForConditionalGeneration
- SGLang
How to use rbln/tiny-Llama4ForConditionalGeneration 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 "rbln/tiny-Llama4ForConditionalGeneration" \ --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": "rbln/tiny-Llama4ForConditionalGeneration", "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 "rbln/tiny-Llama4ForConditionalGeneration" \ --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": "rbln/tiny-Llama4ForConditionalGeneration", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use rbln/tiny-Llama4ForConditionalGeneration with Docker Model Runner:
docker model run hf.co/rbln/tiny-Llama4ForConditionalGeneration
Upload folder using huggingface_hub
Browse files- README.md +12 -0
- config.json +103 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# tiny-Llama4ForConditionalGeneration
|
| 6 |
+
|
| 7 |
+
Tiny randomly initialized **dense** Llama 4 (Llama4ForConditionalGeneration) for optimum-rbln tests.
|
| 8 |
+
|
| 9 |
+
- Text: 4 layers (3 chunked attention + 1 NoPE full attention), hidden 8, head_dim 128, attention_chunk_size 128, no MoE layers.
|
| 10 |
+
- Vision: 2 layers, hidden 16.
|
| 11 |
+
- The weights are random; no tokenizer or processor is included.
|
| 12 |
+
Load them from a Llama 4 model such as meta-llama/Llama-4-Scout-17B-16E-Instruct.
|
config.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Llama4ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"boi_token_index": 200080,
|
| 6 |
+
"dtype": "float32",
|
| 7 |
+
"eoi_token_index": 200081,
|
| 8 |
+
"image_token_index": 200092,
|
| 9 |
+
"model_type": "llama4",
|
| 10 |
+
"text_config": {
|
| 11 |
+
"_attn_implementation_autoset": true,
|
| 12 |
+
"attention_bias": false,
|
| 13 |
+
"attention_chunk_size": 128,
|
| 14 |
+
"attention_dropout": 0.0,
|
| 15 |
+
"attn_scale": 0.1,
|
| 16 |
+
"attn_temperature_tuning": true,
|
| 17 |
+
"bos_token_id": 200000,
|
| 18 |
+
"cache_implementation": "static",
|
| 19 |
+
"dtype": "float32",
|
| 20 |
+
"eos_token_id": [
|
| 21 |
+
200001,
|
| 22 |
+
200007,
|
| 23 |
+
200008
|
| 24 |
+
],
|
| 25 |
+
"floor_scale": 8192,
|
| 26 |
+
"for_llm_compressor": false,
|
| 27 |
+
"head_dim": 128,
|
| 28 |
+
"hidden_act": "silu",
|
| 29 |
+
"hidden_size": 8,
|
| 30 |
+
"initializer_range": 0.02,
|
| 31 |
+
"interleave_moe_layer_step": 0,
|
| 32 |
+
"intermediate_size": 32,
|
| 33 |
+
"intermediate_size_mlp": 32,
|
| 34 |
+
"layer_types": [
|
| 35 |
+
"chunked_attention",
|
| 36 |
+
"chunked_attention",
|
| 37 |
+
"chunked_attention",
|
| 38 |
+
"full_attention"
|
| 39 |
+
],
|
| 40 |
+
"max_position_embeddings": 1024,
|
| 41 |
+
"model_type": "llama4_text",
|
| 42 |
+
"moe_layers": [],
|
| 43 |
+
"no_rope_layer_interval": 4,
|
| 44 |
+
"no_rope_layers": [
|
| 45 |
+
1,
|
| 46 |
+
1,
|
| 47 |
+
1,
|
| 48 |
+
0
|
| 49 |
+
],
|
| 50 |
+
"num_attention_heads": 4,
|
| 51 |
+
"num_experts_per_tok": 1,
|
| 52 |
+
"num_hidden_layers": 4,
|
| 53 |
+
"num_key_value_heads": 2,
|
| 54 |
+
"num_local_experts": 0,
|
| 55 |
+
"output_router_logits": false,
|
| 56 |
+
"pad_token_id": 200018,
|
| 57 |
+
"rms_norm_eps": 1e-05,
|
| 58 |
+
"rope_parameters": {
|
| 59 |
+
"factor": 16,
|
| 60 |
+
"high_freq_factor": 1,
|
| 61 |
+
"low_freq_factor": 1.0,
|
| 62 |
+
"original_max_position_embeddings": 8192,
|
| 63 |
+
"rope_theta": 500000.0,
|
| 64 |
+
"rope_type": "llama3"
|
| 65 |
+
},
|
| 66 |
+
"router_aux_loss_coef": 0.001,
|
| 67 |
+
"router_jitter_noise": 0.0,
|
| 68 |
+
"tie_word_embeddings": false,
|
| 69 |
+
"use_cache": true,
|
| 70 |
+
"use_qk_norm": true,
|
| 71 |
+
"vocab_size": 202048
|
| 72 |
+
},
|
| 73 |
+
"tie_word_embeddings": false,
|
| 74 |
+
"transformers_version": "5.15.1",
|
| 75 |
+
"vision_config": {
|
| 76 |
+
"_attn_implementation_autoset": true,
|
| 77 |
+
"attention_dropout": 0.0,
|
| 78 |
+
"dtype": "float32",
|
| 79 |
+
"hidden_act": "gelu",
|
| 80 |
+
"hidden_size": 16,
|
| 81 |
+
"image_size": 336,
|
| 82 |
+
"initializer_range": 0.02,
|
| 83 |
+
"intermediate_size": 64,
|
| 84 |
+
"model_type": "llama4_vision_model",
|
| 85 |
+
"multi_modal_projector_bias": false,
|
| 86 |
+
"norm_eps": 1e-05,
|
| 87 |
+
"num_attention_heads": 4,
|
| 88 |
+
"num_channels": 3,
|
| 89 |
+
"num_hidden_layers": 2,
|
| 90 |
+
"patch_size": 14,
|
| 91 |
+
"pixel_shuffle_ratio": 0.5,
|
| 92 |
+
"projector_dropout": 0.0,
|
| 93 |
+
"projector_input_dim": 16,
|
| 94 |
+
"projector_output_dim": 16,
|
| 95 |
+
"rope_parameters": {
|
| 96 |
+
"rope_theta": 10000,
|
| 97 |
+
"rope_type": "default"
|
| 98 |
+
},
|
| 99 |
+
"vision_feature_layer": -1,
|
| 100 |
+
"vision_feature_select_strategy": "default",
|
| 101 |
+
"vision_output_dim": 16
|
| 102 |
+
}
|
| 103 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 200000,
|
| 3 |
+
"eos_token_id": [
|
| 4 |
+
200001,
|
| 5 |
+
200007,
|
| 6 |
+
200008
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 200018,
|
| 9 |
+
"transformers_version": "5.15.1"
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:74c2bafc73218c96a183985bd8c226470e47e8fc122d6754b318d436c0ef0f00
|
| 3 |
+
size 13256608
|