Skip to content

Commit 81156d2

Browse files
sguggerLysandreJik
andauthored
Add model like (huggingface#14992)
* Add new model like command * Bad doc-styler * black and doc-styler, stop fighting! * black and doc-styler, stop fighting! * At last * Clean up * Typo * Bad doc-styler * Bad doc-styler * All good maybe? * Use constants * Add doc and type hints * More cleaning * Add doc * Fix Copied from * Doc template * Use typing.Pattern instead * Framework-specific files * Fixes * Select frameworks clean model init * Deal with frameworks in main init * fixes * Last fix * Prompt user for info * Delete exemple config * Last fixes * Add test config * Fix bug with model_type included in each other * Fixes * More fixes * More fixes * Adapt config * Remove print statements * Will fix tokenization later, leave it broken for now * Add test * Quality * Try this way * Debug * Maybe by setting the path? * Let's try another way * It should go better when actually passing the arg... * Remove debug statements and style * Fix config * Add tests * Test require the three backends * intermediate commit * Revamp pattern replacements and start work on feature extractors * Adapt model info * Finalize code for processors * Fix in main init additions * Finish questionnaire for processing classes * Fix file name * Fix for real * Fix patterns * Style * Remove needless warnings * Copied from should work now. * Include Copied form in blocks * Add test * More fixes and tests * Apply suggestions from code review Co-authored-by: Lysandre Debut <lysandre@huggingface.co> * Address review comment Co-authored-by: Lysandre Debut <lysandre@huggingface.co>
1 parent 457dd43 commit 81156d2

File tree

6 files changed

+2902
-0
lines changed

6 files changed

+2902
-0
lines changed

.github/workflows/add-model-like.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Add model like runner
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
paths:
9+
- "src/**"
10+
- "tests/**"
11+
- ".github/**"
12+
types: [opened, synchronize, reopened]
13+
14+
jobs:
15+
run_tests_templates:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
20+
- name: Loading cache.
21+
uses: actions/cache@v2
22+
id: cache
23+
with:
24+
path: ~/.cache/pip
25+
key: v1-tests_model_like
26+
restore-keys: |
27+
v1-tests_model_like-${{ hashFiles('setup.py') }}
28+
v1-tests_model_like
29+
30+
- name: Install dependencies
31+
run: |
32+
pip install --upgrade pip!=21.3
33+
sudo apt -y update && sudo apt install -y libsndfile1-dev
34+
pip install .[dev]
35+
36+
- name: Create model files
37+
run: |
38+
transformers-cli add-new-model-like --config_file tests/fixtures/add_distilbert_like_config.json --path_to_repo .
39+
make style
40+
make fix-copies
41+
42+
- name: Run all PyTorch modeling test
43+
run: |
44+
python -m pytest -n 2 --dist=loadfile -s --make-reports=tests_new_models tests/test_modeling_bert_new.py
45+
46+
- name: Run style changes
47+
run: |
48+
git fetch origin master:master
49+
make style && make quality && make repo-consistency
50+
51+
- name: Failure short reports
52+
if: ${{ always() }}
53+
run: cat reports/tests_new_models_failures_short.txt
54+
55+
- name: Test suite reports artifacts
56+
if: ${{ always() }}
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: run_all_tests_new_models_test_reports
60+
path: reports

0 commit comments

Comments
 (0)