{"action":"created","issue":{"url":"https://api.github.com/repos/tensorflow/tensor2tensor/issues/703","repository_url":"https://api.github.com/repos/tensorflow/tensor2tensor","labels_url":"https://api.github.com/repos/tensorflow/tensor2tensor/issues/703/labels{/name}","comments_url":"https://api.github.com/repos/tensorflow/tensor2tensor/issues/703/comments","events_url":"https://api.github.com/repos/tensorflow/tensor2tensor/issues/703/events","html_url":"https://github.com/tensorflow/tensor2tensor/pull/703","id":313432765,"number":703,"title":"Multiple input features for transformer model","user":{"login":"franckbrl","id":14164320,"avatar_url":"https://avatars1.githubusercontent.com/u/14164320?v=4","gravatar_id":"","url":"https://api.github.com/users/franckbrl","html_url":"https://github.com/franckbrl","followers_url":"https://api.github.com/users/franckbrl/followers","following_url":"https://api.github.com/users/franckbrl/following{/other_user}","gists_url":"https://api.github.com/users/franckbrl/gists{/gist_id}","starred_url":"https://api.github.com/users/franckbrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franckbrl/subscriptions","organizations_url":"https://api.github.com/users/franckbrl/orgs","repos_url":"https://api.github.com/users/franckbrl/repos","events_url":"https://api.github.com/users/franckbrl/events{/privacy}","received_events_url":"https://api.github.com/users/franckbrl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-04-11T18:13:27Z","updated_at":"2018-04-20T18:15:32Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/tensorflow/tensor2tensor/pulls/703","html_url":"https://github.com/tensorflow/tensor2tensor/pull/703","diff_url":"https://github.com/tensorflow/tensor2tensor/pull/703.diff","patch_url":"https://github.com/tensorflow/tensor2tensor/pull/703.patch"},"body":"Hello,\r\n\r\nHere is a proposition to add a translate problem with multiple source features for the transformer model. This is similar to [input features for RNN-based models](http://www.aclweb.org/anthology/W16-2209).\r\n\r\nAdditionally to input words, the problem can take an arbitrary number of features. A ready-to-use example is provided for English-to-French translation, with English PoS-tags and lemmas, in `tensor2tensor/data_generators/translate_enfr_src_feat.py`. Quick experiments with nearly no best checkpoint search and no averaging were performed and gave a BLEU of 39.76. In comparison, a basic model with only words as inputs (and +4M parameters) gave 39.14, which seems rather consistent with the results in the paper cited above.\r\n\r\nThe problem, model and input modalities are all defined in `tensor2tensor/data_generators/translate_source_features.py`.\r\n\r\nThis pull request also contains a modification of `tensor2tensor/models/transformer.py`, adding a specific hidden size for the encoder (`enc_hidden_size`), which can now be different from the decoder. Since all input features of arbitrary sizes are concatenated, the resulting encoder size has to be larger than `hidden_size`.\r\n\r\nSpecifically for inference, `tensor2tensor/bin/t2t_decoder.py` was added a new flag for the input file containing source features. Finally, `tensor2tensor/utils/decoding.py` was modified to pre-process all input features.\r\n\r\nThere is one issue I could not solve. The decoding time is much slower with the source feature model: `1m19.265s`, against `0m49.117s` for basic model, on the provided test set (measured with unix time). I probably missed something in `tensor2tensor/utils/decoding.py` and I would be grateful if anyone could help with this."},"comment":{"url":"https://api.github.com/repos/tensorflow/tensor2tensor/issues/comments/383179752","html_url":"https://github.com/tensorflow/tensor2tensor/pull/703#issuecomment-383179752","issue_url":"https://api.github.com/repos/tensorflow/tensor2tensor/issues/703","id":383179752,"user":{"login":"franckbrl","id":14164320,"avatar_url":"https://avatars1.githubusercontent.com/u/14164320?v=4","gravatar_id":"","url":"https://api.github.com/users/franckbrl","html_url":"https://github.com/franckbrl","followers_url":"https://api.github.com/users/franckbrl/followers","following_url":"https://api.github.com/users/franckbrl/following{/other_user}","gists_url":"https://api.github.com/users/franckbrl/gists{/gist_id}","starred_url":"https://api.github.com/users/franckbrl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/franckbrl/subscriptions","organizations_url":"https://api.github.com/users/franckbrl/orgs","repos_url":"https://api.github.com/users/franckbrl/repos","events_url":"https://api.github.com/users/franckbrl/events{/privacy}","received_events_url":"https://api.github.com/users/franckbrl/received_events","type":"User","site_admin":false},"created_at":"2018-04-20T18:15:32Z","updated_at":"2018-04-20T18:15:32Z","author_association":"NONE","body":"I just fixed an important issue with word tokenization during vocabulary generation."}}
{"actor":{"display_login":"franckbrl"}}