How do I make the execute if data command work with CustomModelData?

I'm trying to check if a player has a specific item with a custom model data, but it doesn’t seem to work. execute as @a[tag=class_rogue] if data entity @s {SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{CustomModelData:1001}}} run say ok it work without tag:{CustomModelData:1001}
Continue to help post