# doc summarization logs - from https://huggingface.co/spaces/pszemraj/document-summarization - no quantization/optimum - no compiling - the `book-summary` and `booksci` models have `use_cache` set to `False` (default) ## code relevant code changed here was in `summarize.py`: ```python import logging logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(message)s") import torch from tqdm.auto import tqdm from transformers import AutoModelForSeq2SeqLM, AutoTokenizer def load_model_and_tokenizer(model_name: str) -> tuple: """ load_model_and_tokenizer - load a model and tokenizer from a model name/ID on the hub :param str model_name: the model name/ID on the hub :return tuple: a tuple containing the model and tokenizer """ device = "cuda" if torch.cuda.is_available() else "cpu" if device == "cuda": provider = "CUDAExecutionProvider" else: provider = "CPUExecutionProvider" try: import onnxruntime from optimum.onnxruntime import ORTModelForSeq2SeqLM ort_model = ORTModelForSeq2SeqLM.from_pretrained( model_name, provider=provider, export=True, ).to(device) tokenizer = AutoTokenizer.from_pretrained(model_name) logging.info(f"Loaded model {model_name} to {device} with ONNX Runtime") return ort_model, tokenizer except ImportError as e: logging.info(f"falling back to standard model due to:{e}") model = AutoModelForSeq2SeqLM.from_pretrained( model_name, ).to(device) model = model.eval() tokenizer = AutoTokenizer.from_pretrained(model_name) logging.info(f"Loaded model {model_name} to {device}") return model, tokenizer ``` ## logs ``` 2023-04-29 22:55:43,348 - INFO - input parameters: {'length_penalty': 0.5, 'repetition_penalty': 1.0, 'no_repeat_ngram_size': 3, 'encoder_no_repeat_ngram_size': 4, 'num_beams': 4, 'min_length': 4, 'max_length': 256, 'early_stopping': True, 'do_sample': False}, batch_length=1024, batch_stride=16 0%| | 0/3 [00:00

Warning

Input text was truncated to 2048 words. That's about 17.40% of the submission.

2023-04-29 23:06:07,965 - INFO - input parameters: {'length_penalty': 0.5, 'repetition_penalty': 1.0, 'no_repeat_ngram_size': 3, 'encoder_no_repeat_ngram_size': 4, 'num_beams': 4, 'min_length': 4, 'max_length': 256, 'early_stopping': True, 'do_sample': False}, batch_length=1024, batch_stride=16 0%| | 0/3 [00:00

Warning

Input text was truncated to 2048 words. That's about 17.40% of the submission.

2023-04-29 23:08:42,584 - INFO - Loaded model pszemraj/long-t5-tglobal-base-sci-simplify to cpu 2023-04-29 23:08:42,584 - INFO - input parameters: {'length_penalty': 0.5, 'repetition_penalty': 1.0, 'no_repeat_ngram_size': 3, 'encoder_no_repeat_ngram_size': 4, 'num_beams': 4, 'min_length': 4, 'max_length': 256, 'early_stopping': True, 'do_sample': False}, batch_length=1024, batch_stride=16 0%| | 0/3 [00:00

Warning

Input text was truncated to 2048 words. That's about 17.40% of the submission.

2023-04-29 23:11:08,258 - INFO - Loaded model pszemraj/long-t5-tglobal-base-sci-simplify-elife to cpu 2023-04-29 23:11:08,258 - INFO - input parameters: {'length_penalty': 0.5, 'repetition_penalty': 1.0, 'no_repeat_ngram_size': 3, 'encoder_no_repeat_ngram_size': 4, 'num_beams': 4, 'min_length': 4, 'max_length': 256, 'early_stopping': True, 'do_sample': False}, batch_length=1024, batch_stride=16 0%| | 0/3 [00:00

Warning

Input text was truncated to 2048 words. That's about 17.40% of the submission.

2023-04-29 23:14:00,293 - INFO - Loaded model pszemraj/long-t5-tglobal-base-16384-booksci-summary-v1 to cpu 2023-04-29 23:14:00,293 - INFO - input parameters: {'length_penalty': 0.5, 'repetition_penalty': 1.0, 'no_repeat_ngram_size': 3, 'encoder_no_repeat_ngram_size': 4, 'num_beams': 4, 'min_length': 4, 'max_length': 256, 'early_stopping': True, 'do_sample': False}, batch_length=1024, batch_stride=16 0%| | 0/3 [00:00

Warning

Input text was truncated to 2048 words. That's about 17.40% of the submission.

2023-04-29 23:25:24,631 - INFO - Loaded model pszemraj/long-t5-tglobal-base-16384-booksci-summary-v1 to cpu 2023-04-29 23:25:24,631 - INFO - input parameters: {'length_penalty': 0.5, 'repetition_penalty': 1.0, 'no_repeat_ngram_size': 3, 'encoder_no_repeat_ngram_size': 4, 'num_beams': 2, 'min_length': 4, 'max_length': 256, 'early_stopping': True, 'do_sample': False}, batch_length=1024, batch_stride=16 0%| | 0/3 [00:00

Warning

Input text was truncated to 2048 words. That's about 17.40% of the submission.

2023-04-29 23:34:46,038 - INFO - Loaded model pszemraj/long-t5-tglobal-base-16384-booksci-summary-v1 to cpu 2023-04-29 23:34:46,039 - INFO - input parameters: {'length_penalty': 0.5, 'repetition_penalty': 1.0, 'no_repeat_ngram_size': 3, 'encoder_no_repeat_ngram_size': 4, 'num_beams': 4, 'min_length': 4, 'max_length': 256, 'early_stopping': True, 'do_sample': False}, batch_length=1024, batch_stride=16 0%| | 0/3 [00:00

Warning

Input text was truncated to 2048 words. That's about 17.40% of the submission.

2023-04-29 23:42:41,232 - INFO - Loaded model pszemraj/long-t5-tglobal-base-16384-book-summary to cpu 2023-04-29 23:42:41,233 - INFO - input parameters: {'length_penalty': 0.5, 'repetition_penalty': 1.0, 'no_repeat_ngram_size': 3, 'encoder_no_repeat_ngram_size': 4, 'num_beams': 2, 'min_length': 4, 'max_length': 256, 'early_stopping': True, 'do_sample': False}, batch_length=1024, batch_stride=16 0%| | 0/3 [00:00