indoT5-AMRToTextGenerator-V1.1

Model ini adalah versi fine-tuned tugas generasi teks dari Abstract Meaning Representation (AMR) dalam Bahasa Indonesia. Proses fine-tuning dilakukan dengan menggunakan Dataset Augemnted dari AMRParser abdiharyadi/taufiq-indo-amr-generation-gold-v1.1-uncased terhadap XSum Indonesia.

Bahasa Utama: Indonesia

Tujuan Penggunaan

  • Penggunaan Utama: Model ini ditujukan untuk mengubah representasi AMR (Abstract Meaning Representation) dalam Bahasa Indonesia menjadi teks naratif yang dapat dibaca manusia. Ini bisa berguna untuk aplikasi seperti peringkasan teks berbasis AMR, augmentasi data, atau alat bantu pemahaman struktur semantik.

Cara Penggunaan

    from transformers import T5TokenizerFast, AutoModelForSeq2SeqLM
    import torch

    model_path = "fabhiansan/indoT5-AMRToTextGenerator"
    tokenizer_path = "fabhiansan/indoT5-AMRToTextGenerator"

    tokenizer = T5TokenizerFast.from_pretrained(tokenizer_path)
    model = AutoModelForSeq2SeqLM.from_pretrained(model_path)

    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    model.to(device)
    model.eval() # Set model ke mode evaluasi

    contoh_amr = """
    (w / want-01
          :ARG0 (b / boy)
          :ARG1 (g / go-01
                :ARG0 b
                :ARG2 (c / cinema)))
    """
    prefix = "translate graph to indonesian: "
    input_text = prefix + contoh_amr.strip() # Hilangkan spasi berlebih di awal/akhir

    inputs = tokenizer(
        input_text,
        return_tensors='pt',
        padding=True,
        truncation=True,
        max_length=512
    )

    inputs = {k: v.to(device) for k, v in inputs.items()}

    print("Melakukan generasi teks...")
    with torch.no_grad(): # Tidak perlu menghitung gradien saat inferensi
        outputs = model.generate(
            input_ids=inputs['input_ids'],
            attention_mask=inputs['attention_mask'],
            max_length=512,       # Max length untuk output yang digenerasi
            num_beams=5,          # Contoh parameter beam search
            repetition_penalty=2.5,
            length_penalty=1.0,
            early_stopping=True
        )
        
    generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
        
    print("\nInput AMR:")
    print(contoh_amr)
    print("\nGenerated Indonesian Text:")
    print(generated_text)

Penelitian terkait (Daryanto dan Khodra, 2022):

@INPROCEEDINGS{9932960,
  author={Daryanto, Taufiq Husada and Khodra, Masayu Leylia},
  booktitle={2022 9th International Conference on Advanced Informatics: Concepts, Theory and Applications (ICAICTA)},
  title={Indonesian AMR-to-Text Generation by Language Model Fine-tuning},
  year={2022},
  volume={},
  number={},
  pages={1-6},
  doi={10.1109/ICAICTA56449.2022.9932960}
    }
Downloads last month
-
Safetensors
Model size
248M params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train fabhiansan/indoT5-AMRToTextGenerator

Collection including fabhiansan/indoT5-AMRToTextGenerator