Skip to content

Commit

Permalink
review(AutoGenerator): log if using Jetstream/PT or torch xla
Browse files Browse the repository at this point in the history
  • Loading branch information
tengomucho committed Sep 6, 2024
1 parent b77a352 commit 76fbf94
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from loguru import logger

from .generator_base import Generator
from .jetstream_pt_support import model_can_use_jetstream_pt

Expand All @@ -23,12 +25,14 @@ def from_pretrained(
Returns:
A TpuGenerator.
"""
if check(model_path):
if model_can_use_jetstream_pt(model_path):
logger.debug("Using Jetstream PyTorch generator.")
from .jetstream_pt_support.generator import TpuGeneratorJetStream
return TpuGeneratorJetStream.from_pretrained(
model_path, revision=revision, max_batch_size=max_batch_size, max_sequence_length=max_sequence_length
)
else:
logger.debug("Using PyTorch/XLA generator.")
from .generator import TpuGenerator
return TpuGenerator.from_pretrained(
model_path, revision=revision, max_batch_size=max_batch_size, max_sequence_length=max_sequence_length
Expand Down

0 comments on commit 76fbf94

Please sign in to comment.