Preheat the oven to 350°F (175°C) and line a muffin tin with paper liners.
In a large bowl, whisk together the flour, sugars, baking soda, baking powder, salt, and cinnamon.
In another bowl, mix together the grated carrots, oil, milk, eggs, and vanilla extract.
Gradually add the wet ingredients to the dry ingredients and stir until combined.
Fold in the chopped walnuts if using.
Spoon the batter evenly into the prepared muffin tin.
Bake for 20-22 minutes or until a toothpick inserted into the center of a muffin comes out clean.
Let cool in the pan for 5 minutes, then transfer to a wire rack to cool completely.