epfl-dlab / transformers-CFG

🤗 A specialized library for integrating context-free grammars (CFG) in EBNF with the Hugging Face Transformers
http://saibo-creator.xyz:7860/
MIT License
90 stars 16 forks source link

ModuleNotFoundError: No module named 'transformers_cfg.cli' When Running CLI #89

Closed gfesatidis closed 2 months ago

gfesatidis commented 2 months ago

Description:
After installing the transformers-cfg package using pip install transformers-cfg, I'm encountering an error when attempting to run the CLI tool (transformers-cfg-cli). This behavior does not occur when the package is installed directly via the setup.py script. The error traceback is as follows:

Traceback (most recent call last):
  File "/home/gfesatidis/.miniconda3/envs/transformers-cfg/bin/transformers-cfg-cli", line 5, in <module>
    from transformers_cfg.cli.cli_main import main
ModuleNotFoundError: No module named 'transformers_cfg.cli'

Steps to Reproduce:

  1. Install the package: pip install transformers-cfg

  2. Attempt to run the CLI tool: transformers-cfg-cli -h

Expected Behavior: The CLI tool should execute without errors, displaying the help message or performing the intended function.

Actual Behavior: The CLI tool fails to run, raising a ModuleNotFoundError because the cli module is not found in the package.

Additional Information: Upon inspecting the installed package directory (site-packages/transformers_cfg/), I noticed that the cli directory is missing. This seems to be the cause of the error.

Screenshot 2024-09-02 222830

Environment: Python version: 3.11.9 Environment: Conda OS: WSL Ubuntu 24.04.1 LTS

Saibo-creator commented 2 months ago

The problem was caused by a missing init.py file, which led to the cli module not being included in the distribution package. This issue has been resolved in the latest release and in commit #90

Thank you for raising this issue! :)