forked from opendatahub-io/vllm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request opendatahub-io#109 from ROCm/simple_fp8_inference_…
…example adding a simple model invocation involving fp8 calculation/storage
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from vllm import LLM, SamplingParams | ||
|
||
|
||
def test_fp8_offline_inference(): | ||
# Create a sampling params object. | ||
sampling_params = SamplingParams(temperature=0.8, top_p=0.95) | ||
|
||
# Create an LLM | ||
llm = LLM( | ||
model="/data/models/llama-2-7b-chat-hf", | ||
kv_cache_dtype="fp8", | ||
quantization_param_path = \ | ||
"./tests/fp8_kv/llama2-7b-fp8-kv/kv_cache_scales.json" | ||
) | ||
|
||
prompt = "London is the capital of" | ||
|
||
# Generate model response | ||
out = llm.generate(prompt, sampling_params)[0].outputs[0].text | ||
|
||
assert out == (" England and the United Kingdom." | ||
" It is located in the southeastern part of") |