Run this model with HF Jobs
Run trl-internal-testing/tiny-LlavaForConditionalGeneration on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/trl-internal-testing/tiny-LlavaForConditionalGeneration. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/trl-internal-testing/tiny-LlavaForConditionalGeneration on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/trl-internal-testing/tiny-LlavaForConditionalGeneration. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/trl-internal-testing/tiny-LlavaForConditionalGeneration. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use trl-internal-testing/tiny-LlavaForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-LlavaForConditionalGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="trl-internal-testing/tiny-LlavaForConditionalGeneration") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("trl-internal-testing/tiny-LlavaForConditionalGeneration") model = AutoModelForMultimodalLM.from_pretrained("trl-internal-testing/tiny-LlavaForConditionalGeneration", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use trl-internal-testing/tiny-LlavaForConditionalGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trl-internal-testing/tiny-LlavaForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-LlavaForConditionalGeneration", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/trl-internal-testing/tiny-LlavaForConditionalGeneration
- SGLang
How to use trl-internal-testing/tiny-LlavaForConditionalGeneration 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 "trl-internal-testing/tiny-LlavaForConditionalGeneration" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-LlavaForConditionalGeneration", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "trl-internal-testing/tiny-LlavaForConditionalGeneration" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-LlavaForConditionalGeneration", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use trl-internal-testing/tiny-LlavaForConditionalGeneration with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-LlavaForConditionalGeneration
Upload LlavaForConditionalGeneration
Browse filesFiles changed (3)
1 unmodified line23456789101112131415161718192021222324252627282930313233342 unmodified lines3738394041424344454647484950511 unmodified line"architectures": ["LlavaForConditionalGeneration"],"image_seq_length": 576,"image_token_index": 32000,"model_type": "llava","multimodal_projector_bias": true,"projector_hidden_act": "gelu","text_config": {"attention_bias": false,"attention_dropout": 0.0,"head_dim": 4,"hidden_act": "silu","hidden_size": 16,"initializer_range": 0.02,"intermediate_size": 32,"max_position_embeddings": 2048,"mlp_bias": false,"model_type": "llama","num_attention_heads": 4,"num_hidden_layers": 2,"num_key_value_heads": 2,"pretraining_tp": 1,"rms_norm_eps": 1e-06,"rope_scaling": null,"rope_theta": 10000.0,"use_cache": true,"vocab_size": 32005},"torch_dtype": "float32","transformers_version": "4.56.0.dev0","vision_config": {"attention_dropout": 0.0,2 unmodified lines"image_size": 336,"initializer_factor": 1.0,"initializer_range": 0.02,"intermediate_size": 32,"layer_norm_eps": 1e-05,"model_type": "clip_vision_model","num_attention_heads": 4,"num_channels": 3,"num_hidden_layers": 2,"patch_size": 14,"projection_dim": 8},"vision_feature_layer": -2,"vision_feature_select_strategy": "default"}1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041422 unmodified lines4546474849505152535455565758596061621 unmodified line"architectures": ["LlavaForConditionalGeneration"],"ignore_index": -100,"image_seq_length": 576,"image_token_index": 32000,"model_type": "llava","multimodal_projector_bias": true,"pad_token_id": 32001,"projector_hidden_act": "gelu","text_config": {"_name_or_path": "lmsys/vicuna-7b-v1.5","architectures": ["LlamaForCausalLM"],"attention_bias": false,"attention_dropout": 0.0,"head_dim": 128,"hidden_act": "silu","hidden_size": 16,"initializer_range": 0.02,"intermediate_size": 11008,"max_position_embeddings": 4096,"mlp_bias": false,"model_type": "llama","num_attention_heads": 4,"num_hidden_layers": 2,"num_key_value_heads": 2,"pretraining_tp": 1,"rms_norm_eps": 1e-05,"rope_scaling": null,"rope_theta": 10000.0,"torch_dtype": "float16","use_cache": true,"vocab_size": 32064},"tie_word_embeddings": false,"torch_dtype": "bfloat16","transformers_version": "4.56.0.dev0","vision_config": {"attention_dropout": 0.0,2 unmodified lines"image_size": 336,"initializer_factor": 1.0,"initializer_range": 0.02,"intermediate_size": 4096,"layer_norm_eps": 1e-05,"model_type": "clip_vision_model","num_attention_heads": 4,"num_channels": 3,"num_hidden_layers": 2,"num_key_value_heads": 2,"patch_size": 14,"projection_dim": 768,"vocab_size": 32000},"vision_feature_layer": -2,"vision_feature_select_strategy": "default","vocab_size": 32064}
1 unmodified line234561 unmodified line"_from_model_config": true,"bos_token_id": 1,"eos_token_id": 2,"transformers_version": "4.56.0.dev0"}1 unmodified line2345671 unmodified line"_from_model_config": true,"bos_token_id": 1,"eos_token_id": 2,"pad_token_id": 32001,"transformers_version": "4.56.0.dev0"}
123version https://git-lfs.github.com/spec/v1oid sha256:97667e386c55a9029f3d4dad52c8c7a4b14ac4b1bcd3defb4d62c05a3af7a241size 4218064123version https://git-lfs.github.com/spec/v1oid sha256:a32ec14543807116ef58a58004b5c2991650262e60958dbe95019f4b92d35ebfsize 4855896
config.json+20-9
generation_config.json+1
model.safetensors+2-2