You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the file "curiosity_redteam/custom_trlx/trlx/trainer/accelerate_base_trainer.py"
Find the method: def save(self, directory: Optional[str] = None, **kwargs):
defsave(self, directory: Optional[str] =None, **kwargs):
"""Creates a checkpoint of the optimizer, scheduler and model"""dst_dir=directoryorself.config.train.checkpoint_dir# Manually copy weights to detach shared memory.withtorch.no_grad():
self.model.base_model.base_model.model.lm_head.weight=torch.nn.Parameter(self.model.base_model.base_model.model.transformer.wte.weight.clone())
self.accelerator.save_state(dst_dir, **kwargs)
ifself.config.model.peft_configisnotNoneandself.accelerator.is_main_process:
# Remove "pytorch_model.bin" because it contains more than necessary,# let save_pretrained recreate it with just the value heads.model_file=os.path.join(dst_dir, "pytorch_model.bin")
ifos.path.exists(model_file):
os.remove(model_file)
self.accelerator.unwrap_model(self.model).save_pretrained(dst_dir)
I met the same question as #6, and I fixed!
The text was updated successfully, but these errors were encountered: