minu
RRunPod
•Created by minu on 3/22/2024 in #⚡|serverless
Img2txt code works locally but not after deploying
okay , let me check further , but still big thanks atleast you gave me a start and pathway to correct my mistake
11 replies
RRunPod
•Created by minu on 3/22/2024 in #⚡|serverless
Img2txt code works locally but not after deploying
Oh okay, so you are saying even on colab it should work for images present on my local computer, i should chnage the code accordingly
11 replies
RRunPod
•Created by minu on 3/22/2024 in #⚡|serverless
Img2txt code works locally but not after deploying
i am testing on colab, so i dont think i can can images from my local computer to test it out ? but for publically accessiuble urls , internet images it is working
11 replies
RRunPod
•Created by minu on 3/22/2024 in #⚡|serverless
Img2txt code works locally but not after deploying
can you please see this, this can get image from any url (image publically accesible)
11 replies
RRunPod
•Created by minu on 3/22/2024 in #⚡|serverless
Img2txt code works locally but not after deploying
oh, then how can i get the image when i test api from postman?
11 replies
RRunPod
•Created by minu on 3/22/2024 in #⚡|serverless
Img2txt code works locally but not after deploying
import runpod
from PIL import Image
from transformers import AutoModel, AutoProcessor
import torch
Load model and processor outside the handler for efficiency
model_name = "unum-cloud/uform-gen2-qwen-500m" # Replace with your model name
model = AutoModel.from_pretrained(model_name, trust_remote_code=True)
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
Disable gradients and model head for faster inference
model.eval()
model.config.output_hidden_states = False
def process_image(input):
"""
Executes the image description logic with a hardcoded prompt
"""
image_path = input['image_path']
# Hardcoded prompt
prompt = "Image description" # Replace with your desired prompt
try:
image = Image.open(image_path)
except FileNotFoundError:
return {"error": f"Image not found at {image_path}"}
with torch.inference_mode():
inputs = processor(text=[prompt], images=[image], return_tensors="pt")
output = model.generate(
**inputs,
do_sample=False,
use_cache=True,
max_new_tokens=256,
eos_token_id=151645,
pad_token_id=processor.tokenizer.pad_token_id
)
prompt_len = inputs["input_ids"].shape[1]
decoded_text = processor.batch_decode(output[:, prompt_len:])[0]
return {"description": decoded_text}
---------------------------------------------------------------------------- #
RunPod Handler #
---------------------------------------------------------------------------- #
def handler(event):
"""
This is the handler function that will be called by RunPod serverless.
"""
return process_image(event['input'])
if name == 'main':
runpod.serverless.start({'handler': handler})
11 replies
RRunPod
•Created by minu on 3/19/2024 in #⚡|serverless
Captured handler exception
i cant understand properly, when i got the error i noted the time, and i am showing errors i got for that time
71 replies
RRunPod
•Created by minu on 3/19/2024 in #⚡|serverless
Captured handler exception
thios was i guess also the error on the worker, at that time
71 replies
RRunPod
•Created by minu on 3/19/2024 in #⚡|serverless
Captured handler exception
2024-03-19T05:33:15Z error starting: Error response from daemon: No such container: 77tt3raewfey9h-1
71 replies
RRunPod
•Created by minu on 3/19/2024 in #⚡|serverless
Captured handler exception
yes am using quick deploy
71 replies
RRunPod
•Created by m0nkspade on 12/23/2023 in #⚡|serverless
Advice on Creating Custom RunPod Template
Secondly how can i create a docker image on my own system when i system does not have enough resources? dont you need enough resources (like i need GPU for running https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0 , and my system doesnt have any) in your own system to create an docker image?
49 replies
RRunPod
•Created by m0nkspade on 12/23/2023 in #⚡|serverless
Advice on Creating Custom RunPod Template
I want create API myself and use specific version of stable diffusion and by code i mean code provided on hugging face https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0
49 replies
RRunPod
•Created by m0nkspade on 12/23/2023 in #⚡|serverless
Advice on Creating Custom RunPod Template
hey , i am new to runpod and docker as well, can anyone guide me how i can create a custom template for stable-diffusion-xl-base-1.0 (i.e. I have to make some changes in the code e.g. output image and prompt etc, thats why i want to build my own image).
p.s. my system does not have GPU, and you require GPU to run this stable-diffusion-xl-base-1.0 code
49 replies