tensorflow / models

Models and examples built with TensorFlow
Other
77.04k stars 45.77k forks source link

How to specify custom data files for translate model #958

Closed aronayne closed 7 years ago

aronayne commented 7 years ago

https://github.com/tensorflow/models/tree/master/tutorials/rnn/translate

The tensorflow translate model utilizes https://www.tensorflow.org/tutorials/seq2seq/ Documentation for this model describes in order to customize :

Finally, the model presented above can be used for any sequence-to-sequence task, not only for translation. Even if you want to transform a sequence to a tree, for example to generate a parsing tree, the same model as above can give state-of-the-art results, as demonstrated in Vinyals & Kaiser et al., 2014 (pdf). So you can not only build your own translator, you can also build a parser, a chat-bot, or any program that comes to your mind. Experiment!

Pre-training this model an input mapping file and it's associated output mapping file are downloaded to data dir. Running the model out of the box downloads these files :

giga-fren.release2.fixed.fr
giga-fren.release2.fixed.en
newstest2013.fr 
newstest2013.en

Inspecting the first 10 lines of each of these files :

    head -10 giga-fren.release2.fixed.fr
    Il a transformé notre vie | Il a transformé la société | Son fonctionnement | La technologie, moteur du changement Accueil | Concepts | Enseignants | Recherche | Aperçu | Collaborateurs | Web HHCC | Ressources | Commentaires Musée virtuel du Canada
    Plan du site
    Rétroaction
    Crédits
    English
    Qu’est-ce que la lumière?
    La découverte du spectre de la lumière blanche Des codes dans la lumière Le spectre électromagnétique Les spectres d’émission Les spectres d’absorption Les années-lumière La pollution lumineuse
    Le ciel des premiers habitants La vision contemporaine de l'Univers L’astronomie pour tous
    Bande dessinée
    Liens

    head -10 giga-fren.release2.fixed.en
    Changing Lives | Changing Society | How It Works | Technology Drives Change Home | Concepts | Teachers | Search | Overview | Credits | HHCC Web | Reference | Feedback Virtual Museum of Canada Home Page
    Site map
    Feedback
    Credits
    Français
    What is light ?
    The white light spectrum Codes in the light The electromagnetic spectrum Emission spectra Absorption spectra Light-years Light pollution
    The sky of the first inhabitants A contemporary vison of the Universe Astronomy for everyone
    Cartoon
    Links

head -10 newstest2013.fr
Une stratégie républicaine pour contrer la réélection d'Obama
Les dirigeants républicains justifièrent leur politique par la nécessité de lutter contre la fraude électorale.
Or, le Centre Brennan considère cette dernière comme un mythe, affirmant que la fraude électorale est plus rare aux États-Unis que le nombre de personnes tuées par la foudre.
D'ailleurs, les avocats républicains n'ont recensé que 300 cas de fraude électorale aux États-Unis en dix ans.
Une chose est certaine: ces nouvelles dispositions influenceront négativement le taux de participation.
En ce sens, ces mesures mineront en partie le système démocratique américain.
Contrairement au Canada, les États américains sont responsables de l'organisation des élections fédérales aux États-Unis.
C'est dans cet esprit qu'une majorité de gouvernements américains promulguèrent à partir de 2009 de nouvelles lois rendant plus difficile le processus d'inscription ou de vote.
Ce phénomène a pris de l'ampleur après les élections de novembre 2010 qui virent s'ajouter 675 nouveaux représentants républicains dans 26 États.
En conséquence, 180 projets de lois restreignant l'exercice du droit de vote dans 41 États furent introduits durant la seule année de 2011.

head -10 newstest2013.en
A Republican strategy to counter the re-election of Obama
Republican leaders justified their policy by the need to combat electoral fraud.
However, the Brennan Centre considers this a myth, stating that electoral fraud is rarer in the United States than the number of people killed by lightning.
Indeed, Republican lawyers identified only 300 cases of electoral fraud in the United States in a decade.
One thing is certain: these new provisions will have a negative impact on voter turn-out.
In this sense, the measures will partially undermine the American democratic system.
Unlike in Canada, the American States are responsible for the organisation of federal elections in the United States.
It is in this spirit that a majority of American governments have passed new laws since 2009 making the registration or voting process more difficult.
This phenomenon gained momentum following the November 2010 elections, which saw 675 new Republican representatives added in 26 States.
As a result, 180 bills restricting the exercise of the right to vote in 41 States were introduced in 2011 alone.

These files appear to map inputs to outputs. I've been trying to get a sense from the code https://github.com/tensorflow/models/blob/master/tutorials/rnn/translate/translate.py of how to specify custom data files. Do I need to update the translate code in order to specify custom input,output data files ? What is required in order to train on custom dataset with names : my-sentances-inputs.txt , my-sentances-outputs.txt ?

drpngx commented 7 years ago

The flags are from_train_data and to_train_data.