Production of 4He and 3He from tantalum and tungsten irradiated with nucleons at energies up to 1 GeV