The Pakistani army says it has freed 80 people from a military-run college who had been kidnapped in the northwest of the country by militants.