Skip to content

Commit

Permalink
Add seed setting to image classification example (huggingface#18519)
Browse files Browse the repository at this point in the history
  • Loading branch information
regisss authored and oneraghavan committed Sep 26, 2022
1 parent 263045f commit d6326c8
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
HfArgumentParser,
Trainer,
TrainingArguments,
set_seed,
)
from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version, send_example_telemetry
Expand Down Expand Up @@ -214,6 +215,9 @@ def main():
"the `--output_dir` or add `--overwrite_output_dir` to train from scratch."
)

# Set seed before initializing model.
set_seed(training_args.seed)

# Initialize our dataset and prepare it for the 'image-classification' task.
if data_args.dataset_name is not None:
dataset = load_dataset(
Expand Down

0 comments on commit d6326c8

Please sign in to comment.