Skip to content

Commit 241d964

Browse files
committed
fix amd Examples Test
Signed-off-by: Yida Wu <yida.wu@amd.com>
1 parent fcd5306 commit 241d964

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

examples/offline_inference/basic/embed.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33

4+
import os
5+
46
from argparse import Namespace
57

68
from vllm import LLM, EngineArgs
9+
from vllm.platforms import current_platform
710
from vllm.utils.argparse_utils import FlexibleArgumentParser
811

912

@@ -20,6 +23,8 @@ def parse_args():
2023

2124

2225
def main(args: Namespace):
26+
if current_platform.is_rocm():
27+
os.environ["VLLM_ATTENTION_BACKEND"] = "FLEX_ATTENTION"
2328
# Sample prompts.
2429
prompts = [
2530
"Hello, my name is",

examples/offline_inference/basic/score.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33

4+
import os
5+
46
from argparse import Namespace
57

68
from vllm import LLM, EngineArgs
9+
from vllm.platforms import current_platform
710
from vllm.utils.argparse_utils import FlexibleArgumentParser
811

912

@@ -20,6 +23,8 @@ def parse_args():
2023

2124

2225
def main(args: Namespace):
26+
if current_platform.is_rocm():
27+
os.environ["VLLM_ATTENTION_BACKEND"] = "FLEX_ATTENTION"
2328
# Sample prompts.
2429
text_1 = "What is the capital of France?"
2530
texts_2 = [

0 commit comments

Comments
 (0)