-
Notifications
You must be signed in to change notification settings - Fork 27.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move test model folders #17034
Move test model folders #17034
Conversation
The documentation is not available anymore as the PR was closed or merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive work! My only concern is on the changes in self.scheduled.yml
, so I'd really like to launch that CI once and check everything is okay before we merge this.
e4efa64
to
1080be1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very impressive PR, thanks @ydshieh!
If you're rebasing on main
to take care of the conflicts, I would advocate to squash all of your commits in a single one, which means you'll only take care of the conflicts once (similarly to a merge). Having 32 commits to rebase on main
must be hard :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super awesome work, @ydshieh! Thank you!
I made a few minor optional suggestions if these resonate with you. But please feel free to ignore.
I wonder if this
transformers/src/transformers/testing_utils.py
Lines 960 to 963 in 1073f00
for up in [1, 2, 3]: | |
tmp_dir = path.parents[up] | |
if (tmp_dir / "src").is_dir() and (tmp_dir / "tests").is_dir(): | |
break |
needs to have another level, or perhaps it's still reaching to the repo's root. I think I coded it originally to have some spare levels.
rm -rf reports | ||
- id: set-matrix | ||
name: Identify models to test | ||
working-directory: /transformers/tests | ||
run: | | ||
echo "::set-output name=matrix::$(python3 -c 'import os; x = list(filter(os.path.isdir, os.listdir(os.getcwd()))); x.sort(); print(x)')" | ||
echo "::set-output name=matrix::$(python3 -c 'import os; tests = os.getcwd(); model_tests = os.listdir(os.path.join(tests, "models")); d1 = sorted(list(filter(os.path.isdir, os.listdir(tests)))); d2 = sorted(list(filter(os.path.isdir, [f"models/{x}" for x in model_tests]))); d1.remove("models"); d = d2 + d1; print(d)')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit difficult to read, may I propose a simplified version which I hope is easier to follow, plus it adds some new lines and additionally removes __pycache__
dir which shouldn't be in the results.
echo "::set-output name=matrix::$(python3 -c 'import os; tests = os.getcwd(); model_tests = os.listdir(os.path.join(tests, "models")); d1 = sorted(list(filter(os.path.isdir, os.listdir(tests)))); d2 = sorted(list(filter(os.path.isdir, [f"models/{x}" for x in model_tests]))); d1.remove("models"); d = d2 + d1; print(d)')" | |
echo "::set-output name=matrix::$(python3 -c '\ | |
import os; \ | |
tests = os.getcwd(); \ | |
d = set(filter(os.path.isdir, os.listdir(tests) + [f"models/{x}" for x in os.listdir(f"{tests}/models")])); \ | |
d -= set(["models", "__pycache__"]); \ | |
print(sorted(d))')" |
Here is just the python snippet:
python -c '\
import os; \
tests = os.getcwd(); \
d = set(filter(os.path.isdir, os.listdir(tests) + [f"models/{x}" for x in os.listdir(f"{tests}/models")])); \
d -= set(["models", "__pycache__"]); \
print(sorted(d))'
which I tested with, I hope I plugged it in correctly above - i.e. untested.
|
||
|
||
sys.path.append(str(Path(__file__).parent.parent.parent / "utils")) | ||
sys.path.append(str(Path(__file__).parent.parent.parent.parent / "utils")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the number of parent
calls is becoming too long, one could do:
sys.path.append(str(Path(__file__).parent.parent.parent.parent / "utils")) | |
sys.path.append(str(Path(__file__).parents[4] / "utils")) |
but it's totally ok like it is right now.
Hi, @stas00 Thank you for the feedbacks.
I would prefer to merge as it is now, and work on these points in another PR. The main reason is that I ran the full suite of tests, the results look all good, and would like to merge with a version that has been fully tested :-) |
# Conflicts: # .github/workflows/add-model-like.yml # .github/workflows/model-templates.yml
1080be1
to
9bc8e1a
Compare
Merged now (after rebase on main for the merged |
* move test model folders (TODO: fix imports and others) * fix (potentially partially) imports (in model test modules) * fix (potentially partially) imports (in tokenization test modules) * fix (potentially partially) imports (in feature extraction test modules) * fix import utils.test_modeling_tf_core * fix path ../fixtures/ * fix imports about generation.test_generation_flax_utils * fix more imports * fix fixture path * fix get_test_dir * update module_to_test_file * fix get_tests_dir from wrong transformers.utils * update config.yml (CircleCI) * fix style * remove missing imports * update new model script * update check_repo * update SPECIAL_MODULE_TO_TEST_MAP * fix style * add __init__ * update self-scheduled * fix add_new_model scripts * check one way to get location back * python setup.py build install * fix import in test auto * update self-scheduled.yml * update slack notification script * Add comments about artifact names * fix for yolos Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* move test model folders (TODO: fix imports and others) * fix (potentially partially) imports (in model test modules) * fix (potentially partially) imports (in tokenization test modules) * fix (potentially partially) imports (in feature extraction test modules) * fix import utils.test_modeling_tf_core * fix path ../fixtures/ * fix imports about generation.test_generation_flax_utils * fix more imports * fix fixture path * fix get_test_dir * update module_to_test_file * fix get_tests_dir from wrong transformers.utils * update config.yml (CircleCI) * fix style * remove missing imports * update new model script * update check_repo * update SPECIAL_MODULE_TO_TEST_MAP * fix style * add __init__ * update self-scheduled * fix add_new_model scripts * check one way to get location back * python setup.py build install * fix import in test auto * update self-scheduled.yml * update slack notification script * Add comments about artifact names * fix for yolos Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* move test model folders (TODO: fix imports and others) * fix (potentially partially) imports (in model test modules) * fix (potentially partially) imports (in tokenization test modules) * fix (potentially partially) imports (in feature extraction test modules) * fix import utils.test_modeling_tf_core * fix path ../fixtures/ * fix imports about generation.test_generation_flax_utils * fix more imports * fix fixture path * fix get_test_dir * update module_to_test_file * fix get_tests_dir from wrong transformers.utils * update config.yml (CircleCI) * fix style * remove missing imports * update new model script * update check_repo * update SPECIAL_MODULE_TO_TEST_MAP * fix style * add __init__ * update self-scheduled * fix add_new_model scripts * check one way to get location back * python setup.py build install * fix import in test auto * update self-scheduled.yml * update slack notification script * Add comments about artifact names * fix for yolos Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
* move test model folders (TODO: fix imports and others) * fix (potentially partially) imports (in model test modules) * fix (potentially partially) imports (in tokenization test modules) * fix (potentially partially) imports (in feature extraction test modules) * fix import utils.test_modeling_tf_core * fix path ../fixtures/ * fix imports about generation.test_generation_flax_utils * fix more imports * fix fixture path * fix get_test_dir * update module_to_test_file * fix get_tests_dir from wrong transformers.utils * update config.yml (CircleCI) * fix style * remove missing imports * update new model script * update check_repo * update SPECIAL_MODULE_TO_TEST_MAP * fix style * add __init__ * update self-scheduled * fix add_new_model scripts * check one way to get location back * python setup.py build install * fix import in test auto * update self-scheduled.yml * update slack notification script * Add comments about artifact names * fix for yolos Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
What does this PR do?
As discussed offline, this PR moves model specific test folders (e.g.
tests/bert
) totests/models
(e.g.tests/models/bert
)In addition to the necessary changes on
import
, the following changes are made:to
(see the commit)
The changes (to be reviewed particularly)
.circleci/config.yml
.github/workflows/self-scheduled.yml
src/transformers/commands/add_new_model.py
src/transformers/commands/add_new_model_like.py
utils/check_repo.py
utils/notification_service.py
utils/test_fetcher.py
Remarks:
self-push
result is hereArtifact was not found, job was probably canceled.
, but this issue exists for some time. My plan is to continue the task of changing self-push report format (and fix this issue)run_tests_flax_gpu
failure is just the same as in other runs. This is not in the scope of this PR.Model tests (models/albert, single-gpu-docker)
. It becomes a bit long (withmodels/
).