Something strange with last assingment

It looks a bit strange. Not just incorrect output of model, but "question: " is absent too.

I can’t pass tests due to this too

Probably it is connected with another my previous question

Hi @someone555777

Share screenshot of codes for answer_question grade cell via personal DM

Regards
DP

Hi @someone555777

Your issue with week3 assignment in relation toGRADED FUNCTION: answer_question

There are two issues

For code line

  1. Predict the next word using the model, the input document and the current state of output
    The instruction given before the grade cell for the above code line is
  • Use the transformer_utils.next_word function, which predicts the next token in the answer using the model, input document, and the current state of the output.
    But you have used incorrect parameters for the next word code as you are suppose to use tokenized_question instead of padded_question. Also you are using transformer as your model recall which is again incorrect in this case as the argument sections mentions transformer model is recalled as model.
  1. Next for code line
    Concat the predicted next word to the output
    You are suppose to mentioned tokenized_answer before next word and not next_word before tokenized_answer, causing this error.

Let me know if issue resolves.

Regards
DP

Oh, ok, thank you. I’ve changed to this and still have not expected output, but tests are fine

codes removed by moderator

Output

b'answer: Russian SFSR'

On January 9, 1957, Karachay Autonomous Oblast and Chechen-Ingush Autonomous Soviet Socialist Republic were restored by Khrushchev and they were transferred from the Georgian SSR back to the Russian SFSR.
answer: January 9, 1957

Hi @someone555777

kindly don’t share the codes directly here as it is against community guidelines.

As I mentioned in the DM that one of the post will throw you a new error, this issue does seem to be related to the previous exercise or grade cell. kindly DM the most precious grade cell codes via personal DM.

Also as a check point, can you go back and check if your all the grade cells have same output as the expected output. These assignments have output with even minor change that could throw an error in next cell or the other grade cell.

There are many threads related to this assignment, I suggest you to use also search tool.

in your post created comment the error mentions while restoring the checkpoint for encode and decoder, the restoring of checkpoint was not done. So there lies the issue.

Regards
DP

Yes, you are correct. The problem was in parse_squad(dataset).

I mixed up context and question_context. I had this before
inputs.append(question_context)

Thank you very much for help!