like this: RetNetModelWithLMHead.from_pretrained(cp_lst[-1]) to: RetNetModelWithLMHead.from_pretrained(cp_lst[-1], device_map="auto")