I don't want to burst anyone's California Dreams or anything, but if you ARE thinking of living in SF or Berekely or anywhere else more then 40 minutes from school I would HIGHLY suggest signing a month to month or 3 month or 6 month lease, just in case you decide during the year that the commute isn't worth it. I live in Sacramento (which is an hour and a half to SF on a good day) and have lived in NorCal for most of my life, and although it may not seem far to go to SF from Vallejo Bay area traffic is no joke. Not to mention when you are knee deep in tests and everything else there is really no need to add a commute to the stress. Also, bridge tolls suck.... Parking in the city can be INSANE and $$$. And street traffic is BAD during the week in addition to bridge traffic.
Unless you are the type who doesn't go to lecture anyways, I would reconsider for something closer. OR, think about living in SF second year when you feel more comfortable OR third year if you get an SF rotation spot.