wandb / examples

Example deep learning projects that use wandb's features.
http://wandb.ai
1.11k stars 291 forks source link

[Bug]: RayTune examples are outdated because of changes in wandb and cannot run #411

Closed fantauzzi closed 1 year ago

fantauzzi commented 1 year ago

Tell us what happened?

Please tell us which example failed and why. Please link the wandb.ai logs if you have one. https://github.com/wandb/examples/tree/master/colabs/raytune

The first error I get running the script in Colab is

DeprecationWarning: The `wandb_mixin`/`WandbTrainableMixin` is deprecated. Use `ray.air.integrations.wandb.setup_wandb` instead.

If I follow the instructions provided in the error I get another error:

WARNING:ray.air._internal.session:In neither tune session nor train session!
WARNING:ray.air._internal.session:In neither tune session nor train session!
WARNING:ray.air._internal.session:In neither tune session nor train session!

---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

[<ipython-input-20-78781d0359ec>](https://localhost:8080/#) in <cell line: 3>()
      2 
      3 @setup_wandb
----> 4 def train_mnist(config):
      5 
      6     device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

1 frames

[/usr/local/lib/python3.10/dist-packages/ray/air/integrations/wandb.py](https://localhost:8080/#) in _setup_wandb(trial_id, trial_name, config, api_key, api_key_file, _wandb, **kwargs)
    156     **kwargs,
    157 ) -> Union[Run, RunDisabled]:
--> 158     _config = config.copy() if config else {}
    159 
    160     wandb_config = _config.pop("wandb", {}).copy()

AttributeError: 'function' object has no attribute 'copy'

Likewise with https://github.com/wandb/examples/blob/master/colabs/raytune/tune-wandb.ipynb the first error I get running it in Colab is

---------------------------------------------------------------------------

DeprecationWarning                        Traceback (most recent call last)

[<ipython-input-2-bfcff2143417>](https://localhost:8080/#) in <cell line: 7>()
      5 from ray.air import session
      6 from ray.tune import Trainable
----> 7 from ray.air.callbacks.wandb import WandbLoggerCallback
      8 from ray.tune.integration.wandb import (
      9     WandbTrainableMixin,

1 frames

[/usr/local/lib/python3.10/dist-packages/ray/tune/_structure_refactor.py](https://localhost:8080/#) in warn_structure_refactor(old_module, new_module, direct)
     23             )
     24 
---> 25         raise DeprecationWarning(warning)

DeprecationWarning: The module `ray.air.callbacks.wandb` has been moved to `ray.air.integrations.wandb` and the old location has been deprecated. Please adjust your imports to point to the new location. Example: Do a global search and replace `ray.air.callbacks.wandb` with `ray.air.integrations.wandb`.
tcapelle commented 1 year ago

This should be fixed now. CC @scottire