ligeng-zhu-nv commited on
Commit
579baac
·
verified ·
1 Parent(s): b1673ed

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +37 -9
README.md CHANGED
@@ -62,19 +62,47 @@ pip install -U huggingface_hub
62
  huggingface-cli download nvidia/EGM-4B --local-dir ./models/EGM-4B
63
  ```
64
 
65
- ### Evaluation
 
 
66
 
67
  ```bash
68
- pip install sglang==0.5.5
69
 
70
- export BASE_DIR=$(pwd)
71
- export MODEL_PATH="${BASE_DIR}/models/EGM-4B"
72
- export DATA_JSON="${BASE_DIR}/data/EGM_Datasets/metadata/eval/refcoco+_testA.jsonl"
73
- export OUTPUT_DIR="${BASE_DIR}/result/"
74
- export BASE_IMG_DIR="${BASE_DIR}"
75
 
76
- cd verl
77
- bash scripts/sglang_infer.sh
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  ```
79
 
80
  ## Model Architecture
 
62
  huggingface-cli download nvidia/EGM-4B --local-dir ./models/EGM-4B
63
  ```
64
 
65
+ ### Inference with SGLang
66
+
67
+ Launch the server:
68
 
69
  ```bash
70
+ pip install "sglang[all]>=0.5.5"
71
 
72
+ python -m sglang.launch_server \
73
+ --model-path nvidia/EGM-4B \
74
+ --chat-template=qwen3-vl \
75
+ --port 30000
76
+ ```
77
 
78
+ Send a visual grounding request:
79
+
80
+ ```python
81
+ import openai
82
+ import base64
83
+
84
+ client = openai.Client(base_url="http://127.0.0.1:30000/v1", api_key="EMPTY")
85
+
86
+ # Load a local image as base64
87
+ with open("example.jpg", "rb") as f:
88
+ image_base64 = base64.b64encode(f.read()).decode("utf-8")
89
+
90
+ response = client.chat.completions.create(
91
+ model="nvidia/EGM-4B",
92
+ messages=[
93
+ {
94
+ "role": "user",
95
+ "content": [
96
+ {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{image_base64}"}},
97
+ {"type": "text", "text": "Please provide the bounding box coordinate of the region this sentence describes: the person on the left."},
98
+ ],
99
+ }
100
+ ],
101
+ temperature=0.6,
102
+ top_p=0.95,
103
+ max_tokens=8192,
104
+ )
105
+ print(response.choices[0].message.content)
106
  ```
107
 
108
  ## Model Architecture