Skip to content

Commit

Permalink
fix memory problem
Browse files Browse the repository at this point in the history
  • Loading branch information
IlyasMoutawwakil committed Mar 6, 2024
1 parent 8b3b521 commit b0818c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions optimum_benchmark/backends/py_txi/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def create_no_weights_model(self) -> None:
# unlike Transformers, TXI won't accept any missing tensors so we need to materialize the model
LOGGER.info(f"\t+ Loading no weights model from {self.no_weights_model}")
with random_init_weights():
model = self.automodel_class.from_pretrained(
self.pretrained_model = self.automodel_class.from_pretrained(
self.no_weights_model, **self.config.hub_kwargs, device_map="auto", _fast_init=False
)
LOGGER.info("\t+ Saving no weights model")
model.save_pretrained(save_directory=self.no_weights_model)
self.pretrained_model.save_pretrained(save_directory=self.no_weights_model)

if self.config.task in TEXT_GENERATION_TASKS:
LOGGER.info("\t+ Modifying generation config for fixed length generation")
Expand Down

0 comments on commit b0818c0

Please sign in to comment.