Skip to content
Closed
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
de9ff13
Added pythion-fire as default argument parser
guptaaryan16 Jul 20, 2023
4067218
Added Python-Fire as Default Argument Parser
guptaaryan16 Jul 20, 2023
cdf63cd
Merge branch 'python-fire' of https://github.com/guptaaryan16/code-ge…
guptaaryan16 Jul 20, 2023
8c00268
Add fire to requirements.txt
guptaaryan16 Jul 20, 2023
6d18005
Fix tests
guptaaryan16 Jul 20, 2023
38b54be
Added fire as a requirement in templates
guptaaryan16 Jul 21, 2023
8a7da4d
Add fire as requirement in CI
guptaaryan16 Jul 24, 2023
884f329
Changed error for output dir
guptaaryan16 Jul 24, 2023
4a06b83
fix setup_loggings function in utils.py
guptaaryan16 Jul 24, 2023
d0c1595
Changed some file
guptaaryan16 Jul 24, 2023
066bc3b
Change settings for config.output_dir
guptaaryan16 Jul 25, 2023
8f8093a
Adding option for Different ArgumentParsers and Reverting tests fixes
guptaaryan16 Jul 27, 2023
d663808
Introducing UI features for selecting ArgParsers in templates
guptaaryan16 Jul 28, 2023
69f26bc
Format files and fix bugs for python-fire
guptaaryan16 Jul 28, 2023
182e0d6
Updated the 'python-fire' to fire
guptaaryan16 Jul 30, 2023
afded70
Added changes to the main file
guptaaryan16 Jul 31, 2023
6b7162b
changed the fmt
guptaaryan16 Jul 31, 2023
465e08d
Update ci.yml
guptaaryan16 Jul 31, 2023
bff5afd
Made some formatting changes and added necessary import conditions
guptaaryan16 Jul 31, 2023
4fad607
Update ci.yml
guptaaryan16 Jul 31, 2023
7dcd79f
Made the change for if condition in python-fire
guptaaryan16 Aug 1, 2023
bceeff3
Made some formatting changes and added the shutil option
guptaaryan16 Aug 1, 2023
8030856
Made changes to imports according to python-fire
guptaaryan16 Aug 1, 2023
ee89b15
Added a change in the configuration
guptaaryan16 Aug 1, 2023
03b4736
Update ci.yml
guptaaryan16 Aug 1, 2023
0c777d0
Fix CI
guptaaryan16 Aug 1, 2023
778fcb0
Merge branch 'test_python_fire' of https://github.com/guptaaryan16/co…
guptaaryan16 Aug 1, 2023
ac071a2
Some formatting for dist_lint
guptaaryan16 Aug 1, 2023
a22d8c9
Fix tests for CI
guptaaryan16 Aug 1, 2023
19132b7
Update ci.yml
guptaaryan16 Aug 1, 2023
4cb90e6
Merge branch 'python-fire' of https://github.com/guptaaryan16/code-ge…
guptaaryan16 Aug 2, 2023
ba86a8f
Try to edit formatting for the PR
guptaaryan16 Aug 2, 2023
8ff8357
Merge branch 'pytorch-ignite:main' into python-fire
guptaaryan16 Aug 10, 2023
156ab1b
Merge branch 'python-fire' of https://github.com/guptaaryan16/code-ge…
guptaaryan16 Aug 10, 2023
916ff6f
Fix brackets in config.output_dir/config-lock.yaml
guptaaryan16 Aug 10, 2023
e72e9b9
Changed `pnpm run test` script and CI to add option for text based ma…
guptaaryan16 Aug 10, 2023
7ceb6a1
Add test files for python-fire based arguments
guptaaryan16 Aug 10, 2023
5d198e9
Added script and CI workflow for Python fire
guptaaryan16 Aug 10, 2023
a97ef74
fix fmt
guptaaryan16 Aug 10, 2023
c73c817
Made some refactoring of tests and add argparser keyword in normal te…
guptaaryan16 Aug 10, 2023
168951e
fix port in templates
guptaaryan16 Aug 10, 2023
36ac5f0
fix bugs in ci.yaml and utils.yaml
guptaaryan16 Aug 10, 2023
e5f82b3
fix `pnpm run dist_lint` for argparse and python-fire
guptaaryan16 Aug 10, 2023
cd4a310
bug fixes
guptaaryan16 Aug 11, 2023
fdbbd93
try to fix ci.yaml
guptaaryan16 Aug 11, 2023
4b572d4
fix tests for argparser
guptaaryan16 Aug 11, 2023
45028d5
fix bugs
guptaaryan16 Aug 11, 2023
07d5dd7
fix ci pnpm dist_lint and few bugs
guptaaryan16 Aug 11, 2023
d797f79
made some changes
guptaaryan16 Aug 11, 2023
c1936fe
Fix bugs and parametrize tests
guptaaryan16 Aug 11, 2023
e7191d2
fix utils.py for argparse
guptaaryan16 Aug 11, 2023
aadcdd3
fix bugs
guptaaryan16 Aug 12, 2023
ae02110
Made changes for spawn in templates accorging to https://pytorch-igni…
guptaaryan16 Aug 14, 2023
981bb25
added bug fixes and removed DotDict for easydict
guptaaryan16 Aug 14, 2023
0193479
fmt fix
guptaaryan16 Aug 14, 2023
b664423
Revert "fmt fix"
guptaaryan16 Aug 14, 2023
d7b5655
Added DictConfig(OmegaConfig) as a substitute to easydict
guptaaryan16 Aug 14, 2023
f582019
lint fix
guptaaryan16 Aug 14, 2023
374befe
add omegaconf to requirements.txt in CI
guptaaryan16 Aug 14, 2023
e189d65
Merge branch 'main' into python-fire
vfdev-5 Aug 14, 2023
0f43798
Removed unzip_all function from run_tests_fire.sh
guptaaryan16 Aug 14, 2023
c291955
Added None check in python-fire config storage and docs link in the R…
guptaaryan16 Aug 15, 2023
034fcf6
Merge branch 'python-fire' of https://github.com/guptaaryan16/code-ge…
guptaaryan16 Aug 15, 2023
4a30ad6
Update src/templates/template-text-classification/main.py
guptaaryan16 Aug 15, 2023
1f6a93e
fmt fix and "value is not None" fix for main.py files in templates
guptaaryan16 Aug 15, 2023
8df0609
Changed the config copy logic in templates
guptaaryan16 Aug 15, 2023
5927270
Fix fmt dist_lint issues
guptaaryan16 Aug 15, 2023
2ed5929
Bug fixes
guptaaryan16 Aug 16, 2023
0386877
fmt fix
guptaaryan16 Aug 16, 2023
507995c
Fix bugs
guptaaryan16 Aug 16, 2023
6137c01
fmt fix
guptaaryan16 Aug 16, 2023
0497bd8
Made necessary changes
guptaaryan16 Aug 16, 2023
dfb64d6
removed unncessary code in store config-lock.yaml
guptaaryan16 Aug 16, 2023
97c1151
Make omegaconfig default requirement in all templates
guptaaryan16 Aug 16, 2023
dc4e5b0
Revert the TrainingTab.vue change from 'Configuration Options' to 'Tr…
guptaaryan16 Aug 16, 2023
5083908
add 'setup_config_saving' in utils.py
guptaaryan16 Aug 17, 2023
568f42a
fix bug in setup_config_saving
guptaaryan16 Aug 17, 2023
548b3d2
bugs fix in templates
guptaaryan16 Aug 17, 2023
f88980f
Merge branch 'main' of https://github.com/guptaaryan16/code-generator…
guptaaryan16 Aug 17, 2023
1d71dff
fix default argparser import
guptaaryan16 Aug 17, 2023
7f99957
fix bugs in templates
guptaaryan16 Aug 17, 2023
47edf95
Merge branch 'main' of https://github.com/guptaaryan16/code-generator…
guptaaryan16 Aug 17, 2023
72add75
fix `from argparse import ArgumentParser
guptaaryan16 Aug 17, 2023
fc311d7
Add docs and links to argument parsers in TabTraining.vue
guptaaryan16 Aug 17, 2023
5e4ebc6
changed description of TrainingTab.vue Training options
guptaaryan16 Aug 17, 2023
6bd1841
Changed save_config API for utils.py
guptaaryan16 Aug 18, 2023
4822e98
fmt fix
guptaaryan16 Aug 18, 2023
0f96ca5
Revert str method use in 'setup_output_dir' in utils.py
guptaaryan16 Aug 18, 2023
d324180
Update utils.py
guptaaryan16 Aug 18, 2023
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,21 @@ jobs:
pip install tqdm

- run: pnpm build
- run: pnpm test:ci

- name: pnpm test:ci ${{ matrix.template }}
env:
NPM_CONFIG: ${{ matrix.template }}
run: pnpm test:ci

- run: sh ./scripts/run_tests.sh unzip
- run: pnpm dist_lint
- run: pnpm dist_lint ${{ matrix.template }}

- name: 'Run ${{ matrix.template }} ${{ matrix.test }}'
run: sh ./scripts/run_tests.sh ${{ matrix.test }} ${{ matrix.template }}

- name: 'Run ${{ matrix.template }} ${{ matrix.test }} - Python Fire'
run: sh ./scripts/run_tests_fire.sh ${{ matrix.test }} ${{ matrix.template }}

lint:
runs-on: ubuntu-latest
steps:
Expand Down
364 changes: 198 additions & 166 deletions __tests__/text-classification.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,169 +24,201 @@ afterEach(async () => {
await context.close()
})

test('text classification simple', async () => {
await page.selectOption('select', 'template-text-classification')

await page.waitForSelector('text=README.md')

await page.click('text=Loggers')
await page.click('text=config.yaml')

// TODO: simplify the downloadPromise calls
// Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button
const downloadPromise = await page
.waitForEvent('download', { timeout: 2000 })
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
// these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})

await downloadPromise.saveAs('./dist-tests/text-classification-simple.zip')
})

test('text classification all', async () => {
await page.selectOption('select', 'template-text-classification')

await page.check('#include_test-checkbox')
expect(await page.isChecked('#include_test-checkbox')).toBeTruthy()

await page.waitForSelector('text=README.md')
await page.click('text=Training')

await page.check('#deterministic-checkbox')
expect(await page.isChecked('#deterministic-checkbox')).toBeTruthy()

await page.click('text=Handlers')

await page.check('#save_training-checkbox')
expect(await page.isChecked('#save_training-checkbox')).toBeTruthy()

await page.check('#save_evaluation-checkbox')
expect(await page.isChecked('#save_evaluation-checkbox')).toBeTruthy()

await page.fill('#filename_prefix-input-text', 'training')
expect(await page.$eval('#filename_prefix-input-text', (e) => e.value)).toBe(
'training'
)

await page.fill('#save_every_iters-input-number', '2')
expect(
await page.$eval('#save_every_iters-input-number', (e) => e.value)
).toBe('2')

await page.fill('#n_saved-input-number', '2')
expect(await page.$eval('#n_saved-input-number', (e) => e.value)).toBe('2')

await page.check('#terminate_on_nan-checkbox')
expect(await page.isChecked('#terminate_on_nan-checkbox')).toBeTruthy()

await page.fill('#patience-input-number', '2')
expect(await page.$eval('#patience-input-number', (e) => e.value)).toBe('2')

await page.fill('#limit_sec-input-number', '60')
expect(await page.$eval('#limit_sec-input-number', (e) => e.value)).toBe('60')

await page.click('text=Loggers')
await page.click('text=config.yaml')

const downloadPromise = await page
.waitForEvent('download', { timeout: 2000 })
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
await downloadPromise.saveAs('./dist-tests/text-classification-all.zip')
})

test('text classification launch', async () => {
await page.selectOption('select', 'template-text-classification')

await page.waitForSelector('text=README.md')
await page.click('text=Training')

await page.check('#use_dist-checkbox')
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()

expect(await page.isChecked('#dist-torchrun-radio')).toBeTruthy()

await page.click('text=Loggers')
await page.click('text=config.yaml')

const downloadPromise = await page
.waitForEvent('download', { timeout: 2000 })
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})

await downloadPromise.saveAs('./dist-tests/text-classification-launch.zip')
})

test('text classification spawn', async () => {
await page.selectOption('select', 'template-text-classification')

await page.waitForSelector('text=README.md')
await page.click('text=Training')

await page.check('#use_dist-checkbox')
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()

await page.check('#dist-spawn-radio')
expect(await page.isChecked('#dist-spawn-radio')).toBeTruthy()

await page.click('text=Loggers')
await page.click('text=config.yaml')

const downloadPromise = await page
.waitForEvent('download', { timeout: 2000 })
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
await downloadPromise.saveAs('./dist-tests/text-classification-spawn.zip')
})
const parser = ['argparse', 'fire']
for (const name of parser) {
test(`text-classification simple ${name}`, async () => {
await page.selectOption('select', 'template-text-classification')

await page.waitForSelector('text=README.md')

await page.click('text=Loggers')
await page.click('text=config.yaml')
await page.getByText('Training', { exact: true }).click()

await page
.getByRole('combobox', {
name: 'Select the argument parser for training'
})
.selectOption(`${name}`)
// TODO: simplify the downloadPromise calls
// Here we are trying to wait for 2 seconds before clicking on the `Code` and `Download Zip` button
const downloadPromise = await page
.waitForEvent('download', { timeout: 2000 })
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
// these catch calls are required to make sure if CI fails initially then we can have something to rely for further tests
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})

await downloadPromise.saveAs(
`./dist-tests/text-classification-simple-${name}.zip`
)
})

test(`text-classification all ${name}`, async () => {
await page.selectOption('select', 'template-text-classification')

await page.check('#include_test-checkbox')
expect(await page.isChecked('#include_test-checkbox')).toBeTruthy()

await page.waitForSelector('text=README.md')
await page.getByText('Training', { exact: true }).click()
await page
.getByRole('combobox', {
name: 'Select the argument parser for training'
})
.selectOption(`${name}`)
await page.check('#deterministic-checkbox')
expect(await page.isChecked('#deterministic-checkbox')).toBeTruthy()

await page.click('text=Handlers')

await page.check('#save_training-checkbox')
expect(await page.isChecked('#save_training-checkbox')).toBeTruthy()

await page.check('#save_evaluation-checkbox')
expect(await page.isChecked('#save_evaluation-checkbox')).toBeTruthy()

await page.fill('#filename_prefix-input-text', 'training')
expect(
await page.$eval('#filename_prefix-input-text', (e) => e.value)
).toBe('training')

await page.fill('#save_every_iters-input-number', '2')
expect(
await page.$eval('#save_every_iters-input-number', (e) => e.value)
).toBe('2')

await page.fill('#n_saved-input-number', '2')
expect(await page.$eval('#n_saved-input-number', (e) => e.value)).toBe('2')

await page.check('#terminate_on_nan-checkbox')
expect(await page.isChecked('#terminate_on_nan-checkbox')).toBeTruthy()

await page.fill('#patience-input-number', '2')
expect(await page.$eval('#patience-input-number', (e) => e.value)).toBe('2')

await page.fill('#limit_sec-input-number', '60')
expect(await page.$eval('#limit_sec-input-number', (e) => e.value)).toBe(
'60'
)

await page.click('text=Loggers')
await page.click('text=config.yaml')

const downloadPromise = await page
.waitForEvent('download', { timeout: 2000 })
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
await downloadPromise.saveAs(
`./dist-tests/text-classification-all-${name}.zip`
)
})

test(`text-classification launch ${name}`, async () => {
await page.selectOption('select', 'template-text-classification')

await page.waitForSelector('text=README.md')
await page.getByText('Training', { exact: true }).click()

await page
.getByRole('combobox', {
name: 'Select the argument parser for training'
})
.selectOption(`${name}`)
await page.check('#use_dist-checkbox')
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()

expect(await page.isChecked('#dist-torchrun-radio')).toBeTruthy()

await page.click('text=Loggers')
await page.click('text=config.yaml')

const downloadPromise = await page
.waitForEvent('download', { timeout: 2000 })
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})

await downloadPromise.saveAs(
`./dist-tests/text-classification-launch-${name}.zip`
)
})

test('text-classification spawn', async () => {
await page.selectOption('select', 'template-text-classification')

await page.waitForSelector('text=README.md')
await page.getByText('Training', { exact: true }).click()
await page
.getByRole('combobox', {
name: 'Select the argument parser for training'
})
.selectOption(`${name}`)
await page.check('#use_dist-checkbox')
expect(await page.isChecked('#use_dist-checkbox')).toBeTruthy()

await page.check('#dist-spawn-radio')
expect(await page.isChecked('#dist-spawn-radio')).toBeTruthy()

await page.click('text=Loggers')
await page.click('text=config.yaml')

const downloadPromise = await page
.waitForEvent('download', { timeout: 2000 })
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
.catch(() => {
page.getByRole('button', { name: 'Code' }).click()
page.getByRole('button', { name: 'Download Zip' }).click()
return page.waitForEvent('download', { timeout: 2000 })
})
await downloadPromise.saveAs(
`./dist-tests/text-classification-spawn-${name}.zip`
)
})
}
Loading