Model potential calculations of Be I and Mg I oscillator strengths