Giter Site home page Giter Site logo

translate.py about nematus HOT 47 CLOSED

edinburghnlp avatar edinburghnlp commented on June 30, 2024
translate.py

from nematus.

Comments (47)

jigyasa06 avatar jigyasa06 commented on June 30, 2024 1

@rsennrich @pjwilliams @Avmb can you please guide .

from nematus.

rsennrich avatar rsennrich commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

thank you so much for your guidance. i also want to ask you one more doubt regarding translate.py . i was actually trying to only train the model for 10 epochs just to see how the model is actually working but i got this error

DataLossError (see above for traceback): Unable to open table file /home/sakhuja/experiment/nematus/model.npz: Data loss: file is too short to be an sstable: perhaps your file is in a different file format and you need to use a different restore operator?
[[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, ..., DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_FLOAT, DT_INT32], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]

i want to know why this error is occuring and also,
as, the maximum number of epochs you have set is 5000 but it takes a lot of time in training can you please suggest me how much epochs i should take for training to run this model. BEFORE I TOOK 350 EPOCHS, BUT as you are good at it so please provide me with some guidance.

thank you so much once again. 👍

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

i am using the same tensorflow version 1.8.0 for both saving and restoring the model still the error is coming.
and i also want to ask you in translate.py what is the input which we have to provide and output i made a output2.txt file

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

hey can you please help me with this . I am waiting for your reply.

thank you so much.

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

Thank you so much for your reply and concern.

The command which I wrote for training is :

jigyasa$ python nmt.py --source_dataset /Users/jigyasa/Desktop/thesis/code_generation_bpefiles/train/decldesc_train_bpe --target_dataset /Users/jigyasa/Desktop/thesis/code_generation_bpefiles/train/bodies_train_bpe --dictionaries /Users/jigyasa/Desktop/thesis/dataset_for_my_thesis/code_generation_nmt_dictionary/train/decldesc_train_bpe.json /Users/jigyasa/Desktop/thesis/dataset_for_my_thesis/code_generation_nmt_dictionary/train/bodies_train_bpe.json --valid_datasets /Users/jigyasa/Desktop/thesis/code_generation_bpefiles/validate/decldesc_valid_bpe /Users/jigyasa/Desktop/thesis/code_generation_bpefiles/validate/bodies_valid_bpe --model /Users/Jigyasa/Desktop/model.npz --max_epochs 350

I just created a file with touch command and named it as model.npz and I gave the path of this file as shown above.

please let me know if this is right or not .
Best Regards,
JIgyasa

from nematus.

bricksdont avatar bricksdont commented on June 30, 2024

touch creates an empty file. If you created an empty file named model.npz: why?

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

I created an empty file for a model so that all the things can store there in the model file .

And then i gave the path to that model .

Please suggest me then how to make a model file and then if not touch which command to use ?

Thank you
Regards
Jigyasa

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

@pjwilliams and @rsennrich please guide me.

Thank you
Best regards
Jigyasa

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

hi @pjwilliams thank you so much for your reply this means a lot. Actually firstly i did my training without giving any model but after some epochs around 200 maybe the error came that the model cannot store .. the model path not found. like that ... that is why i gave the model name model.npz with a path .

over there in the read me it is given to give the parameter --model path what does it really mean?
these two commands I added afterwards .. due to some errors..

--model /Users/Jigyasa/Desktop/model.npz --max_epochs 350

now as you suggest should I train the model again and without these two commands ?

and I also want to ask you one more question regarding the epochs that the max epochs set by you is 5000 . So, it is a lot and can take a lot of training time . can you please also tell me if I don't give any epoch how much time it can take for code generation task.? @rsennrich @pjwilliams

Best Regards,
Jigyasa Sakhuja

Eagerly waiting for your reply.
Thank you so much once again.

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

Thank you so much for your reply . As suggested by you i have run the desired command and now my training has started once again . I hope this time I don't get any error, but if I will get any I will update you once again regarding that.

Thank you so much once again @pjwilliams for your support and guidance , This means a lot.

Best Regards,
Jigyasa Sakhuja

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

hey @pjwilliams @rsennrich I have been training this model on code documentation dataset since past 6 days and I have reached only till 181 epochs and the last recent info was this.

INFO: [2018-08-08 16:46:23] Epoch: 177 Update: 25000 Loss/word: 1.57721595451 Words/sec: 170.468366283 Sents/sec: 3.5156388417

So, I want to know how much time the training can take because it is taking a lot of time .
and also is there any faster way to do the training . If yes please suggest as I have not even set the number of epochs as you told not do give any number of epochs while training this model.

Thank you once again. Waiting for your reply. :)
Best Regards,
Jigyasa Sakhuja

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

Hey i got the GPU access and I am running the Code on it 👍 . I hope it works for me now.

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

screen shot 2018-08-18 at 14 04 15

