phineas-pta / fine-tune-whisper-vi

jupyter notebooks to fine tune whisper models on Vietnamese using Colab and/or Kaggle and/or AWS EC2
Apache License 2.0
4 stars 1 forks source link

[Question] about experimental result? #2

Open phamkhactu opened 4 months ago

phamkhactu commented 4 months ago

Hi @phineas-pta (Tuấn Anh).

I'd like to ask you about your experimental result for tiny model. You have 2 method to fine-tune model. What the best result do you have? If you don't have benchmark, for you , would you like the most, Lora or traditional and why?

image I see that original whisper model has better result than model which fine-tuning with Vietnamese datasets. Maybe not good result comes from not fair evaluating? I saw you used multi vietnamese dataset?

I would like to fine-tune model with English and Vietnamese language? Do you have some advance suggestion for me?

Best regards, Tu

phineas-pta commented 4 months ago

would you like the most, Lora or traditional and why?

cái này do e xài colab free nên cấu hình chỉ đủ fine tune cái tiny hoặc lora cái large, đương nhiên là large cho kết quả tốt hơn, e ko làm lora cái tiny làm j vì error rate tương đối cao

original whisper model has better result than model which fine-tuning with Vietnamese datasets

bác đọc ngược r, cái fine tune tốt hơn original á

I would like to fine-tune model with English and Vietnamese language

👉 https://github.com/openai/whisper/discussions/1432#discussioncomment-6476120

phamkhactu commented 4 months ago

would you like the most, Lora or traditional and why?

cái này do e xài colab free nên cấu hình chỉ đủ fine tune cái tiny hoặc lora cái large, đương nhiên là large cho kết quả tốt hơn, e ko làm lora cái tiny làm j vì error rate tương đối cao

original whisper model has better result than model which fine-tuning with Vietnamese datasets

bác đọc ngược r, cái fine tune tốt hơn original á

I would like to fine-tune model with English and Vietnamese language

👉 openai/whisper#1432 (reply in thread)

Oh, đây là WER, mình đọc qua lên capture không đúng nhiều thông tin.

Mình hỏi thêm một chút, kết quả của việc training theo traditional tốt hơn hay là LoRa tốt hơn vậy bạn? Thanks bạn nhiều.

phineas-pta commented 4 months ago

kết quả của việc training theo traditional tốt hơn hay là LoRa tốt hơn vậy bạn?

e ko so sánh dc do ko làm 2 cái trên cùng model, nhưng mình nghĩ fine tune sẽ tốt hơn nhưng nếu ko đủ nguồn lực gpu thì nên làm lora

phamkhactu commented 4 months ago

kết quả của việc training theo traditional tốt hơn hay là LoRa tốt hơn vậy bạn?

e ko so sánh dc do ko làm 2 cái trên cùng model, nhưng mình nghĩ fine tune sẽ tốt hơn nhưng nếu ko đủ nguồn lực gpu thì nên làm lora

Thanks bạn nhé, để mình thử.

phamkhactu commented 3 months ago

Hi @phineas-pta

Tôi đã thử load lại model sau khi funtune nhưng bị lỗi:

Can't load tokenizer for 'my-whisper-tiny/checkpoint-800/'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'my-whisper-tiny/checkpoint-800/' is the correct path to a directory containing all relevant files for a WhisperTokenizer tokenizer.

Không biết bạn có gặp lỗi tương tự không? Tôi rất vui nếu bạn update thêm phần example infer.py. Dưới đây là code của tôi:

import torch
from transformers import WhisperForConditionalGeneration, WhisperProcessor

torch.cuda.empty_cache()

device = "cuda" if torch.cuda.is_available() else "cpu"

model = WhisperForConditionalGeneration.from_pretrained("my-whisper-tiny/checkpoint-800/").to(device)
processor = WhisperProcessor.from_pretrained("my-whisper-tiny/checkpoint-800/")
phineas-pta commented 3 months ago

