bilaal.qaasim
RRunPod
•Created by bilaal.qaasim on 10/24/2024 in #⚡|serverless
Request queued forever
@flash-singh @Merrell
12 replies
RRunPod
•Created by bilaal.qaasim on 10/24/2024 in #⚡|serverless
Request queued forever
I have already wasted around 50 bucks while retrying, is this an issue on runpods end?
12 replies
RRunPod
•Created by bilaal.qaasim on 10/24/2024 in #⚡|serverless
Request queued forever
yes this is my first worker, it worked a couple of times but this forever queue is also faced multiple times, I can't share the exact worker code but below is the structure of my code
def setup_environment():
token = os.getenv("DUMMY_TOKEN")
# Perform any authentication or initialization
pass
def load_models():
# Load and initialize required models
pass
def validate_inputs(inputs):
required_fields = ["user_text", "image_data"]
for field in required_fields:
if field not in inputs:
raise ValueError(f"Missing required input: {field}")
def process_image_data(image_data):
if image_data.startswith("http"):
return Image.open(requests.get(image_data, stream=True).raw).convert("RGB")
else:
return Image.open(BytesIO(base64.b64decode(image_data))).convert("RGB")
def generate_images(prompt, input_image):
outputs = []
for i in range(4): # Example loop for multiple generations
# Placeholder logic for generating an image
dummy_image = Image.new("RGB", (256, 256), color="gray")
# Save and encode as Base64
path = f"/workspace/dummyoutput{i + 1}.jpg"
dummy_image.save(path)
outputs.append(file_to_base64(path))
return outputs
def file_to_base64(file_path):
with open(file_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode("utf-8")
def handler(job):
inputs = job.get("input", {})
try: validate_inputs(inputs) # Validate input data except ValueError as e: return {"error": str(e)} # Extract and process inputs user_text = inputs.get("user_text", "default text") image_data = inputs["image_data"] input_image = process_image_data(image_data) # Generate images (placeholder logic) outputs = generate_images(user_text, input_image) return {"outputs": outputs} setup_environment() load_models() runpod.serverless.start({"handler": handler})
try: validate_inputs(inputs) # Validate input data except ValueError as e: return {"error": str(e)} # Extract and process inputs user_text = inputs.get("user_text", "default text") image_data = inputs["image_data"] input_image = process_image_data(image_data) # Generate images (placeholder logic) outputs = generate_images(user_text, input_image) return {"outputs": outputs} setup_environment() load_models() runpod.serverless.start({"handler": handler})
12 replies