hey after training it on gpu I got this message ' early stop '. I want to know is the training successful or not? @pjwilliams @rsennrich

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

i am working on code generation dataset (code-docstring-corpusp) provided by @rsennrich in automated python code generation and code documentation . I Have not generated my own dataset.
Please tell me is the dataset alryt? @rsennrich @pjwilliams
best regards,
Jigyasa Sakhuja

from nematus.

rsennrich avatar rsennrich commented on June 30, 2024

automatic code generation / documentation is more difficult than translation, so the high validation loss is no big surprise. Maybe @Avmb has his own numbers for comparison.

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

okay @rsennrich thank you for your guidance

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

hi @pjwilliams @rsennrich as i told you that i am done with my training but i am not able to run translate.py. whenever i run it i get an error as nematus creates a lot of model and we have to take the model with the best validation loss .

so can you please guide me how to actually go forward with this:
screen shot 2018-08-31 at 17 44 32
these were the models which i got after the training and i did my training as you told . Now please can you tell me how to proceed further because when i am giving this command it is giving me an error
screen shot 2018-08-31 at 17 46 13

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

<img width="567" alt="screen shot 2018-08-31 at 17 58 20" src="https://user-images.githubusercontent.com/37703929/44923088-7f033500-ad47-11e8-8992-de116898962b.png"
and when i gave my model as nematus it was running and i got this error ::

Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "nematus/translate.py", line 150, in _start_worker
output_item = self._translate(process_id, input_item, models, sess)
File "nematus/translate.py", line 166, in _translate
x, x_mask, _, _ = prepare_data(x, y_dummy, maxlen=None)
File "/home/sakhuja/jigyasa_project/nematus-master/nematus/util.py", line 36, in prepare_data
n_factors = len(seqs_x[0][0])
IndexError: list index out of range
ERROR: Translate worker process 14340 crashed with exitcode 1

I do not know where i am going wrong can you please guide me @rsennrich @pjwilliams @Avmb

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

hi @pjwilliams i have taken the dataset of @Avmb and i have done the tokenization and Byte pair encoding of @rsennrich than i generated the datasets. I really want to know in the input and output what files we need to specify and what we need to specify in the -model as so many models are generated.

screen shot 2018-09-07 at 08 17 35

this is my source dataset that is the decdesc file for code generation

screen shot 2018-09-07 at 08 18 34

this is my target dataset that is the body file

@pjwilliams ,@Avmb and @rsennrich please have a look to my dataset :) and please let me know 👍
Thank you so much :)

from nematus.

rsennrich avatar rsennrich commented on June 30, 2024

your command looks fine; like Phil mentioned, translate.py would crash if empty lines are input, but this is now fixed in commit 3d97d78.

Note that, if you don't see any empty lines during training, the model won't necessarily learn what to do if it encounters empty input at test time.

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

<img width="570" alt="screen shot 2018-09-07 at 12 33 30" src="https://user-images.githubusercontent.com/37703929/45214277-4c52c280-b29a-11e8-844b-67662459c89d.png"
thank you for your updates @rsennrich after doing this i got this attribute error.Can you please see to it

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

@pjwilliams yes i made the modification as @rsennrich told me. According to that commit which he has shown me.So i have updated my translate.py file , util.py and nmt.py according to his before comment.

and i just tried to run another file score.py i got this result but nothing came in my output.txt file , it was blank
screen shot 2018-09-07 at 12 56 22

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

okay thank you so much :) i am doing that only now

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

hey @pjwilliams and @rsennrich I want to ask in translate.py in input and output what file we need to give ? i gave in input the test file of declation and description and i gave the bodies as output but i think this is not correct because in the ouput we will get the translations. So, can you please guide a little bit.

from nematus.

rsennrich avatar rsennrich commented on June 30, 2024

"--output" is the file path that you want to write to. The right "--input" depends on what type of translation system you trained: it should be the same type of text that you had on the source side at training time, preprocessed in the same way.

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

okay thank you so much :)

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

In score.py file i am getting the ouput for every sentence. For e.g. i am getting score like this
screen shot 2018-09-30 at 19 43 43
But my question is how to know about the result? @pjwilliams @rsennrich

Thank you :)

from nematus.

bricksdont avatar bricksdont commented on June 30, 2024

What do you mean by "how to know about the result"? Would you like to produce translations, or model scores?

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

i want to know about the score of the translation.. for ex BLEU score. So, that i can see what is the result .. output i mean

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

Thank you so much for helping. :) @pjwilliams

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

@pjwilliams in score.py file how is the scoring actually done? for ex: if i am getting score 231 for a line then what it means ? As you can see the result in output_score.txt

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

so basically the more the average, the better is the score. ryt? @pjwilliams

from nematus.

pjwilliams avatar pjwilliams commented on June 30, 2024

from nematus.

jigyasa06 avatar jigyasa06 commented on June 30, 2024

okay thank you so much :)

from nematus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.