Skip to content
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

unify translation config #39

Merged
merged 3 commits into from
Nov 6, 2023
Merged

unify translation config #39

merged 3 commits into from
Nov 6, 2023

Conversation

Waino
Copy link
Collaborator

@Waino Waino commented Nov 6, 2023

Ding dong, the translation config is dead.

  • There is no longer a separate translation config with different structure.
  • When translating, a task must be specified. It can either be one of
    the supervised tasks used during training, or a zero-shot task added
    later.
  • Translation accepts arbitrary arguments, ignoring invalid arguments
    silently. This allows using the training config, even though many of
    the arguments have no function during translation.
  • There is currently no way to automatically generate zero-shot configs.
    Currently it must be done by hand: copypasting and editing a supervised
    task definition.

Waino added 3 commits October 30, 2023 17:50
Some opts were recently renamed, requiring changes to config-config.
HPO also requires some fixes.
- There is no longer a separate translation config with different
  structure.
- When translating, a task must be specified. It can either be one of
  the supervised tasks used during training, or a zero-shot task added
  later.
- Translation accepts arbitrary arguments, ignoring invalid arguments
  silently. This allows using the training config, even though many of
  the arguments have no function during translation.
There is currently no way to automatically generate zero-shot configs.
Currently it must be done by hand: copypasting and editing a supervised
task definition.
@Waino Waino requested a review from TimotheeMickus November 6, 2023 10:13
Copy link
Collaborator

@TimotheeMickus TimotheeMickus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

IIUC, we still need to manually provide --src, --tgt, --src_langand --tgt_lang to the translation script?

Ideally I'd want the default translation behavior to be some sort of loop over all tasks in the config. In the long run, we might want to think about supporting a path_test_{src,tgt} so as to allow only a subset of tasks to be tested.

Good enough for now, let's add this multi-test feature for a later rc2.

encoder_id=encoder_id,
decoder_id=decoder_id,
corpus_id=corpus_id,
weight=1.0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the long run, it would be good to have some tool for type checking

# tgt_subword_model = opts.in_config[0].get('tgt_subword_model', None)
# use_src_lang_token = cc_opts.get('use_src_lang_token', False)

# TODO: create zero-shot tasks using the same template as for the supervised tasks, except that:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be discussed. There's a potential risk for confusion by having two very similar types of tasks that need to be configured in slightly different ways.
I think we might want either of the following to:

  1. explicitly mark some tasks as test-only (i.e., zeroshot),
  2. halt and catch fire in partially / improperly defined tasks (any defined path_src should require device assignment and explode mid-air otherwise).

We might want a big fat DEBUG message about which tasks are defined for which steps (train/val/test), e.g. a tab-spaced table with split as columns and tasks as rows.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we generate the zero-shots already in the training config (i.e. before training), then we need to clearly mark the test-only tasks and add validation to prevent accidental mistakes.

However, I see this more as an extra transformation to run on a training config to add the zero-shot tasks, so that you can then easily use it as a translation config. You shouldn't need to decide before training whether you want a particular zero-shot or not.

@Waino
Copy link
Collaborator Author

Waino commented Nov 6, 2023

IIUC, we still need to manually provide --src, --tgt, --src_langand --tgt_lang to the translation script?

The translation script needs:
--config which can be a training config,
--model pointing to the checkpoint to use (same as before: a prefix until the component name starts)
--task_id which must correspond to a task from the config. If using a zero-shot direction, you need to make a copy of the config with the new task added and then reference the name of that task.
--src the test set input
--output the decoded output

You can give --tgt for force decoding / scoring. Although I'm not 100% sure that still works.

Ideally I'd want the default translation behavior to be some sort of loop over all tasks in the config.

Yes, this would be nice. It would require that --src is a path template with variables to fill in (primarily {src_lang}, but could depend on others as well).

Also, there should be a way to list the tasks that you want to include (and/or omit).

In the long run, we might want to think about supporting a path_test_{src,tgt} so as to allow only a subset of tasks to be tested.

I don't really like this approach, as it would mean that you need to specifiy the translation input in the config, and there can be only one.
It kind of works if you only want to evaluate on a single test set, but get's annoying quickly if that is not the case.

Also, it makes it extremely cumbersome to use the model for, you know, actually translating something.

Although for non-batch mode translation (the actual real deal), we would need to repair/reimplement the translation server.

@Waino Waino merged commit cd5fda0 into main Nov 6, 2023
@Waino Waino deleted the feat/unify-translation-config branch November 6, 2023 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants