The contrib folder contains simple end-to-end scripts to test integration of huggingface_hub
in downstream libraries. The main goal is to proactively notice breaking changes and deprecation warnings.
To add another contrib lib, one must:
./contrib/transformers
requirements.txt
file specific to this lib. Example ./contrib/transformers/requirements.txt
./contrib/transformers/test_push_to_hub.py
make style
. This will edit both makefile
and .github/workflows/contrib-tests.yml
to add the lib to list of libs to test. Make sure changes are accurate before committing.Contrib tests can be manually triggered in GitHub with the Contrib tests
workflow.
Tests are not run in the default test suite (for each PR) as this would slow down development process. The goal is to notice breaking changes, not to avoid them. In particular, it is interesting to trigger it before a release to make sure it will not cause too much friction.
Tests must be ran individually for each dependent library. Here is an example to run
timm
tests. Tests are separated to avoid conflicts between version dependencies.
Before running tests, a virtual env must be setup for each contrib library. To do so, run:
# Run setup in parallel to save time
make contrib_setup -j4
Then tests can be run
# Optional: -j4 to run in parallel. Output will be messy in that case.
make contrib_test -j4
Optionally, it is possible to setup and run all tests in a single command. However this take more time as you don't need to setup the venv each time you run tests.
make contrib -j4
Finally, it is possible to delete all virtual envs to get a fresh start for contrib tests.
After running this command, contrib_setup
will have to re-download/re-install all dependencies.
make contrib_clear
Instead of running tests for all contrib libraries, you can run a specific lib:
# Setup timm tests
make contrib_setup_timm
# Run timm tests
make contrib_test_timm
# (or) Setup and run timm tests at once
make contrib_timm
# Delete timm virtualenv if corrupted
make contrib_clear_timm
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。