Skip to content

Commit

Permalink
Add comment to credit code source
Browse files Browse the repository at this point in the history
Add comment to credit source where the code is taken from
  • Loading branch information
tongyao-zhu committed Feb 15, 2023
1 parent 52d4f1c commit c81110c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions generate_raw_features.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Code adapted from https://github.com/huggingface/transformers/blob/main/examples/pytorch/translation/run_translation_no_trainer.py
# !/usr/bin/env python
# coding=utf-8
# Code adapted from https://github.com/huggingface/transformers/blob/main/examples/pytorch/translation/run_translation_no_trainer.py

import argparse
import logging
Expand Down Expand Up @@ -225,7 +225,6 @@ def preprocess_function(examples):
].value
accelerator.init_trackers("translation_no_trainer", experiment_config)

# Train!
total_batch_size = args.per_device_batch_size * accelerator.num_processes

logger.info("***** Running feature generation (Inference on training set) *****")
Expand All @@ -244,7 +243,7 @@ def helper_print(name, tensor):
# a function to help with debugging
print("Tensor {} has shape {}".format(name, tensor.shape))

# set the model to evaluation mode, as we are only doing inference (one forward pass on the training set)
# changed: set the model to evaluation mode, as we are only doing inference (one forward pass on the training set)
model.eval()
with torch.no_grad():
for step, batch in enumerate(train_dataloader):
Expand Down
3 changes: 3 additions & 0 deletions sentence_splitter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# This file is originally inside: transformers/examples/legacy/seq2seq.
# Directly copied from https://github.com/huggingface/transformers/blob/main/examples/legacy/seq2seq/sentence_splitter.py
#
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 1 addition & 1 deletion utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is originally inside: transformers/examples/legacy/seq2seq.
# Taken from https://github.com/huggingface/transformers/blob/main/examples/legacy/seq2seq/utils.py
# Directly copied https://github.com/huggingface/transformers/blob/main/examples/legacy/seq2seq/utils.py
#
# Copyright 2020 The HuggingFace Team. All rights reserved.
#
Expand Down

0 comments on commit c81110c

Please sign in to comment.