Instructions to use Xenova/tiny-random-LlavaForConditionalGeneration_phi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use Xenova/tiny-random-LlavaForConditionalGeneration_phi with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-text-to-text', 'Xenova/tiny-random-LlavaForConditionalGeneration_phi'); - Transformers
How to use Xenova/tiny-random-LlavaForConditionalGeneration_phi with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Xenova/tiny-random-LlavaForConditionalGeneration_phi")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Xenova/tiny-random-LlavaForConditionalGeneration_phi") model = AutoModelForMultimodalLM.from_pretrained("Xenova/tiny-random-LlavaForConditionalGeneration_phi", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Xenova/tiny-random-LlavaForConditionalGeneration_phi with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Xenova/tiny-random-LlavaForConditionalGeneration_phi" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Xenova/tiny-random-LlavaForConditionalGeneration_phi", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Xenova/tiny-random-LlavaForConditionalGeneration_phi
- SGLang
How to use Xenova/tiny-random-LlavaForConditionalGeneration_phi 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 "Xenova/tiny-random-LlavaForConditionalGeneration_phi" \ --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": "Xenova/tiny-random-LlavaForConditionalGeneration_phi", "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 "Xenova/tiny-random-LlavaForConditionalGeneration_phi" \ --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": "Xenova/tiny-random-LlavaForConditionalGeneration_phi", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Xenova/tiny-random-LlavaForConditionalGeneration_phi with Docker Model Runner:
docker model run hf.co/Xenova/tiny-random-LlavaForConditionalGeneration_phi
File size: 1,562 Bytes
2297735 d06cde7 2297735 a245809 2297735 a245809 2297735 a245809 2297735 a245809 2297735 a245809 2297735 a245809 2297735 a245809 2297735 a245809 2297735 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | {
"_name_or_path": "Xenova/tiny-random-LlavaForConditionalGeneration",
"architectures": [
"LlavaForConditionalGeneration"
],
"ignore_index": -100,
"image_token_index": 32000,
"model_type": "llava",
"projector_hidden_act": "gelu",
"text_config": {
"architectures": [
"PhiForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 0,
"embd_pdrop": 0.0,
"eos_token_id": 1,
"hidden_act": "silu",
"hidden_size": 16,
"initializer_range": 0.02,
"intermediate_size": 64,
"layer_norm_eps": 1e-05,
"max_position_embeddings": 2048,
"model_type": "phi",
"num_attention_heads": 4,
"num_hidden_layers": 2,
"num_key_value_heads": 4,
"pad_token_id": -1,
"partial_rotary_factor": 0.5,
"pretraining_tp": 1,
"qk_layernorm": false,
"resid_pdrop": 0.0,
"rms_norm_eps": 1e-06,
"rope_scaling": null,
"rope_theta": 10000.0,
"tie_word_embeddings": false,
"torch_dtype": "float32",
"transformers_version": "4.38.2",
"use_cache": true,
"vocab_size": 32002
},
"torch_dtype": "float32",
"transformers_version": "4.38.2",
"vision_config": {
"attention_dropout": 0.1,
"dropout": 0.1,
"hidden_size": 32,
"image_size": 30,
"intermediate_size": 37,
"model_type": "clip_vision_model",
"num_attention_heads": 4,
"num_hidden_layers": 2,
"patch_size": 2,
"projection_dim": 32
},
"vision_feature_layer": -2,
"vision_feature_select_strategy": "default",
"vocab_size": 32002
}
|