How can I read a pickle (.pkl) file inside the flyte task? #5083
Replies: 1 comment 1 reply
-
Hey @dnyaneshwar-patil! Great to see you diving into the intricacies of Flyte again. Hope you're doing fantastic! To read a pickle file within a Flyte task, you need to ensure that the objects are being serialized and deserialized between the same Python versions, as pickle files are only compatible with the same version of Python they were created with. You can also consider using the Here's an example demonstrating how to utilize custom objects (in this case, a from flytekit import task, workflow
class Superhero:
def __init__(self, name, power):
self.name = name
self.power = power
@task
def welcome_superhero(name: str, power: str) -> Superhero:
return Superhero(name, power)
@task
def greet_superhero(superhero: Superhero) -> str:
return f"👋 Hello {superhero.name}! Your superpower is {superhero.power}."
@workflow
def superhero_wf(name: str = "Thor", power: str = "Flight") -> str:
superhero = welcome_superhero(name=name, power=power)
return greet_superhero(superhero=superhero) This code snippet demonstrates how to define tasks and workflows with custom types in Flyte, leveraging the If your task is still failing, it would be helpful to have more information. Could you provide the specific error messages or logs that you are receiving when the task fails? Also, is the pickle file accessible from the location specified in the task? This information will help us better understand the issue and provide a more accurate solution. Sources
|
Beta Was this translation helpful? Give feedback.
-
I have some training data stored in pickle files and I would like to read those files in flyte task.
This task does not give out any logs or exceptions. however, it simply fails.
Is there any way to make this work?
Beta Was this translation helpful? Give feedback.
All reactions