[doc] add no build isolation (#8103)

This commit is contained in:
hoshi-hiyouga
2025-05-19 19:25:13 +08:00
committed by GitHub
parent a0b4b91577
commit beae231af6
5 changed files with 8 additions and 7 deletions

View File

@@ -63,8 +63,8 @@ if is_transformers_version_greater_than("4.49.0"):
except ImportError:
try:
# If that fails, try importing from the new location
from transformers.video_utils import make_batched_videos
from transformers.image_utils import make_flat_list_of_images
from transformers.video_utils import make_batched_videos
except ImportError:
raise ImportError(
"Could not import make_batched_videos and make_flat_list_of_images. "

View File

@@ -84,14 +84,15 @@ def run_pt(
perplexity = math.exp(metrics[f"eval_{key}_loss"])
except OverflowError:
perplexity = float("inf")
metrics[f"eval_{key}_perplexity"] = perplexity
else:
try:
perplexity = math.exp(metrics["eval_loss"])
except OverflowError:
perplexity = float("inf")
metrics["eval_perplexity"] = perplexity
metrics["eval_perplexity"] = perplexity
trainer.log_metrics("eval", metrics)
trainer.save_metrics("eval", metrics)