Seven families were left homeless last night when a three-alarm fire tore through an apartment house on the Upper West Side, officials said.

Two residents of the building, at 83 West 105th Street, were treated at the scene for smoke inhalation but no one was seriously injured in the fire, which began at 10:52 P.M., Fire Commissioner Thomas Van Essen said.

Officials said they did not know where or how the fire began. The 31-unit, five-story brick building was mostly empty because it is undergoing renovations.

More than 150 firefighters fought the blaze. While firefighters were cutting out large sections of the building's copper cornice to get to the roof, the cornice fell to the street, destroying the awning of a Chinese restaurant.

The Red Cross handed out blankets as residents watched their building burn on one of the coldest nights of the season.

''We lost everything,'' said Serafin Calo, 62, a bagel maker who had lived in the building with his wife and family for 22 years.