Luke Stanley commited on
Commit
feeb679
1 Parent(s): e327a9e

Add hello world RunPod setup

Browse files
Files changed (2) hide show
  1. runpod.dockerfile +15 -0
  2. runpod_handler.py +18 -0
runpod.dockerfile ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Base image -> https://github.com/runpod/containers/blob/main/official-templates/base/Dockerfile
2
+ # DockerHub -> https://hub.docker.com/r/runpod/base/tags
3
+ FROM runpod/base:0.4.0-cuda11.8.0
4
+
5
+ # Base image sets HuggingFace cache directory to use Runpod's shared cache for efficiency:
6
+ ENV HF_HOME="/runpod-volume/.cache/huggingface/"
7
+ # Also pre-downloading models may speed up start times while
8
+ # increasing image size, but could be worth it for some use cases.
9
+
10
+ RUN python3.11 -m pip install --upgrade pip && \
11
+ python3.11 -m pip install runpod==1.6.0
12
+
13
+ ADD runpod_handler.py .
14
+
15
+ CMD python3.11 -u /runpod_handler.py
runpod_handler.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ Example handler file. """
2
+
3
+ import runpod
4
+
5
+ # If your handler runs inference on a model, load the model here.
6
+ # You will want models to be loaded into memory before starting serverless.
7
+
8
+
9
+ def handler(job):
10
+ """ Handler function that will be used to process jobs. """
11
+ job_input = job['input']
12
+
13
+ name = job_input.get('name', 'World')
14
+
15
+ return f"Hello, {name}!"
16
+
17
+
18
+ runpod.serverless.start({"handler": handler})