Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add resources to input downloader in the ollama plugin #2754

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def __init__(
cpu: int = 1,
gpu: int = 1,
mem: str = "15Gi",
inputs_mem: str = "500Mi",
samhita-alla marked this conversation as resolved.
Show resolved Hide resolved
):
"""Initialize Ollama class for managing a Kubernetes pod template.

Expand All @@ -40,6 +41,7 @@ def __init__(
:param cpu: The number of CPU cores requested for the container. Default is 1.
:param gpu: The number of GPUs requested for the container. Default is 1.
:param mem: The amount of memory requested for the container, specified as a string. Default is "15Gi".
:param inputs_mem: The amount of memory requested for downloading inputs, specified as a string. Default is "500Mi".
"""
self._model_name = model.name
self._model_mem = model.mem
Expand All @@ -52,6 +54,7 @@ def __init__(
cpu=cpu,
gpu=gpu,
mem=mem,
inputs_mem=inputs_mem,
download_inputs=(True if self._model_modelfile and "{inputs" in self._model_modelfile else False),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def __init__(
cpu: int = 1,
gpu: int = 1,
mem: str = "1Gi",
inputs_mem: str = "500Mi",
env: Optional[dict[str, str]] = None,
download_inputs: bool = False,
):
Expand All @@ -34,6 +35,7 @@ def __init__(
self._cpu = cpu
self._gpu = gpu
self._mem = mem
self._inputs_mem = inputs_mem
self._env = env
self._download_inputs = download_inputs

Expand Down Expand Up @@ -138,6 +140,16 @@ def __init__(
V1VolumeMount(name="shared-data", mount_path="/shared"),
V1VolumeMount(name="tmp", mount_path="/tmp"),
],
resources=V1ResourceRequirements(
requests={
"cpu": 1,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see the need for setting the CPU as well. From my testing, downloads are usually faster if you give it more than one CPU.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i made it configurable.

"memory": self._inputs_mem,
},
limits={
"cpu": 1,
"memory": self._inputs_mem,
},
),
),
)

Expand Down
Loading