Spacy: WandB integration: from spacy.cli.train import train doesn't work

Created on 6 Jan 2021  路  4Comments  路  Source: explosion/spaCy

There is no train function in spacy.cli.train module.

Hi I am running train-search script as described here for the WandB integration https://github.com/explosion/projects/tree/v3/integrations/wandb

import typer
from pathlib import Path
from spacy.cli.train import train


def main(config_dir: Path, default_config: str, results_dir: Path):
    """Run all config files instead of the default one.
    Ideally, these runs are parellellized instead of run in sequence."""
    for config_file in config_dir.iterdir():
        if config_file.name != default_config:
            output_path = results_dir / config_file.stem
            if not output_path.exists():
                output_path.mkdir()
            train(config_path=config_file, output_path=output_path)


if __name__ == "__main__":
    typer.run(main)

I am getting the following error:

TypeError: train() got an unexpected keyword argument 'config_path'

I suspect that the error is due to the fact that there is no train function in spacy.cli.train. So I changed this line

from spacy.cli.train import train
to

from spacy.cli.train import train_cli and changed the train() to train_cli in the script.

which now gives the following error:

TypeError: train_cli() missing 1 required positional argument: 'ctx'

Any idea how to make train-search work?

Thank you!

Environment

  • spaCy version: 3.0.0rc2
  • Platform: Darwin-20.1.0-x86_64-i386-64bit
  • Python version: 3.7.9
  • Pipelines: en_core_web_trf (3.0.0a0)
projects resolved 馃寵 nightly

Most helpful comment

All 4 comments

Thanks for the report. While we're testing the release candidates and getting feedback, we're sometimes still slightly changing the API's and it could very well be that some of the projects have gone a bit outdated. I'll have a look!

Thank you for the response. Please let me know once you find a way to fix it.

Nice!!! Thank you for the update!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TropComplique picture TropComplique  路  3Comments

bebelbop picture bebelbop  路  3Comments

besirkurtulmus picture besirkurtulmus  路  3Comments

ahalterman picture ahalterman  路  3Comments

cverluise picture cverluise  路  3Comments