Skip to content

Updated UI for ArgParser options in TrainingTab.vue #298

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

Merged
merged 4 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,14 @@ 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 }}
Expand Down
344 changes: 178 additions & 166 deletions __tests__/text-classification.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,169 +24,181 @@ 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']
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()

// 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.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.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.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