Dinosaur gradient clipping


I’m getting this error and I tried a lot of things. Its so simple that I’m blocked:

TypeError: ‘>=’ not supported between instances of ‘str’ and ‘int’

I guess it’s because the way I iterate on the dictionary.
np.clip(item, -maxValue, maxValue, out = None)

I tried also to do it on gradients[key] and I was getting a different error but also an error.
And clip was not happening.

1 Like

What did you define as “item”?

If you’re trying to clip the gradients, you need to pass it to the np.clip() function somewhere as the input, and also as the output.

So “out = None” is not correct.

1 Like

item in the collection was to iterate the dictionary.
Seen your hint I realized I needed to iterate using key. Now it’s fixed, thank you.

1 Like