mirror of
https://github.com/huggingface/peft.git
synced 2025-10-20 15:33:48 +08:00
Update style with ruff 0.2.2 (#1565)
This is necessary to add to main fast, or else all branches from main will require these changes to pass the quality checks.
This commit is contained in:
@ -260,9 +260,7 @@ def main():
|
|||||||
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
||||||
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"CPU Total Peak Memory consumed during the train (max): {}".format(
|
f"CPU Total Peak Memory consumed during the train (max): {tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)}"
|
||||||
tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
train_epoch_loss = total_loss / len(train_dataloader)
|
train_epoch_loss = total_loss / len(train_dataloader)
|
||||||
train_ppl = torch.exp(train_epoch_loss)
|
train_ppl = torch.exp(train_epoch_loss)
|
||||||
@ -294,9 +292,7 @@ def main():
|
|||||||
accelerator.print(f"CPU Memory consumed at the end of the eval (end-begin): {tracemalloc.cpu_used}")
|
accelerator.print(f"CPU Memory consumed at the end of the eval (end-begin): {tracemalloc.cpu_used}")
|
||||||
accelerator.print(f"CPU Peak Memory consumed during the eval (max-begin): {tracemalloc.cpu_peaked}")
|
accelerator.print(f"CPU Peak Memory consumed during the eval (max-begin): {tracemalloc.cpu_peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"CPU Total Peak Memory consumed during the eval (max): {}".format(
|
f"CPU Total Peak Memory consumed during the eval (max): {tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)}"
|
||||||
tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
correct = 0
|
correct = 0
|
||||||
|
@ -211,9 +211,7 @@ def main():
|
|||||||
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
||||||
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"CPU Total Peak Memory consumed during the train (max): {}".format(
|
f"CPU Total Peak Memory consumed during the train (max): {tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)}"
|
||||||
tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
train_epoch_loss = total_loss / len(train_dataloader)
|
train_epoch_loss = total_loss / len(train_dataloader)
|
||||||
train_ppl = torch.exp(train_epoch_loss)
|
train_ppl = torch.exp(train_epoch_loss)
|
||||||
@ -244,9 +242,7 @@ def main():
|
|||||||
accelerator.print(f"CPU Memory consumed at the end of the eval (end-begin): {tracemalloc.cpu_used}")
|
accelerator.print(f"CPU Memory consumed at the end of the eval (end-begin): {tracemalloc.cpu_used}")
|
||||||
accelerator.print(f"CPU Peak Memory consumed during the eval (max-begin): {tracemalloc.cpu_peaked}")
|
accelerator.print(f"CPU Peak Memory consumed during the eval (max-begin): {tracemalloc.cpu_peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"CPU Total Peak Memory consumed during the eval (max): {}".format(
|
f"CPU Total Peak Memory consumed during the eval (max): {tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)}"
|
||||||
tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
correct = 0
|
correct = 0
|
||||||
|
@ -1052,18 +1052,14 @@ def main(args):
|
|||||||
accelerator.print(f"GPU Memory consumed at the end of the train (end-begin): {tracemalloc.used}")
|
accelerator.print(f"GPU Memory consumed at the end of the train (end-begin): {tracemalloc.used}")
|
||||||
accelerator.print(f"GPU Peak Memory consumed during the train (max-begin): {tracemalloc.peaked}")
|
accelerator.print(f"GPU Peak Memory consumed during the train (max-begin): {tracemalloc.peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"GPU Total Peak Memory consumed during the train (max): {}".format(
|
f"GPU Total Peak Memory consumed during the train (max): {tracemalloc.peaked + b2mb(tracemalloc.begin)}"
|
||||||
tracemalloc.peaked + b2mb(tracemalloc.begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
accelerator.print(f"CPU Memory before entering the train : {b2mb(tracemalloc.cpu_begin)}")
|
accelerator.print(f"CPU Memory before entering the train : {b2mb(tracemalloc.cpu_begin)}")
|
||||||
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
||||||
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"CPU Total Peak Memory consumed during the train (max): {}".format(
|
f"CPU Total Peak Memory consumed during the train (max): {tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)}"
|
||||||
tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the pipeline using using the trained modules and save it.
|
# Create the pipeline using using the trained modules and save it.
|
||||||
|
@ -1060,18 +1060,14 @@ def main(args):
|
|||||||
accelerator.print(f"GPU Memory consumed at the end of the train (end-begin): {tracemalloc.used}")
|
accelerator.print(f"GPU Memory consumed at the end of the train (end-begin): {tracemalloc.used}")
|
||||||
accelerator.print(f"GPU Peak Memory consumed during the train (max-begin): {tracemalloc.peaked}")
|
accelerator.print(f"GPU Peak Memory consumed during the train (max-begin): {tracemalloc.peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"GPU Total Peak Memory consumed during the train (max): {}".format(
|
f"GPU Total Peak Memory consumed during the train (max): {tracemalloc.peaked + b2mb(tracemalloc.begin)}"
|
||||||
tracemalloc.peaked + b2mb(tracemalloc.begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
accelerator.print(f"CPU Memory before entering the train : {b2mb(tracemalloc.cpu_begin)}")
|
accelerator.print(f"CPU Memory before entering the train : {b2mb(tracemalloc.cpu_begin)}")
|
||||||
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
||||||
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"CPU Total Peak Memory consumed during the train (max): {}".format(
|
f"CPU Total Peak Memory consumed during the train (max): {tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)}"
|
||||||
tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the pipeline using using the trained modules and save it.
|
# Create the pipeline using using the trained modules and save it.
|
||||||
|
@ -1225,9 +1225,7 @@ def main(args):
|
|||||||
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
accelerator.print(f"CPU Memory consumed at the end of the train (end-begin): {tracemalloc.cpu_used}")
|
||||||
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
accelerator.print(f"CPU Peak Memory consumed during the train (max-begin): {tracemalloc.cpu_peaked}")
|
||||||
accelerator.print(
|
accelerator.print(
|
||||||
"CPU Total Peak Memory consumed during the train (max): {}".format(
|
f"CPU Total Peak Memory consumed during the train (max): {tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)}"
|
||||||
tracemalloc.cpu_peaked + b2mb(tracemalloc.cpu_begin)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the pipeline using using the trained modules and save it.
|
# Create the pipeline using using the trained modules and save it.
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
Script to close stale issue. Taken in part from the AllenNLP repository.
|
Script to close stale issue. Taken in part from the AllenNLP repository.
|
||||||
https://github.com/allenai/allennlp.
|
https://github.com/allenai/allennlp.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
from datetime import timezone
|
from datetime import timezone
|
||||||
|
Reference in New Issue
Block a user