Replies: 1 comment 1 reply
|
I'm guessing what's happened here is that you forgot to import text_vectoriser from tensorflow, since it's not set. Maybe you forgot to copy something from the example? |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
Having trouble with this homework question.
Only the START and END comment tags
Cell 0:
Cell 1 (DO NOT EDIT/MODIFY):
#Running this cell multiple times should return the same output since temp is 0
temp = 0.0
original_sentence = "I love languages"
translation, logit, tokens = translate(trained_translator, original_sentence, temperature=temp)
print(f"Temperature: {temp}\n\nOriginal sentence: {original_sentence}\nTranslation: {translation}\nTranslation tokens:{tokens}\nLogit: {logit:.3f}")
'NameError Traceback (most recent call last)
Cell In[127], line 6
3 temp = 0.0
4 original_sentence = "I love languages"
----> 6 translation, logit, tokens = translate(trained_translator, original_sentence, temperature=temp)
8 print(f"Temperature: {temp}\n\nOriginal sentence: {original_sentence}\nTranslation: {translation}\nTranslation tokens:{tokens}\nLogit: {logit:.3f}")
Cell In[126], line 23, in translate(model, text, max_length, temperature)
21 text = tf.strings.split([text])[0] # Assuming text is a single string
22 # Vectorize the text using the correct vectorizer
---> 23 context = text_vectorizer(text).to_tensor() # Assuming a text_vectorizer function exists
24 # Get the encoded context (pass the context through the encoder)
25 context = model.encoder(context)
NameError: name 'text_vectorizer' is not defined'
All reactions