bác phải kéo 6 files này từ https://huggingface.co/openai/whisper-tiny/tree/main về chung folder với checkpoint:

nếu đúng ra thì trong code sau khi TRAINER.save_model() thì phải có TOKENIZER.save_pretrained() nhưng e copy luôn nên bỏ qua

phamkhactu commented 3 months ago

bác phải kéo 6 files này từ https://huggingface.co/openai/whisper-tiny/tree/main về chung folder với checkpoint:

  • added_tokens.json
  • merges.txt
  • normalizer.json
  • special_tokens_map.json
  • tokenizer_config.json
  • vocab.json

nếu đúng ra thì trong code sau khi TRAINER.save_model() thì phải có TOKENIZER.save_pretrained() nhưng e copy luôn nên bỏ qua

Thanks bác nhé, để mình thử.

phamkhactu commented 3 months ago

Hi @phineas-pta,

Tôi hỏi một chút, Tại sao ở phần training lại dùng tokenizer=feature_extraction mà không phải là tokenizer của whisper. Trong khi phần chuẩn bị dữ liệu, labels để training thì được tạo bằng tokenizer.

trainer = Seq2SeqTrainer( 
    args=training_args,
    model=model,
    train_dataset=common_voice["train"],
    eval_dataset=common_voice["test"],
    data_collator=data_collator,
    compute_metrics=compute_metrics,
    tokenizer=processor.feature_extractor,
)

Sự ảnh hưởng ở đây là gì? Tại sao lại sử dụng như vậy. Liệu rằng nó có làm chệch(không fair) Một bên thì sử dụng làm labels thì dùng thằng A còn khi training lại dùng thằng B?

Thanks

phineas-pta commented 3 months ago

à cái này hơi lan man

do lúc đầu cái huggingface chỉ tập trung về mảng các model về text nên dùng tokenizer để xử lí đầu vào, vậy nên cái argument của cái trainer gọi là tokenizer

sau này ng ta mở rộng sang các model về audio/image/... thì cái đầu vào bây giờ ko phải là text nữa, như whisper thì đầu vào là audio nên phải dùng feature extractor, còn cái argument của trainer thì vẫn gọi là tokenizer

phamkhactu commented 3 months ago

Vậy thằng tokenizer=feature_extraction không có ý nghĩa gì đúng không? Vì mình có thấy rằng việc tính input_features đã được tính từ trước ở pre_data. Label thì được tính bằng tokenizer cũng từ trước.

Vây là việc pass tham số này vào để làm gì nhỉ?

phineas-pta commented 3 months ago

uhm bác hỏi cũng có lí 🤔 e cũng ko bik 😂 bác thử làm ko có cái đó xem có sao ko

phamkhactu commented 3 months ago

okie, nếu mình tìm được thêm thông tin mình sẽ update và trao đổi thêm vào đây nhé.

Cám ơn b nhiều nhé.

phamkhactu commented 3 months ago

@phineas-pta tôi hỏi một chút.

Nếu bgio tôi muốn tune có cả tiếng anh và tiếng việt, và việc load 1 batch thì sẽ gồm 50% của cả 2 ngôn ngữ.

Tôi ví dụ batch_size=8, thì có 4 sample là tiếng việt và 4 sample là tiếng anh. Không biết bạn có ý tưởng gì về vấn đề này không?

phineas-pta commented 3 months ago

bác phải tạo 1 cái DataLoader thay vì dùng cái dataset

phamkhactu commented 3 months ago

okie, nếu mình tìm được thêm thông tin mình sẽ update và trao đổi thêm vào đây nhé.

Cám ơn b nhiều nhé.

@phineas-pta

Tôi đã hỏi tác giả, mục tiêu chính của nó chỉ đơn giản là để fix vấn đề không đẩy lên được HUB. Nghe nó cũng không hớp lý lắm.

Đây là câu trả lời của tác giả