Does learn.predict() need something different to the model in its forward pass?

Could somebody help me understand this discrepancy? Passing a tensor straight to the model returns the expected result, but returns an error if I use learn.predict(). Should the input be different somehow?

Many thanks!

It’s hard to know when we have no idea how you created your data object.

Oh. Apologies. Is this more helpful? I’m still finding my way around so this might not be the ideal way to approach this! I’m passing encoded chess positions to a learner object and trying to predict the result of the game that they came from.

Just noticed the double range_of() in there. Oops! Doesn’t seem to have affected anything though

Mmm, are you sure you have the latest of fastcore? Everything seems pretty good in your data.

Just done a git pull + editable install and it says it’s up to date. Same error though. I don’t know if this is related, but i’ve also been struggling to get learn.export() to work. I’m only mentioning it here because ‘NoneType’ and ‘new_empty’ both sound similar in my head, not because I have any deeper reason to think they might be connected!

Here is the learner object, just for completeness image

I can reproduce the second error, will fix later today or on Monday. But I don’t have the first one (which is basically that your TfmdLists does not get types automatically populated. Normally, after creating it, tls.types should not be None, but that appears to be the case when you call predict.

That’s great. Thanks for all your help! I can work around the .predict() issue. I’ll report back if I uncover the problem though

Fixed the export problem.