Convert pagasus to dynamic quantize for best perfomance

Can you help me to pass this code to Dinamyc Quantize, it is a hugging face model based on Pegasus (google/pegasus-xsum), I have low perfomance and investigating, you can use dynamic quantize in this kind of models. Can someone give me a hand, I am a newbie. :frowning:
If you could give me some tips about hyperparameters in the pipeline, it would be very helpful.

from transformers import pipeline ,PegasusForConditionalGeneration, PegasusTokenizer
from config import Config
import torch
import os
from utils import Utils


torch.manual_seed(42)
torch.set_grad_enabled(False)

num_threads, device = Utils.get_device_threads()
torch.set_num_threads(num_threads)
    
class Summarize:
  def __init__(self):
      
      self.model_name = Config['MODEL_NAME']
      self.tokenizer  = PegasusTokenizer.from_pretrained(Config['MODEL_NAME'])
      self.model      = PegasusForConditionalGeneration.from_pretrained(Config['MODEL_NAME']).eval()
      self.summarizer = pipeline("summarization", model=self.model_name, tokenizer=self.tokenizer, framework="pt",batch_size=2,device= device)
  
  def summarize(self, conversation, max_token):
    try:
      gen_kwargs = {"max_length": max_token, "length_penalty":0.1, "num_beams": 1, "early_stopping": True,  "min_length": 10, "max_length": 512, "temperature":0.5,"no_repeat_ngram_size": 3}
      return self.summarizer(conversation, **gen_kwargs)[0]['summary_text']
    except:
      return "Sorry, I was unable to generate a summary for this conversation"