# SGLang inference config for Llama 3.2 11B Vision Instruct.
#
# Requirements:
#   - Install SGLang: https://docs.sglang.ai/start/install.html
#   - Log into HF: `hf auth login`
#   - Request access to Llama 3.2: https://huggingface.co/meta-llama/Llama-3.2-11B-Vision-Instruct
#
# Usage:
#   oumi infer -i -c configs/recipes/vision/llama3_2_vision/inference/11b_sglang_infer.yaml \
#     --image "tests/testdata/images/the_great_wave_off_kanagawa.jpg"
#
# Sample command to start SGLang server using Docker
# (the recommended method, avoids Python dependencies conflicts):
# https://docs.sglang.ai/start/install.html#method-3-using-docker
#
# docker run --gpus all --shm-size 32g -p 6864:6864 --ipc=host  \
#     -v ~/.cache/huggingface:/root/.cache/huggingface          \
#     lmsysorg/sglang:latest \
#     python3 -m sglang.launch_server \
#     --model-path meta-llama/Llama-3.2-11B-Vision-Instruct     \
#     --tokenizer-path meta-llama/Llama-3.2-11B-Vision-Instruct \
#     --host 0.0.0.0 --port 6864 --disable-cuda-graph --mem-fraction-static=0.9
# For GPU-s with less than 40GB of VRAM, try --mem-fraction-static=0.99
#
# Sample command to start SGLang server using Python:
# CUDA_VISIBLE_DEVICES=0 python -m sglang.launch_server \
#     --model-path meta-llama/Llama-3.2-11B-Vision-Instruct \
#     --tokenizer-path meta-llama/Llama-3.2-11B-Vision-Instruct \
#     --port 6864 --disable-cuda-graph --mem-fraction-static=0.9
# For GPU-s with less than 40GB of VRAM, try --mem-fraction-static=0.99
#
# See Also:
#   - Documentation: https://oumi.ai/docs/en/latest/user_guides/infer/infer.html
#   - Config class: oumi.core.configs.InferenceConfig
#   - Config source: https://github.com/oumi-ai/oumi/blob/main/src/oumi/core/configs/inference_config.py
#   - Other inference configs: configs/**/inference/

model:
  model_name: "meta-llama/Llama-3.2-11B-Vision-Instruct"
  torch_dtype_str: "bfloat16"
  model_max_length: 1024
  chat_template: "llama3-instruct"
  trust_remote_code: True

generation:
  max_new_tokens: 32

remote_params:
  # This address is just an example (it's what you usually get when you start sglang sever locally).
  # For production use, set it to a remote address/port.
  # For more details, see the following:
  # https://sgl-project.github.io/references/sampling_params.html
  # https://github.com/skypilot-org/skypilot/blob/master/llm/sglang/README.md
  api_url: "http://127.0.0.1:6864/generate"

engine: SGLANG
