hf_mirrors/arabartsummarization
Model Introduction
Files & versions
Analysis

arabartsummarization

Model description

The model can be used as follows:

import torch
import argparse
from openmind import pipeline, is_torch_npu_available
import time

def parse_args():
    parser = argparse.ArgumentParser(description="Eval the model")
    parser.add_argument(
       "--model_name_or_path",
       type=str,
       help="path or model",
       default="zhouhui/arabartsummarization",
    )
    args = parser.parse_args()
    return args


def main():
    args = parse_args()
    model_path = args.model_name_or_path

    if is_torch_npu_available():
        device = "npu:0"
    else:
        device = "cpu"
    #device = "cpu"    
    seq2seq = pipeline("summarization", model=model_path,device_map=device)
    
    start_time = time.time()
    sample_text = """"The Analects of Confucius·Zilu" records that Confucius once said: "What you gain is astonishing, and what you lose is astonishing, so what?" This sentence is not literally "both gain and loss are astonishing", but A rhetorical question is intended to criticize the mentality of worrying about gains and losses. Just imagine, if you are terrified when you get anything and panic when you lose anything, how exhausting would such a life be? What Confucius really wanted to express was the wisdom of facing gains and losses calmly.

Gains and losses are a normal part of life, just like the ebb and flow of the tide and the changing of the seasons. We should face it with a peaceful mind. When you get something, you should not be complacent and get carried away with it, but you should be grateful and continue to work hard; when you lose it, you shouldn't be devastated and unable to recover, but you should analyze it rationally, learn lessons, and start over.

So, how can we maintain balance and avoid extreme emotions when facing gains and losses?

First of all, we must establish correct values. Don't take external material things or fame and fortune too seriously, but focus on inner cultivation and spiritual wealth. When we understand that the value of life is not determined by how much we have, but by our own spiritual state, gains and losses will not have an excessive impact on us.

Secondly, we must cultivate a normal mind. We must realize that things in the world are impermanent, and gains and losses are common matters for military strategists. Gaining is lucky, losing is normal. There is no need to be overly happy for gains, and there is no need to be overly sad for losses. Only by maintaining a normal mind can you maintain inner peace amidst the ups and downs of life.

Finally, learn to "let go". Buddhism often talks about "letting go", which does not mean passively avoiding the world, but refers to letting go of inner obsessions and burdens. When we can let go of our attachment to gains and losses, we can truly gain inner freedom and liberation. Being calm with gains and calm with losses is the best attitude towards the gains and losses in life. In this way, we can be freed from mental internal friction and live more relaxedly."""
    result = seq2seq(sample_text)
    print(result)

    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")

if __name__ == "__main__":
   main()

Validation Metrics

  • Loss: 2.3394
  • Rouge1: 1.142
  • Rouge2: 0.227
  • RougeL: 1.124
  • RougeLsum: 1.234

Intended uses & limitations

More information needed

Training and evaluation data

42.21K row in total

  • Training : 37.52K rows
  • Evaluation : 4.69K rows

Training procedure

Training hyperparameters

The following hyperparameters were used during training:

  • learning_rate: 5e-05
  • train_batch_size: 4
  • eval_batch_size: 4
  • seed: 42
  • optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
  • lr_scheduler_type: linear
  • num_epochs: 3

Training results

Training LossEpochStepValidation Loss
2.7841.093802.3820
2.49542.0187602.3418
2.22233.0281402.3394

Framework versions

  • Transformers 4.25.1
  • Pytorch 1.13.0+cu116
  • Datasets 2.7.1
  • Tokenizers 0.13.2