Preheat oven to 350°F. Line two 12-cup standard muffin tins with paper liners. Set aside.
In a medium bowl, whisk together the flour, baking powder, baking soda, salt and cinnamon. Set aside.
In a large bowl, whisk together the oil and sugars until combined. Add the eggs one at a time, whisking after each addition. Whisk in the vanilla.
Add the dry ingredients to the wet ingredients and mix until just combined. Fold in the carrots and walnuts (if using). Divide batter between muffin tins.
Bake for 18-20 minutes or until a toothpick inserted into the center of a cupcake comes out clean. Allow to cool completely before frosting.