Skip to content

Commit

Permalink
fix: requesting gpu from docker runtime only for loaders that need it
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Feb 6, 2025
1 parent 7c75ade commit 7ba92b4
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dyana/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def trace(
) -> None:
try:
# disable GPU on non-Linux systems
if not no_gpu and platform_pkg.system() != "Linux":
no_gpu = True
# if not no_gpu and platform_pkg.system() != "Linux":
# no_gpu = True

# check if policy is either a file or a directory
if policy and not policy.exists():
Expand Down
1 change: 1 addition & 0 deletions dyana/loaders/automodel/settings.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
description: Loads and profiles machine learning models compatible with AutoModel and AutoTokenizer.

gpu: true
build_args:
extra-requirements: EXTRA_REQUIREMENTS

Expand Down
2 changes: 1 addition & 1 deletion dyana/loaders/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def run(self, allow_network: bool = False, allow_gpus: bool = True, allow_volume
volumes,
environment=environment,
allow_network=allow_network,
allow_gpus=allow_gpus,
allow_gpus=allow_gpus and self.settings.gpu,
allow_volume_write=allow_volume_write,
)
self.container_id = self.container.id
Expand Down
2 changes: 2 additions & 0 deletions dyana/loaders/lora/settings.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
description: Loads LoRA adapters via PEFT.

gpu: true

build_args:
extra-requirements: EXTRA_REQUIREMENTS

Expand Down
2 changes: 2 additions & 0 deletions dyana/loaders/ollama/settings.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
description: Loads and profiles models via an Ollama server. Local models on the host machine are mounted and shared with the container.

gpu: true

volumes:
# on macOS
- host: ~/.ollama/models
Expand Down
1 change: 1 addition & 0 deletions dyana/loaders/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class LoaderSettings(BaseModel):
build_args: dict[str, str] | None = None
args: list[LoaderArgument] | None = None
network: bool | None = False
gpu: bool = False
volumes: list[Volume] | None = None
examples: list[Example] | None = None

Expand Down

0 comments on commit 7ba92b4

Please sign in to comment.