Skip to content

Document new reinit='allow' setting #1145

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

timoffex
Copy link
Contributor

@timoffex timoffex commented Mar 6, 2025

DO NOT MERGE until wandb/wandb#9562 is merged and released. Make sure the version number in the docs is correct!

Updates documentation for wandb/wandb#9562.

NOTE: This original example on this page was wrong: reinit was not necessary because the example already called run.finish(). Setting reinit=True simply calls run.finish() automatically for the user. I removed mention of reinit=True as we would like to deprecate this setting completely.

@timoffex timoffex requested a review from a team as a code owner March 6, 2025 00:31
@timoffex timoffex changed the title Document reinit='allow' setting Document new reinit='allow' setting Mar 6, 2025
Copy link

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 095cde2
Status: ✅  Deploy successful!
Preview URL: https://0a80c84a.docodile.pages.dev
Branch Preview URL: https://timoffex-reinit-allow.docodile.pages.dev

View logs

@mdlinville mdlinville added the DO-NOT-MERGE For PRs that should not be merged yet label Mar 6, 2025
timoffex added a commit to wandb/wandb that referenced this pull request Apr 18, 2025
…ne process (#9746)

DUPLICATED FROM PR #9562 which I accidentally merged into the wrong branch.

* WB-23108, WB-24208
* Docs: wandb/docs#1145

Adds a `create_new` option to the `reinit` setting which causes `wandb.init()` to create a new run even if other runs exist. This should eventually become the default, and the other options ("return_previous" and "finish_previous") should be deprecated.

Although it's possible to pass `reinit` as a `wandb.init()` argument, the best way to use this is with `wandb.setup()`.

Here is an example that uses the `create_new` setting to (serially) run multiple sub-experiments while logging their results to another run:

```python
wandb.setup(wandb.Settings(reinit="create_new"))

with wandb.init() as experiment_results_run:
    for ...:
        with wandb.init() as run:
            # The do_experiment() function logs fine-grained metrics
            # to the given run and then returns result metrics that
            # we'd like to track separately.
            experiment_results = do_experiment(run)

            # After each experiment, we log its results to a parent
            # run. Each point in the parent run's charts corresponds
            # to one experiment's results.
            experiment_results_run.log(experiment_results)
```

---

This PR also removes `util._is_offline()` and replaces it with a heuristic that uses the newly added `most_recent_active_run`. This way, `_is_offline` continues to work as expected in most cases.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO-NOT-MERGE For PRs that should not be merged yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants