Making it work ?

This commit is contained in:
Nicolas Patry 2024-06-05 15:52:09 +02:00
parent a55917fb43
commit 3539ea37e2
2 changed files with 16 additions and 3 deletions

View File

@ -39,4 +39,5 @@ jobs:
run: |
export DOCKER_IMAGE=registry.internal.huggingface.tech/api-inference/community/text-generation-inference:2.0.4-rocm
export HUGGING_FACE_HUB_TOKEN=${{ secrets.HUGGING_FACE_HUB_TOKEN }}
export DEVICES=/dev/kfd,/dev/dri
python -m pytest -s -vv integration-tests/models/test_flash_gpt2.py

View File

@ -34,6 +34,7 @@ from text_generation.types import (
DOCKER_IMAGE = os.getenv("DOCKER_IMAGE", None)
HUGGING_FACE_HUB_TOKEN = os.getenv("HUGGING_FACE_HUB_TOKEN", None)
DOCKER_VOLUME = os.getenv("DOCKER_VOLUME", "/data")
DOCKER_DEVICES = os.getenv("DOCKER_DEVICES")
class ResponseComparator(JSONSnapshotExtension):
@ -453,16 +454,27 @@ def launcher(event_loop):
if DOCKER_VOLUME:
volumes = [f"{DOCKER_VOLUME}:/data"]
if DOCKER_DEVICES:
devices = DOCKER_DEVICES.split(",")
visible = os.getenv("ROCR_VISIBLE_DEVICES")
if visible:
env["ROCR_VISIBLE_DEVICES"] = visible
device_requests = []
else:
devices = []
device_requests = [
docker.types.DeviceRequest(count=gpu_count, capabilities=[["gpu"]])
]
container = client.containers.run(
DOCKER_IMAGE,
command=args,
name=container_name,
environment=env,
auto_remove=False,
devices=devices,
device_requests=device_requests,
detach=True,
device_requests=[
docker.types.DeviceRequest(count=gpu_count, capabilities=[["gpu"]])
],
volumes=volumes,
ports={"80/tcp": port},
shm_size="1G",