xeith_
xeith_
RRunPod
Created by xeith_ on 1/8/2025 in #⚡|serverless
Linking runpod-volume subfolder doesn't work
The only limitation is that it's REALLY slow to load onto the VRAM, so I wont rely on the network storage for big files like such anyway 🐋
7 replies
RRunPod
Created by xeith_ on 1/8/2025 in #⚡|serverless
Linking runpod-volume subfolder doesn't work
@flash-singh Hey, I was about to update this thread. Actually /comfyui/models/checkpoints/sd_xl_base_1-0.safetensors exists was a symlink ITSELF that what pointing nowhere... I deleted it, re-imported the model in my network storage and everything works fine.
7 replies
RRunPod
Created by xeith_ on 1/8/2025 in #⚡|serverless
Linking runpod-volume subfolder doesn't work
Any help is appreciated :))
7 replies
RRunPod
Created by xeith_ on 1/8/2025 in #⚡|serverless
Linking runpod-volume subfolder doesn't work
Update: it works locally with a docker compose
services:
comfy-ui-serverless:
image: comfy-ui-serverless
build:
context: .
dockerfile: Dockerfile
container_name: comfy-ui-serverless
volumes:
# Map a local directory to /runpod-volume inside the container
- ./storage/runpod-volume:/runpod-volume
# Runpod test with the test-input.json file
- ./test_input.json:/test_input.json
ports:
# Expose any necessary ports (adjust if your application uses specific ports)
- "3000:3000" # Example: Replace 8000 with the actual port if needed
environment:
# Pass any environment variables you need
NVIDIA_VISIBLE_DEVICES: all
NVIDIA_DRIVER_CAPABILITIES: compute,utility
runtime: nvidia
services:
comfy-ui-serverless:
image: comfy-ui-serverless
build:
context: .
dockerfile: Dockerfile
container_name: comfy-ui-serverless
volumes:
# Map a local directory to /runpod-volume inside the container
- ./storage/runpod-volume:/runpod-volume
# Runpod test with the test-input.json file
- ./test_input.json:/test_input.json
ports:
# Expose any necessary ports (adjust if your application uses specific ports)
- "3000:3000" # Example: Replace 8000 with the actual port if needed
environment:
# Pass any environment variables you need
NVIDIA_VISIBLE_DEVICES: all
NVIDIA_DRIVER_CAPABILITIES: compute,utility
runtime: nvidia
So I guess it has something to do with how runpod works with network volumes ?
7 replies
RRunPod
Created by jackson hole on 1/8/2025 in #⚡|serverless
Some basic confusion about the `handlers`
Yea of course, using runpod handler is only relevant for serverless. Otherwise the API structure is great!
10 replies
RRunPod
Created by jackson hole on 1/8/2025 in #⚡|serverless
Some basic confusion about the `handlers`
@jackson hole switching to using runpod handler is pretty straight forward. It will take you less than an hour 🙂 Make your Dockerfile point to a new runpod.handler.py file.
# Command to run the app
CMD ["python3", "-u", "runpod.handler.py"]
# Command to run the app
CMD ["python3", "-u", "runpod.handler.py"]
#runpod.handler.py
import runpod

from backgroundremover import remove_background # Some Python library
from image import crop_image, load_image # Local File (./image.py)

async def handler(event):
try:
input_data = event.get("input", {})
callback = input_data.get("callback", {})
image_url = input_data.get("image_url",input_data.get("image_data_url",""))

# Load the image
image = load_image(image_url)

processed_image, mask = await remove_background(image)

# Crop the image
image = crop_image(processed_image)

return {
"url": image['dataUrl'],
"position": image['position'],
"callback": callback
}

except Exception as e:
return {'error': str(e)}


if __name__ == '__main__':
runpod.serverless.start({'handler': handler})
#runpod.handler.py
import runpod

from backgroundremover import remove_background # Some Python library
from image import crop_image, load_image # Local File (./image.py)

async def handler(event):
try:
input_data = event.get("input", {})
callback = input_data.get("callback", {})
image_url = input_data.get("image_url",input_data.get("image_data_url",""))

# Load the image
image = load_image(image_url)

processed_image, mask = await remove_background(image)

# Crop the image
image = crop_image(processed_image)

return {
"url": image['dataUrl'],
"position": image['position'],
"callback": callback
}

except Exception as e:
return {'error': str(e)}


if __name__ == '__main__':
runpod.serverless.start({'handler': handler})
Here is a small example
10 replies