Update vLLM usage docs: remove config_vllm.json overwrite, relax version pin, and clarify minimal required flags

#18
Files changed (2) hide show
  1. README.md +37 -18
  2. config_vllm.json +0 -38
README.md CHANGED
@@ -167,37 +167,57 @@ print(scores.tolist())
167
 
168
  #### vLLM Usage
169
 
170
- 1. Ensure you are using `vllm==0.16.0`.
171
- 2. Clone [this model's repository](https://huggingface.co/nvidia/llama-nemotron-embed-1b-v2/tree/main).
172
- 3. Overwrite `config.json` with `config_vllm.json`.
173
- 4. Start the vLLM server with the following command (replace the `<path_to_the_cloned_repository>` and `<num_gpus_to_use>` with your values):
174
  ```
175
  vllm serve \
176
- <path_to_the_cloned_repository> \
177
- --trust-remote-code \
178
- --runner pooling \
179
- --model-impl vllm \
180
- --pooler-config '{\"pooling_type\": \"MEAN\"}' \
181
- --data-parallel-size <num_gpus_to_use> \
182
- --dtype float32 \
183
- --port 8000
184
  ```
185
 
186
- You can now access the model using the OpenAI sdk, for instance:
 
 
 
 
 
 
 
 
 
187
 
188
  ```
189
  from openai import OpenAI
190
- client = OpenAI(base_url="http://localhost:8000/v1")
191
- models = client.models.list()
192
- model_name = models.data[0].id
 
193
 
194
  response = client.embeddings.create(
195
  input=['query: summit define'],
196
- model=model_name
197
  )
198
  response.data[0].embedding
199
  ```
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  ### **Software Integration**
202
 
203
  **Runtime Engine:** Llama Nemotron embedding NIM
@@ -355,4 +375,3 @@ Visit the [NeMo Retriever docs page](https://docs.nvidia.com/nemo/retriever/inde
355
  | Describe the physical safety impact (if present). | Not Applicable |
356
  | Use Case Restrictions: | Use of this model is governed by the [NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/). Additional Information: [Llama 3.2 Community Model License Agreement](https://www.llama.com/llama3_2/license/). |
357
  | Model and dataset restrictions: | The Principle of least privilege (PoLP) is applied limiting access for dataset generation and model development. Restrictions enforce dataset access during training, and dataset license constraints adhered to. |
358
-
 
167
 
168
  #### vLLM Usage
169
 
170
+ 1. Ensure you are using `vllm>=0.14.0`.
171
+ 2. Start the vLLM server with the following command:
172
+
173
+ Minimal command (required):
174
  ```
175
  vllm serve \
176
+ nvidia/llama-nemotron-embed-1b-v2 \
177
+ --trust-remote-code
 
 
 
 
 
 
178
  ```
179
 
180
+ If you already have a local copy of the model, you can also pass the local
181
+ path instead of the HF repo ID.
182
+
183
+ Optional flags:
184
+
185
+ - `--dtype <float32|bfloat16|float16>` to force precision (the default is `auto`, which resolves from model config; this model defaults to BF16).
186
+ - `--data-parallel-size <num_gpus_to_use>` for multi-GPU serving.
187
+ - `--port 8000` to set the server port.
188
+
189
+ Online serving example (OpenAI SDK):
190
 
191
  ```
192
  from openai import OpenAI
193
+ client = OpenAI(
194
+ base_url="http://localhost:8000/v1",
195
+ api_key="EMPTY", # required by OpenAI SDK; ignored by default in local vLLM
196
+ )
197
 
198
  response = client.embeddings.create(
199
  input=['query: summit define'],
200
+ model="nvidia/llama-nemotron-embed-1b-v2",
201
  )
202
  response.data[0].embedding
203
  ```
204
 
205
+ Offline inference example (Python API, no server required):
206
+
207
+ ```
208
+ from vllm import LLM
209
+
210
+ llm = LLM(
211
+ model="nvidia/llama-nemotron-embed-1b-v2",
212
+ runner="pooling",
213
+ trust_remote_code=True,
214
+ )
215
+
216
+ outputs = llm.embed(["query: summit define", "passage: a summit is a meeting"])
217
+ for output in outputs:
218
+ print(len(output.outputs.embedding)) # 2048
219
+ ```
220
+
221
  ### **Software Integration**
222
 
223
  **Runtime Engine:** Llama Nemotron embedding NIM
 
375
  | Describe the physical safety impact (if present). | Not Applicable |
376
  | Use Case Restrictions: | Use of this model is governed by the [NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license/). Additional Information: [Llama 3.2 Community Model License Agreement](https://www.llama.com/llama3_2/license/). |
377
  | Model and dataset restrictions: | The Principle of least privilege (PoLP) is applied limiting access for dataset generation and model development. Restrictions enforce dataset access during training, and dataset license constraints adhered to. |
 
config_vllm.json DELETED
@@ -1,38 +0,0 @@
1
- {
2
- "_name_or_path": "nvidia/llama-3.2-nv-embedqa-1b-v2",
3
- "architectures": [
4
- "LlamaModel"
5
- ],
6
- "attention_bias": false,
7
- "attention_dropout": 0.0,
8
- "bos_token_id": 128000,
9
- "eos_token_id": 128001,
10
- "head_dim": 64,
11
- "hidden_act": "silu",
12
- "hidden_size": 2048,
13
- "initializer_range": 0.02,
14
- "intermediate_size": 8192,
15
- "max_position_embeddings": 131072,
16
- "is_causal": false,
17
- "mlp_bias": false,
18
- "model_type": "llama",
19
- "num_attention_heads": 32,
20
- "num_hidden_layers": 16,
21
- "num_key_value_heads": 8,
22
- "pooling": "avg",
23
- "pretraining_tp": 1,
24
- "rms_norm_eps": 1e-05,
25
- "rope_scaling": {
26
- "factor": 32.0,
27
- "high_freq_factor": 4.0,
28
- "low_freq_factor": 1.0,
29
- "original_max_position_embeddings": 8192,
30
- "rope_type": "llama3"
31
- },
32
- "rope_theta": 500000.0,
33
- "tie_word_embeddings": true,
34
- "torch_dtype": "bfloat16",
35
- "transformers_version": "4.44.2",
36
- "use_cache": true,
37
- "vocab_size": 128256
38
- }