The error AttributeError: 'NoneType' object has no attribute 'shape' is likely due to a dataset formatting or reward function issue, especially since it works in Colab but fails on Windows. This error often occurs if your dataset or reward function returns None or an unexpected structure, causing downstream code to access .shape on a NoneType. Unsloth's GRPOTrainer is sensitive to dataset and reward function formatting—ensure your dataset and reward function return the expected types and shapes. Also, check that your Windows environment matches Colab in terms of library versions and that your dataset is a HuggingFace Dataset, not a plain list or other type, as .map() and batching require this structure.
For similar issues, see the advice to carefully check dataset formatting and reward function outputs in this Unsloth issue. If the problem persists, try printing the outputs of your reward function and the structure of your dataset before passing them to the trainer to identify where None is being introduced.
Would you like a step-by-step checklist to debug your dataset and reward function?
Sources: