Follow these steps to test the current code:
-
Clone your repository and initialize the submodule:
git clone <your-repo-url> cd <your-repo-directory> git submodule init git submodule update
-
Navigate to the
transformers
directory:cd transformers
-
Create and activate a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the package in editable mode:
pip install -e . cd src/transformers/generation Edit the beam_search.py file as in the file in the parent directory
-
Return to the parent directory:
cd ..
-
Run the Transformers library tests:
python unit_test.py
- Make sure you have Python and pip installed on your system.
- You may need to use
python3
andpip3
instead ofpython
andpip
depending on your system configuration. - The exact command to run your project's unit tests may vary depending on your project structure and test setup.
- If you encounter any import errors, ensure that your
PYTHONPATH
includes both your project directory and thetransformers
subdirectory.