Unverified Commit 4dbca500 authored by Stas Bekman's avatar Stas Bekman Committed by GitHub
Browse files

fix wandb/comet problems (#7830)



* fix wandb/comet problems

* simplify

* Update src/transformers/integrations.py
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>
parent e7aa6483
...@@ -9,8 +9,10 @@ try: ...@@ -9,8 +9,10 @@ try:
# Comet needs to be imported before any ML frameworks # Comet needs to be imported before any ML frameworks
import comet_ml # noqa: F401 import comet_ml # noqa: F401
# XXX: there should be comet_ml.ensure_configured(), like `wandb`, for now emulate it
comet_ml.Experiment(project_name="ensure_configured")
_has_comet = True _has_comet = True
except (ImportError): except (ImportError, ValueError):
_has_comet = False _has_comet = False
try: try:
...@@ -269,7 +271,7 @@ class WandbCallback(TrainerCallback): ...@@ -269,7 +271,7 @@ class WandbCallback(TrainerCallback):
'Automatic Weights & Biases logging enabled, to disable set os.environ["WANDB_DISABLED"] = "true"' 'Automatic Weights & Biases logging enabled, to disable set os.environ["WANDB_DISABLED"] = "true"'
) )
combined_dict = {**args.to_sanitized_dict()} combined_dict = {**args.to_sanitized_dict()}
if hasattr(model, "config"): if getattr(model, "config", None) is not None:
combined_dict = {**model.config.to_dict(), **combined_dict} combined_dict = {**model.config.to_dict(), **combined_dict}
wandb.init(project=os.getenv("WANDB_PROJECT", "huggingface"), config=combined_dict, name=args.run_name) wandb.init(project=os.getenv("WANDB_PROJECT", "huggingface"), config=combined_dict, name=args.run_name)
# keep track of model topology and gradients, unsupported on TPU # keep track of model topology and gradients, unsupported on TPU
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment