"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "691fd8fdded34497451bc638716eb8fbd484883a"
Unverified Commit 3cab9027 authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Add examples telemetry (#17552)

* Add examples telemetry

* Alternative approach

* Add to all other examples

* Add to templates as well

* Put framework separately

* Same for TensorFlow
parent 9e72eb44
...@@ -52,7 +52,7 @@ from transformers import ( ...@@ -52,7 +52,7 @@ from transformers import (
HfArgumentParser, HfArgumentParser,
is_tensorboard_available, is_tensorboard_available,
) )
from transformers.utils import get_full_repo_name, is_offline_mode from transformers.utils import get_full_repo_name, is_offline_mode, send_example_telemetry
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -388,6 +388,10 @@ def main(): ...@@ -388,6 +388,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_image_captioning", model_args, data_args, framework="flax")
if ( if (
os.path.exists(training_args.output_dir) os.path.exists(training_args.output_dir)
and os.listdir(training_args.output_dir) and os.listdir(training_args.output_dir)
......
...@@ -58,7 +58,7 @@ from transformers import ( ...@@ -58,7 +58,7 @@ from transformers import (
set_seed, set_seed,
) )
from transformers.testing_utils import CaptureLogger from transformers.testing_utils import CaptureLogger
from transformers.utils import get_full_repo_name from transformers.utils import get_full_repo_name, send_example_telemetry
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -328,6 +328,10 @@ def main(): ...@@ -328,6 +328,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_clm", model_args, data_args, framework="flax")
if ( if (
os.path.exists(training_args.output_dir) os.path.exists(training_args.output_dir)
and os.listdir(training_args.output_dir) and os.listdir(training_args.output_dir)
......
...@@ -58,7 +58,7 @@ from transformers import ( ...@@ -58,7 +58,7 @@ from transformers import (
is_tensorboard_available, is_tensorboard_available,
set_seed, set_seed,
) )
from transformers.utils import get_full_repo_name from transformers.utils import get_full_repo_name, send_example_telemetry
MODEL_CONFIG_CLASSES = list(FLAX_MODEL_FOR_MASKED_LM_MAPPING.keys()) MODEL_CONFIG_CLASSES = list(FLAX_MODEL_FOR_MASKED_LM_MAPPING.keys())
...@@ -365,6 +365,10 @@ def main(): ...@@ -365,6 +365,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_mlm", model_args, data_args, framework="flax")
if ( if (
os.path.exists(training_args.output_dir) os.path.exists(training_args.output_dir)
and os.listdir(training_args.output_dir) and os.listdir(training_args.output_dir)
......
...@@ -57,7 +57,7 @@ from transformers import ( ...@@ -57,7 +57,7 @@ from transformers import (
set_seed, set_seed,
) )
from transformers.models.t5.modeling_flax_t5 import shift_tokens_right from transformers.models.t5.modeling_flax_t5 import shift_tokens_right
from transformers.utils import get_full_repo_name from transformers.utils import get_full_repo_name, send_example_telemetry
MODEL_CONFIG_CLASSES = list(FLAX_MODEL_FOR_MASKED_LM_MAPPING.keys()) MODEL_CONFIG_CLASSES = list(FLAX_MODEL_FOR_MASKED_LM_MAPPING.keys())
...@@ -498,6 +498,10 @@ def main(): ...@@ -498,6 +498,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_t5_mlm", model_args, data_args, framework="flax")
if ( if (
os.path.exists(training_args.output_dir) os.path.exists(training_args.output_dir)
and os.listdir(training_args.output_dir) and os.listdir(training_args.output_dir)
......
...@@ -53,7 +53,7 @@ from transformers import ( ...@@ -53,7 +53,7 @@ from transformers import (
PreTrainedTokenizerFast, PreTrainedTokenizerFast,
is_tensorboard_available, is_tensorboard_available,
) )
from transformers.utils import check_min_version, get_full_repo_name from transformers.utils import check_min_version, get_full_repo_name, send_example_telemetry
from utils_qa import postprocess_qa_predictions from utils_qa import postprocess_qa_predictions
...@@ -424,6 +424,10 @@ def main(): ...@@ -424,6 +424,10 @@ def main():
model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1])) model_args, data_args, training_args = parser.parse_json_file(json_file=os.path.abspath(sys.argv[1]))
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_qa", model_args, data_args, framework="flax")
# endregion # endregion
# region Logging # region Logging
......
...@@ -54,7 +54,7 @@ from transformers import ( ...@@ -54,7 +54,7 @@ from transformers import (
HfArgumentParser, HfArgumentParser,
is_tensorboard_available, is_tensorboard_available,
) )
from transformers.utils import get_full_repo_name, is_offline_mode from transformers.utils import get_full_repo_name, is_offline_mode, send_example_telemetry
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -399,6 +399,10 @@ def main(): ...@@ -399,6 +399,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_summarization", model_args, data_args, framework="flax")
if ( if (
os.path.exists(training_args.output_dir) os.path.exists(training_args.output_dir)
and os.listdir(training_args.output_dir) and os.listdir(training_args.output_dir)
......
...@@ -48,7 +48,7 @@ from transformers import ( ...@@ -48,7 +48,7 @@ from transformers import (
TrainingArguments, TrainingArguments,
is_tensorboard_available, is_tensorboard_available,
) )
from transformers.utils import check_min_version, get_full_repo_name from transformers.utils import check_min_version, get_full_repo_name, send_example_telemetry
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -308,6 +308,10 @@ def main(): ...@@ -308,6 +308,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_glue", model_args, data_args, framework="flax")
# Make one log on every process with the configuration for debugging. # Make one log on every process with the configuration for debugging.
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -47,7 +47,7 @@ from transformers import ( ...@@ -47,7 +47,7 @@ from transformers import (
HfArgumentParser, HfArgumentParser,
is_tensorboard_available, is_tensorboard_available,
) )
from transformers.utils import check_min_version, get_full_repo_name from transformers.utils import check_min_version, get_full_repo_name, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -366,6 +366,10 @@ def main(): ...@@ -366,6 +366,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_ner", model_args, data_args, framework="flax")
# Make one log on every process with the configuration for debugging. # Make one log on every process with the configuration for debugging.
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -53,7 +53,7 @@ from transformers import ( ...@@ -53,7 +53,7 @@ from transformers import (
is_tensorboard_available, is_tensorboard_available,
set_seed, set_seed,
) )
from transformers.utils import get_full_repo_name from transformers.utils import get_full_repo_name, send_example_telemetry
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -256,6 +256,10 @@ def main(): ...@@ -256,6 +256,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_image_classification", model_args, data_args, framework="flax")
if ( if (
os.path.exists(training_args.output_dir) os.path.exists(training_args.output_dir)
and os.listdir(training_args.output_dir) and os.listdir(training_args.output_dir)
......
...@@ -37,7 +37,7 @@ from transformers import ( ...@@ -37,7 +37,7 @@ from transformers import (
set_seed, set_seed,
) )
from transformers.trainer_utils import get_last_checkpoint from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -197,6 +197,10 @@ def main(): ...@@ -197,6 +197,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_audio_classification", model_args, data_args)
# Setup logging # Setup logging
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -47,7 +47,7 @@ from transformers import ( ...@@ -47,7 +47,7 @@ from transformers import (
set_seed, set_seed,
) )
from transformers.trainer_utils import get_last_checkpoint from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -233,6 +233,10 @@ def main(): ...@@ -233,6 +233,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_clip", model_args, data_args)
# 2. Setup logging # 2. Setup logging
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -45,7 +45,7 @@ from transformers import ( ...@@ -45,7 +45,7 @@ from transformers import (
TrainingArguments, TrainingArguments,
) )
from transformers.trainer_utils import get_last_checkpoint from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -175,6 +175,10 @@ def main(): ...@@ -175,6 +175,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_image_classification", model_args, data_args)
# Setup logging # Setup logging
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -47,7 +47,7 @@ from transformers import ( ...@@ -47,7 +47,7 @@ from transformers import (
SchedulerType, SchedulerType,
get_scheduler, get_scheduler,
) )
from transformers.utils import get_full_repo_name from transformers.utils import get_full_repo_name, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -201,6 +201,10 @@ def parse_args(): ...@@ -201,6 +201,10 @@ def parse_args():
def main(): def main():
args = parse_args() args = parse_args()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_image_classification_no_trainer", args)
# Initialize the accelerator. We will let the accelerator handle device placement for us in this example. # Initialize the accelerator. We will let the accelerator handle device placement for us in this example.
# If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers
# in the environment # in the environment
......
...@@ -34,7 +34,7 @@ from transformers import ( ...@@ -34,7 +34,7 @@ from transformers import (
ViTMAEForPreTraining, ViTMAEForPreTraining,
) )
from transformers.trainer_utils import get_last_checkpoint from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -175,6 +175,10 @@ def main(): ...@@ -175,6 +175,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_mae", model_args, data_args)
# Setup logging # Setup logging
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -37,7 +37,7 @@ from transformers import ( ...@@ -37,7 +37,7 @@ from transformers import (
TrainingArguments, TrainingArguments,
) )
from transformers.trainer_utils import get_last_checkpoint from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -239,6 +239,10 @@ def main(): ...@@ -239,6 +239,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_mim", model_args, data_args)
# Setup logging # Setup logging
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -48,7 +48,7 @@ from transformers import ( ...@@ -48,7 +48,7 @@ from transformers import (
) )
from transformers.testing_utils import CaptureLogger from transformers.testing_utils import CaptureLogger
from transformers.trainer_utils import get_last_checkpoint from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -214,6 +214,10 @@ def main(): ...@@ -214,6 +214,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_clm", model_args, data_args)
# Setup logging # Setup logging
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -52,7 +52,7 @@ from transformers import ( ...@@ -52,7 +52,7 @@ from transformers import (
default_data_collator, default_data_collator,
get_scheduler, get_scheduler,
) )
from transformers.utils import get_full_repo_name from transformers.utils import get_full_repo_name, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -239,6 +239,10 @@ def parse_args(): ...@@ -239,6 +239,10 @@ def parse_args():
def main(): def main():
args = parse_args() args = parse_args()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_clm_no_trainer", args)
# Initialize the accelerator. We will let the accelerator handle device placement for us in this example. # Initialize the accelerator. We will let the accelerator handle device placement for us in this example.
# If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers
# in the environment # in the environment
......
...@@ -47,7 +47,7 @@ from transformers import ( ...@@ -47,7 +47,7 @@ from transformers import (
set_seed, set_seed,
) )
from transformers.trainer_utils import get_last_checkpoint from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -224,6 +224,10 @@ def main(): ...@@ -224,6 +224,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_mlm", model_args, data_args)
# Setup logging # Setup logging
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
...@@ -52,7 +52,7 @@ from transformers import ( ...@@ -52,7 +52,7 @@ from transformers import (
SchedulerType, SchedulerType,
get_scheduler, get_scheduler,
) )
from transformers.utils import get_full_repo_name from transformers.utils import get_full_repo_name, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -248,6 +248,10 @@ def parse_args(): ...@@ -248,6 +248,10 @@ def parse_args():
def main(): def main():
args = parse_args() args = parse_args()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_mlm_no_trainer", args)
# Initialize the accelerator. We will let the accelerator handle device placement for us in this example. # Initialize the accelerator. We will let the accelerator handle device placement for us in this example.
# If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers # If we're using tracking, we also need to initialize it here and it will by default pick up all supported trackers
# in the environment # in the environment
......
...@@ -42,7 +42,7 @@ from transformers import ( ...@@ -42,7 +42,7 @@ from transformers import (
set_seed, set_seed,
) )
from transformers.trainer_utils import get_last_checkpoint from transformers.trainer_utils import get_last_checkpoint
from transformers.utils import check_min_version from transformers.utils import check_min_version, send_example_telemetry
from transformers.utils.versions import require_version from transformers.utils.versions import require_version
...@@ -220,6 +220,10 @@ def main(): ...@@ -220,6 +220,10 @@ def main():
else: else:
model_args, data_args, training_args = parser.parse_args_into_dataclasses() model_args, data_args, training_args = parser.parse_args_into_dataclasses()
# Sending telemetry. Tracking the example usage helps us better allocate resources to maintain them. The
# information sent is the one passed as arguments along with your Python/PyTorch versions.
send_example_telemetry("run_plm", model_args, data_args)
# Setup logging # Setup logging
logging.basicConfig( logging.basicConfig(
format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment