8000 Add onmt_config converter to facilitate switch by francoishernandez · Pull Request #69 · eole-nlp/eole · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add onmt_config converter to facilitate switch #69

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 3 commits into from
Jul 12, 2024

Conversation

francoishernandez
Copy link
Member

Related to #66

⚠️ This converter is not 100% exhaustive and probably will never be. It's intended to facilitate the task though.
See the logs for "Remaining unmapped items" that you may need to check manually, or errors raised by the validation.

@francoishernandez francoishernandez marked this pull request as ready for review July 12, 2024 12:49
@francoishernandez
Copy link
Member Author

Example with the wmt17 OpenNMT-py config

root@eda4baa52803:/work# eole convert onmt_config test_config.yaml converted_config.yaml -a transformer
{
    'save_data': 'wmt17_en_de/data',
    'overwrite': True,
    'src_vocab': 'wmt17_en_de/vocab.shared',
    'tgt_vocab': 'wmt17_en_de/vocab.shared',
    'src_vocab_size': 36000,
    'tgt_vocab_size': 36000,
    'vocab_size_multiple': 8,
    'src_words_min_frequency': 2,
    'tgt_words_min_frequency': 2,
    'share_vocab': True,
    'n_sample': 0,
    'seed': 1,
    'report_every': 100,
    'training': {
        'model_path': 'wmt17_en_de/bigwmt17',
        'keep_checkpoint': 50,
        'save_checkpoint_steps': 5000,
        'average_decay': 0,
        'train_steps': 50000,
        'valid_steps': 5000,
        'bucket_size': 262144,
        'num_workers': 4,
        'prefetch_factor': 400,
        'world_size': 1,
        'gpu_ranks': [0],
        'batch_type': 'tokens',
        'batch_size': 5000,
        'valid_batch_size': 4096,
        'batch_size_multiple': 8,
        'accum_count': [10],
        'accum_steps': [0],
        'compute_dtype': 'fp16',
        'optim': 'fusedadam',
        'learning_rate': 2,
        'warmup_steps': 4000,
        'decay_method': 'noam',
        'adam_beta2': 0.998,
        'max_grad_norm': 0,
        'label_smoothing': 0.1,
        'param_init': 0,
        'param_init_glorot': True,
        'normalization': 'tokens',
        'dropout_steps': [0],
        'dropout': [0.1],
        'attention_dropout': [0.1]
    },
    'data': {
        'corpus_1': {'path_src': 'wmt17_en_de/train.src.bpe.shuf', 'path_tgt': 'wmt17_en_de/train.trg.bpe.shuf'},
        'valid': {'path_src': 'wmt17_en_de/dev.src.bpe', 'path_tgt': 'wmt17_en_de/dev.trg.bpe'}
    },
    'model': {
        'architecture': 'transformer',
        'heads': 16,
        'hidden_size': 1024,
        'word_vec_size': 1024,
        'transformer_ff': 4096,
        'share_decoder_embeddings': True,
        'share_embeddings': True,
        'encoder': {'encoder_type': 'transformer', 'layers': 6},
        'decoder': {'decoder_type': 'transformer', 'layers': 6}
    }
}
Saving converted config to: converted_config.yaml
Remaining unmapped items:
{'src_seq_length', 'position_encoding', 'tgt_seq_length'}
Converted config seems ok!

--> 3 unmapped items :

@francoishernandez
Copy link
Member Author

Some nice-to-haves would be to implement custom logic to handle converting currently unmapped items to their new counterparts, e.g. position_encoding/max_relative_positions -> position_encoding_type/n_positions, ...

@francoishernandez francoishernandez merged commit 316bbc2 into main Jul 12, 2024
4 checks passed
@francoishernandez francoishernandez deleted the convert_onmt_config branch February 7, 2025 08:56
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.

1 participant
0