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)
- config.json+20-3
- generation_config.json+1-1
- model.safetensors+2-2
1 unmodified line234556789101112131415161718192021222324252627282930312132333435233637383940414243444546471 unmodified line "architectures": [ "LlavaForConditionalGeneration" ], "ignore_index": -100, "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": 2, "hidden_act": "silu", "hidden_size": 8, "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.47.0.dev0", "transformers_version": "4.54.0.dev0", "vision_config": { "attention_dropout": 0.0, "hidden_act": "quick_gelu", "hidden_size": 8, "hidden_size": 16, "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": 81 unmodified line2345561 unmodified line "_from_model_config": true, "bos_token_id": 1, "eos_token_id": 2, "transformers_version": "4.47.0.dev0" "transformers_version": "4.54.0.dev0"}12323version https://git-lfs.github.com/spec/v1oid sha256:eb60b1bc3c41b94aec9c4c24111b3dd3a5b1853317fce7d967cbea4263464e1asize 2108896oid sha256:5f54b0ec090dd9d4ec1955951dc2d1449bcf1cffebcee2f651554858609f23c6size 2157456config.json+20-3
generation_config.json+1-1
model.safetensors+2-2