Course 5 W1 Assignment 2 Exercise 4

I’m trying to write the model() function for exercise 4.
I’m encountering this error. But i cannot understand why this seems to be happening. Here is the error:

TypeError                                 Traceback (most recent call last)
<ipython-input-23-725c093d6b91> in <module>
----> 1 parameters, last_name = model(data.split("\n"), ix_to_char, char_to_ix, 22001, verbose = True)
      3 assert last_name == 'Trodonosaurus\n', "Wrong expected output"
      4 print("\033[92mAll tests passed!")

<ipython-input-20-c02a61e9c4b1> in model(data_x, ix_to_char, char_to_ix, num_iterations, n_a, dino_names, vocab_size, verbose)
     87                 # Sample indices and print them
---> 88                 sampled_indices = sample(parameters, char_to_ix, seed)
     89                 last_dino_name = get_sample(sampled_indices, ix_to_char)
     90                 print(last_dino_name.replace('\n', ''))

TypeError: sample() takes from 1 to 2 positional arguments but 3 were given

Though the sample function i created before does accept 3 positional arguments.
The head of the sample() is:

def sample(parameters, char_to_ix, seed):

The test of sample function does gets passed. Still im encountering such error.
I’m sorry i can’t post the code of the sample function.

Hi @karnikkanojia , please be mindful about posting your queries in the right category. You are posting your query in the General Discussions category. This category is not monitored by our mentors. Your specific query belongs to, I’m guessing, DLS Course 5.

If you are unclear about how to use Discourse, we have made this guide for our learners. Hopefully reading it will help you out in posting in the appropriate categories next time.

For now, I have moved your post in the DLS Course 5 category. For future, in order to get swift responses, post in the appropriate categories.

Thank you and happy learning!

Regarding your error message.

In the model() function, perhaps the values in the ‘parameters’ or ‘char_to_ix’ variables are incorrect.
Did your code modify either of these variables?