def test_runner_gpu_configuration(
    container_from_file: t.Callable[[str], ConfigDictType],
):
    GPU_INDEX = """\
runners:
    resources:
        nvidia.com/gpu: [1, 2, 4]
    workers_per_resource: 1
"""
    bentoml_cfg = container_from_file(GPU_INDEX)
    assert bentoml_cfg["runners"]["resources"] == {"nvidia.com/gpu": [1, 2, 4]}
    assert bentoml_cfg["runners"]["workers_per_resource"] == 1

    GPU_INDEX_WITH_STRING = """\
runners:
    resources:
        nvidia.com/gpu: "[1, 2, 4]"
    workers_per_resource: 2
"""
    bentoml_cfg = container_from_file(GPU_INDEX_WITH_STRING)
    # this behaviour can be confusing
    assert bentoml_cfg["runners"]["resources"] == {"nvidia.com/gpu": "[1, 2, 4]"}
    assert bentoml_cfg["runners"]["workers_per_resource"] == 2
bentoml_cfg = container_from_file(GPU_INDEX)
assert bentoml_cfg["runners"]["resources"] == {"nvidia.com/gpu": [1, 2, 4]}
assert bentoml_cfg["runners"]["workers_per_resource"] == 1

GPU_INDEX_WITH_STRING = """\
runners:
resources:
nvidia.com/gpu: "[1, 2, 4]"
workers_per_resource: 2
tests/unit/_internal/configuration/test_containers.py