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

Training on Django #4

Open
jayavardhanr opened this issue May 30, 2018 · 2 comments
Open

Training on Django #4

jayavardhanr opened this issue May 30, 2018 · 2 comments

Comments

@jayavardhanr
Copy link

I am just running the command given in the readme file to train the model on django dataset.

. train.sh django

I get the below error. I haven't able to able to fix this. Is the something you faced?
The code runs perfectly for the "hs" dataset.

Traceback (most recent call last):
  File "code_gen.py", line 163, in <module>
    learner.train()
  File "/users/PAS1351/osu9907/NL2code/learner.py", line 111, in train
    bleu, accuracy = evaluation.evaluate_decode_results(self.val_data, decode_results, verbose=False)
  File "/users/PAS1351/osu9907/NL2code/evaluation.py", line 170, in evaluate_decode_results
    bleu_score = sentence_bleu([refer_tokens_for_bleu], pred_tokens_for_bleu, weights=ngram_weights, smoothing_function=sm.method3)
  File "/users/PAS1351/osu9907/envs/nl2code/lib/python2.7/site-packages/nltk/translate/bleu_score.py", line 79, in sentence_bleu
    return corpus_bleu([references], [hypothesis], weights, smoothing_function)
  File "/users/PAS1351/osu9907/envs/nl2code/lib/python2.7/site-packages/nltk/translate/bleu_score.py", line 180, in corpus_bleu
    return bp * math.exp(math.fsum(s))
  File "/users/PAS1351/osu9907/envs/nl2code/lib/python2.7/site-packages/nltk/translate/bleu_score.py", line 178, in <genexpr>
    if p_i.numerator != 0)
AttributeError: 'float' object has no attribute 'numerator'
@laila182
Copy link

laila182 commented Jul 9, 2019

hello , i find same error can you tell me solution to this problem ?

@pcyin
Copy link
Owner

pcyin commented Jul 15, 2019

Hi, the django training script can only be used in the Python2 environment, since the target code to generate in this dataset is written in Python 2.

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

No branches or pull requests

3 participants