Preheat the oven to 350°F. Grease and lightly flour four 6-inch round cake pans (or three 8-inch round pans), tapping out any excess flour. Line the pans with parchment paper and set aside. In a large bowl, whisk together the flour, baking soda, baking powder, salt, and cinnamon, then set aside. In the bowl of a stand mixer fitted with a paddle attachment (or using a hand mixer), beat the sugars, eggs, vegetable oil, milk, and vanilla until smooth. Add half of the dry flour mixture to the wet ingredients and stir to combine. Fold in the grated carrots, then add the remaining dry ingredients along with the chopped walnuts, mixing just until no dry streaks remain. Divide the batter evenly among the prepared pans. Bake the 6-inch cakes for 40 to 45 minutes or the 8-inch cakes for 35 to 40 minutes, until a toothpick inserted in the center comes out clean, rotating the pans halfway through baking. Let the cakes cool in the pans for 5 to 8 minutes before removing and transferring them to wire racks to cool completely.