mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-08-23 14:22:51 +08:00
[trainer] fix swanlab callback (#7176)
Former-commit-id: 8ad03258e16309158368384e2a0a707845536133
This commit is contained in:
parent
6e58115f98
commit
c67d2b9327
@ -600,7 +600,15 @@ def get_swanlab_callback(finetuning_args: "FinetuningArguments") -> "TrainerCall
|
|||||||
return
|
return
|
||||||
|
|
||||||
super().setup(args, state, model, **kwargs)
|
super().setup(args, state, model, **kwargs)
|
||||||
|
|
||||||
|
try:
|
||||||
|
if hasattr(self, "_swanlab"):
|
||||||
|
swanlab_public_config = self._swanlab.get_run().public.json()
|
||||||
|
else: # swanlab <= 0.4.9
|
||||||
swanlab_public_config = self._experiment.get_run().public.json()
|
swanlab_public_config = self._experiment.get_run().public.json()
|
||||||
|
except Exception as e:
|
||||||
|
swanlab_public_config = {}
|
||||||
|
|
||||||
with open(os.path.join(args.output_dir, SWANLAB_CONFIG), "w") as f:
|
with open(os.path.join(args.output_dir, SWANLAB_CONFIG), "w") as f:
|
||||||
f.write(json.dumps(swanlab_public_config, indent=2))
|
f.write(json.dumps(swanlab_public_config, indent=2))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user