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

Local model upload to PVC #115

Merged

Conversation

jackdelahunt
Copy link
Contributor

@jackdelahunt jackdelahunt commented Oct 3, 2023

Description

Upload a model to a PVC which can then be used in our pipelines

How Has This Been Tested?

Upload model to PVC:

make MODEL_PATH="PATH_TO_A_FILE" NAME=my-model create

You should get a final output showing details of the upload

PVC name: model-upload-pvc
Size: 1G
Model path in pod: /workspace/model-upload-pvc/model_dir/model.model

You can set the SIZE and PVC values aswell

make MODEL_PATH="PATH_TO_A_FILE" NAME=my-model SIZE=1G PVC=my-new-PVC create

Merge criteria:

  • The commits are squashed in a cohesive manner and have meaningful messages.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work

Copy link
Member

@piotrpdev piotrpdev left a comment

Choose a reason for hiding this comment

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

Good job so far 👍

@piotrpdev
Copy link
Member

piotrpdev commented Oct 3, 2023

Also in the A/C in the issue (#87) I specified we should provide a template PVC so please do that eventually.

@jackdelahunt
Copy link
Contributor Author

jackdelahunt commented Oct 4, 2023

Also in the A/C in the issue (#87) I specified we should provide a template PVC so please do that eventually.

@piotrpdev

How will this work, will it be a template used for the pipelines aswell or just come with this work that you can then add in the pipelineRun?

Is the idea to create the PVC and the pod at the same time and upload the model and use this PVC to them use or copy it to somewhere else? My thought was that we just pass a PVC name that is already in the project.

@piotrpdev
Copy link
Member

piotrpdev commented Oct 4, 2023

Is the idea to create the PVC and the pod at the same time and upload the model and use this PVC to them use or copy it to somewhere else? My thought was that we just pass a PVC name that is already in the project.

I added some more detail to the issue yesterday, my bad for it being unclear, #87 (comment)

In the issue description I specified how we're probably going to switch to using VolumeClaimTemplate so each PipelineRun creates its own PVC. In this scenario, the pipelines won't be using any PVC provided by the repo (apart from the template that I asked you to include for local model use).

@piotrpdev
Copy link
Member

This is also a diagram for what I'm thinking:

image

@piotrpdev piotrpdev added kind/documentation Improvements or additions to documentation kind/enhancement New feature or request priority/high Important issue that needs to be resolved asap. Releases should not have too many o labels Oct 5, 2023
@piotrpdev piotrpdev added priority/blocker Critical issue that needs to be fixed asap; blocks up coming releases and removed priority/high Important issue that needs to be resolved asap. Releases should not have too many o labels Oct 13, 2023
@jackdelahunt jackdelahunt force-pushed the local-model-upload branch 4 times, most recently from f2b6591 to 737bc9a Compare November 13, 2023 11:58
@jackdelahunt jackdelahunt changed the title Draft: Local model upload to PVC Local model upload to PVC Nov 16, 2023
@LaVLaS LaVLaS self-requested a review November 21, 2023 03:21
Copy link
Contributor

@LaVLaS LaVLaS left a comment

Choose a reason for hiding this comment

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

Can you rename the templates file so they are clearly djust to show that they are templates.

local-model-pvc-template.yaml
local-model-to-pvc-pod-template.yaml

Comment on lines 6 to 24
- apiVersion: v1
kind: Pod
metadata:
name: local-model-to-pvc-pod
spec:
volumes:
- name: ${PVC}
persistentVolumeClaim:
claimName: ${PVC}
containers:
- name: local-model-to-pvc-container
image: ubi9
stdin: true
tty: true
securityContext:
allowPrivilegeEscalation: false
volumeMounts:
- mountPath: /workspace/${PVC}
name: ${PVC}
Copy link
Member

Choose a reason for hiding this comment

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

I think you could consider putting this into the object list of the other template, if they're always expected to be processed together, and the PVC parameter will always have the same value. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The PVC and the pod want to be deleted at different times, this is because when you upload the model file to the PVC it is mounted to the pod. For another pod to mount the PVC the pod we create must un-mount it as you can't have both mounting at the same time.

So when you are deleting them you want to do it separately.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really want to rely on the same PVC being remounted for various uses?

Shouldn't the Pod writing the model to the PV use one PVC, and then Pods consuming the model different PVC(s), possibly with different selectors for labels set by the populating Pod after it has finished storing the model?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes the pod writing the model does only use one PVC, it is mounted then oc cp is used and then unmounted and the pod is deleted.

For our usecase the PVC we upload to is then used as a workspace in the pipelines, so the PVC it uses for the pipelines can copy over the model file. So I think adding labels etc. isn't needed for this. (Atleast I don't think so)

@adelton
Copy link
Contributor

adelton commented Nov 21, 2023

Please note that the use of model_dir seems to cause #175.

@adelton adelton removed their assignment Nov 21, 2023
@biswassri
Copy link
Contributor

@jackdelahunt It might be a good idea to update the ReadMe file with steps for anyone trying this? Even just the make command and some details about local pvc upload I think might help.

@jackdelahunt
Copy link
Contributor Author

@biswassri sure will do

Copy link
Member

@grdryn grdryn left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @jackdelahunt!

Copy link

openshift-ci bot commented Nov 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: grdryn, jackdelahunt

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 0594164 into opendatahub-io:main Nov 30, 2023
2 checks passed
@adelton
Copy link
Contributor

adelton commented Dec 13, 2023

Hello @jackdelahunt, was there a specific ready why the Using local models in pipelines documentation section went to the top-level README.md and not to pipelines/README.md, seeing the whole PR was in the pipelines/ space?

jackdelahunt pushed a commit to jackdelahunt/ai-edge that referenced this pull request Jan 23, 2024
@jackdelahunt jackdelahunt deleted the local-model-upload branch April 23, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved kind/documentation Improvements or additions to documentation kind/enhancement New feature or request lgtm priority/blocker Critical issue that needs to be fixed asap; blocks up coming releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants