Skip to content

Commit 2f9b2ed

Browse files
committed
Fix CI
1 parent 2f680ee commit 2f9b2ed

22 files changed

+2797
-1033
lines changed

.github/workflows/tests.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ on:
1212
- reopened
1313
- synchronize
1414
- ready_for_review
15-
env:
16-
TESTING_REMOTELY: true
1715

1816
jobs:
1917
build:
@@ -32,11 +30,9 @@ jobs:
3230
node-version: ${{ matrix.node-version }}
3331
- run: npm ci
3432
- run: npm run build
35-
- run: pip install -r tests/requirements.txt
3633

3734
# Setup the testing environment
38-
- run: npm run generate-tests
39-
- run: git lfs install && GIT_CLONE_PROTECTION_ACTIVE=false git clone https://huggingface.co/Xenova/t5-small ./models/t5-small
35+
- run: git lfs install && GIT_CLONE_PROTECTION_ACTIVE=false git clone https://huggingface.co/hf-internal-testing/tiny-random-T5ForConditionalGeneration ./models/hf-internal-testing/tiny-random-T5ForConditionalGeneration
4036

4137
# Actually run tests
4238
- run: npm run test

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
"typegen": "tsc ./src/transformers.js --allowJs --declaration --emitDeclarationOnly --declarationMap --outDir types",
3434
"dev": "webpack serve --no-client-overlay",
3535
"build": "webpack && npm run typegen",
36-
"generate-tests": "python -m tests.generate_tests",
37-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose --maxConcurrency 1",
36+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --verbose --maxConcurrency 1 --runInBand",
3837
"readme": "python ./docs/scripts/build_readme.py",
3938
"docs-api": "node ./docs/scripts/generate.js",
4039
"docs-preview": "doc-builder preview transformers.js ./docs/source/ --not_python_module",

tests/configs.test.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,26 @@
22

33
import { AutoConfig, env } from '../src/transformers.js';
44
import { getFile } from '../src/utils/hub.js';
5-
import { m } from './init.js';
65

76
// Initialise the testing environment
8-
env.allowLocalModels=false;
9-
env.useFSCache=false;
7+
env.allowLocalModels = false;
8+
env.useFSCache = false;
109

11-
// Load test data generated by the python tests
12-
// TODO do this dynamically?
13-
let testsData = await (await getFile('./tests/data/config_tests.json')).json()
10+
const TEST_DATA = {
11+
'Xenova/bert-base-uncased': {
12+
model_type: 'bert',
13+
},
14+
}
1415

1516
describe('Configs', () => {
1617

17-
for (let [configName, targetConfig] of Object.entries(testsData)) {
18+
for (const [model_id, minimal_config] of Object.entries(TEST_DATA)) {
1819

19-
it(configName, async () => {
20-
let config = await AutoConfig.from_pretrained(m(configName));
21-
expect(config.model_type).toEqual(targetConfig.model_type);
22-
expect(config.is_encoder_decoder).toEqual(targetConfig.is_encoder_decoder);
20+
it(model_id, async () => {
21+
const config = await AutoConfig.from_pretrained(model_id);
22+
for(const [key, value] of Object.entries(minimal_config)) {
23+
expect(config[key]).toEqual(value);
24+
}
2325
});
2426
}
2527
});

tests/data/.gitignore

-3
This file was deleted.

0 commit comments

Comments
 (0)