Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds wandb example #1673

Merged
merged 6 commits into from
Jun 13, 2024
Merged

Adds wandb example #1673

merged 6 commits into from
Jun 13, 2024

Conversation

thomasjpfan
Copy link
Member

@thomasjpfan thomasjpfan commented May 10, 2024

This is an wandb example associated with flyteorg/flytekit#2405

You can replace the container_image with:

@task(
    container_image="ghcr.io/thomasjpfan/wandb:0.0.4",
    secret_requests=[wandb_secret],
)
@wandb_init(project=WANDB_PROJECT, entity=WANDB_ENTITY, secret=wandb_secret)

If you want to use the image builder:

REGISTRY = "localhost:30000"

wandb_package = "git+https://github.com/thomasjpfan/flytekit.git@925f2a3403f605f4ef018893b99ae68ec81fdae4#egg=flytekitplugins-wandb&subdirectory=plugins/flytekit-wandb"

image = ImageSpec(
    name="wandb_example",
    apt_packages=["git"],
    python_version="3.11",
    packages=["xgboost", "scikit-learn", wandb_package],
    registry=REGISTRY,
)

Note, that we need to merge flyteorg/flytekit#2405 first before the example can run as is.

Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
docs/index.md Outdated
@@ -130,6 +130,7 @@ auto_examples/snowflake_agent/index
auto_examples/k8s_spark_plugin/index
auto_examples/sql_plugin/index
auto_examples/kftensorflow_plugin/index
auto_examples/wandb_plugin/index
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cosmicBboy From the CI issue is there another place I need to add auto_examples/wandb_plugin/index to the toc?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, so this index.md page actually isn't used any more (we still haven't sunsetted the old docs @ppiegaze @neverett, we need to decide when we want to do this). it's fine if it's here, but the entry needs to be added somewhere on this page: https://github.com/flyteorg/flytesnacks/blob/master/docs/integrations.md in the appropriate list-table directive.

For context:
The sphinx dark magic that's happening here is, these list tables are being picked up in the flyte docs here and converted into {list-table-toc}s that automatically add them to the flyte monodocs toc: https://github.com/flyteorg/flyte/blob/master/docs/_ext/import_projects.py#L59-L81

Signed-off-by: Thomas J. Fan <[email protected]>
Signed-off-by: Thomas J. Fan <[email protected]>
neverett
neverett previously approved these changes May 14, 2024
Copy link
Contributor

@neverett neverett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few comments, otherwise LGTM. Mainly I changed "Weights & Biases" to "Weights and Biases" for consistency.

.. tags:: Integration, Data, Metrics, Intermediate
```

The Weights & Biases MLOps platform helps AI developers streamline their ML workflow from end-to-end. This plugin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Weights & Biases MLOps platform helps AI developers streamline their ML workflow from end-to-end. This plugin
The Weights and Biases MLOps platform helps AI developers streamline their ML workflows from end to end. This plugin


# %%
# The `wandb_init` decorator calls `wandb.init` and configures it to use Flyte's
# execution id as Weight and Biases run id. The body of the task is XGBoost training
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# execution id as Weight and Biases run id. The body of the task is XGBoost training
# execution id as the Weights and Biases run id. The body of the task is XGBoost training

@@ -0,0 +1,20 @@
(wandb)=

# Weights & Biases
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Weights & Biases
# Weights and Biases

@@ -40,6 +40,8 @@ Flytekit functionality. These plugins can be anything and for comparison can be
- Convert ML models to ONNX models seamlessly.
* - {doc}`DuckDB <auto_examples/duckdb_plugin/index>`
- Run analytical queries using DuckDB.
* - {doc}`Weights & Biases <auto_examples/wandb_plugin/index>`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* - {doc}`Weights & Biases <auto_examples/wandb_plugin/index>`
* - {doc}`Weights and Biases <auto_examples/wandb_plugin/index>`



# %% [markdown]
# To enable dynamic log links add plugin to Flyte's configuration file:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# To enable dynamic log links add plugin to Flyte's configuration file:
# To enable dynamic log links, add the plugin to Flyte's configuration file:

@cosmicBboy
Copy link
Contributor

Creating virtualenv at: .venv
  × No solution found when resolving dependencies:
  ╰─▶ Because flytekitplugins-wandb was not found in the package registry and
      you require flytekitplugins-wandb, we can conclude that the requirements
      are unsatisfiable.

looks like we need to publish this on pypi?

@thomasjpfan
Copy link
Member Author

looks like we need to publish this on pypi?

Yea, flyteorg/flytekit#2405 needs to be merged first and we need to do a release.

@thomasjpfan
Copy link
Member Author

thomasjpfan commented May 15, 2024

To test you can replace the imagespec with:

@task(
    container_image="ghcr.io/thomasjpfan/wandb:0.0.4",
    secret_requests=[wandb_secret],
)
@wandb_init(project=WANDB_PROJECT, entity=WANDB_ENTITY, secret=wandb_secret)

If you want to use the image builder:

REGISTRY = "localhost:30000"

wandb_package = "git+https://github.com/thomasjpfan/flytekit.git@925f2a3403f605f4ef018893b99ae68ec81fdae4#egg=flytekitplugins-wandb&subdirectory=plugins/flytekit-wandb"

image = ImageSpec(
    name="wandb_example",
    apt_packages=["git"],
    python_version="3.11",
    packages=["xgboost", "scikit-learn", wandb_package],
    registry=REGISTRY,
)

Signed-off-by: Thomas J. Fan <[email protected]>
@thomasjpfan thomasjpfan merged commit 1a4773d into flyteorg:master Jun 13, 2024
56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants