New RunLLM response generated: >>>*# Question* He...
# runllm-flyte-trial
a
New RunLLM response generated: >>>*# Question* Hello Flyte community I was testing flytedecks for the first time. I found the online examples here https://docs.flyte.org/en/latest/user_guide/development_lifecycle/decks.html#decks do not work . There is a
scikit-learn
not mentioned and I get the error I will post in this thread. This page seems to be an older version since it uses the deprecated
disable_deck=False
but is not listed as such # Answer The issues you're encountering are likely due to missing dependencies and outdated documentation. The
scikit-learn
dependency is necessary for the PCA example, and the
disable_deck=False
parameter has been deprecated. To resolve the issues: 1. Install Dependencies: Ensure
scikit-learn
and other necessary packages are installed. 2. Update Task Definition: Use
enable_deck=True
instead of
disable_deck=False
. Here's an updated example:
Copy code
import flytekit
from flytekit import task, ImageSpec
from flytekitplugins.deck.renderer import MarkdownRenderer
from sklearn.decomposition import PCA
import plotly.express as px
import plotly.io

custom_image = ImageSpec(name="flyte-decks-example", packages=["scikit-learn", "plotly"], registry="ghcr.io/flyteorg")

@task(enable_deck=True, container_image=custom_image)
def pca_plot():
    iris_df = px.data.iris()
    X = iris_df[["sepal_length", "sepal_width", "petal_length", "petal_width"]]
    pca = PCA(n_components=3)
    components = pca.fit_transform(X)
    total_var = pca.explained_variance_ratio_.sum() * 100
    fig = px.scatter_3d(
        components,
        x=0,
        y=1,
        z=2,
        color=iris_df["species"],
        title=f"Total Explained Variance: {total_var:.2f}%",
        labels={"0": "PC 1", "1": "PC 2", "2": "PC 3"},
    )
    main_deck = flytekit.Deck("pca", MarkdownRenderer().to_html("### Principal Component Analysis"))
    main_deck.append(plotly.io.to_html(fig))
Would you like more details on any specific part? Sources: - Flyte Decks Documentation - Flyte Community Discussion Slack Link https://flyte-org.slack.com/archives/CP2HDHKE1/p1719580136.034639 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.