This model is fine-tuned from microsoft/Phi-4-multimodal-instruct on kresnik/zeroth_korean dataset only 1 epoch.

script for fine-tuning is here, adapted from phi-4 repository example

model is trained only 174 steps on zeroth train set, and main purpose is to check if only korean ASR training can expand to other speech tasks(e.g. speech-to-text-translation)

Evaluation

ASR on zeroth-test set and Speech translation on fleurs ko <-> en speech translation result. script is here, and used 1 A40.

Model zeroth-test fleurs-ko2en fleurs-ko2en-cot fleurs-en2ko fleurs-en2ko-cot
original 195.92 5.62 2.45 6.87 4.35
finetune (this model) 7.02 7.07 9.19 13.08 9.35

Example script

orig_model_path = "microsoft/Phi-4-multimodal-instruct"
ft_model_path = "seastar105/Phi-4-mm-inst-zeroth-kor"
generation_config = GenerationConfig.from_pretrained(orig_model_path, 'generation_config.json')
processor = AutoProcessor.from_pretrained(orig_model_path, trust_remote_code=True)

model = AutoModelForCausalLM.from_pretrained(
    ft_model_path,
    trust_remote_code=True,
    torch_dtype='auto',
    _attn_implementation='flash_attention_2',
).cuda()

user_prompt = '<|user|>'
assistant_prompt = '<|assistant|>'
prompt_suffix = '<|end|>'

# task prompt is from technical report
asr_prompt = f'{user_prompt}<|audio_1|>Transcribe the audio clip into text.{prompt_suffix}{assistant_prompt}'
ast_ko_prompt = f'{user_prompt}<|audio_1|>Translate the audio to Korean.{prompt_suffix}{assistant_prompt}'
ast_cot_ko_prompt = f'{user_prompt}<|audio_1|>Transcribe the audio to text, and then translate the audio to Korean. Use <sep> as a separator between the original transcript and the translation.{prompt_suffix}{assistant_prompt}'
ast_en_prompt = f'{user_prompt}<|audio_1|>Translate the audio to English.{prompt_suffix}{assistant_prompt}'
ast_cot_en_prompt = f'{user_prompt}<|audio_1|>Transcribe the audio to text, and then translate the audio to English. Use <sep> as a separator between the original transcript and the translation.{prompt_suffix}{assistant_prompt}'

asr_ds = load_dataset("kresnik/zeroth_korean", split="test")
ast_ds = load_dataset("seastar105/fleurs_ko_en_test", split="train")

# ASR
item = asr_ds[0]
audio = (item["audio"]["array"], item["audio"]["sampling_rate"])
inputs = processor(text=asr_prompt, audios=[audio], return_tensors='pt').to(model.device)
generate_ids = model.generate(
    **inputs,
    max_new_tokens=max_new_tokens,
    generation_config=generation_config,
)
generate_ids = generate_ids[:, inputs['input_ids'].shape[1] :]
response = processor.batch_decode(
    generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)[0] # "λͺ¬ν†  킬은 μžλ…€λ“€μ΄ μ‚¬λž‘μ„ μ œλŒ€λ‘œ λͺ» λ°›κ³  크면 맀우 μ‹¬κ°ν•œ κ²°κ³Όκ°€ μ΄ˆλž˜λœλ‹€λŠ” 결둠을 λ‚΄λ ΈμŠ΅λ‹ˆλ‹€"

# AST, EN -> KO
item = ast_ds[-1]
audio = (item["en_audio"]["array"], item["en_audio"]["sampling_rate"])
inputs = processor(text=ast_en, audios=[audio], return_tensors='pt').to(model.device)
generate_ids = model.generate(
    **inputs,
    max_new_tokens=max_new_tokens,
    generation_config=generation_config,
)
generate_ids = generate_ids[:, inputs['input_ids'].shape[1] :]
response = processor.batch_decode(
    generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False
)[0] # "κ°€μž₯ μ‰½κ²Œ μ ‘κ·Ό κ°€λŠ₯ν•œ 식물 μžμ›μ€ 잎과 lΓ©gumesμ—μ„œ μ ‘κ·Ό κ°€λŠ₯ν•œ λ‹¨λ°±μ§ˆμ΄μ—ˆμ„ κ²ƒμ΄λ‹€κ°€μš” ν•˜μ§€λ§Œ 이것듀은 κ³ ν˜•μƒ λ™λ¬Όμ²˜λŸΌ μš°λ¦¬μ—κ²Œ μ†Œν™”ν•˜κΈ° μ–΄λ ΅μŠ΅λ‹ˆλ‹€λ§Œ 그것듀이 끓여 μžˆλ‹€λ©΄μš”"
Downloads last month
18
Safetensors
Model size
6B params
Tensor type
BF16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for seastar105/Phi-4-mm-inst-zeroth-kor

Finetuned
(56)
this model

Dataset used to train seastar105/Phi-4-mm-inst-zeroth-kor

Evaluation results

  • ko2en on fleurs (ko-en test intersection)
    self-reported
    7.070
  • ko2en-cot on fleurs (ko-en test intersection)
    self-reported
    9.190
  • en2ko (ko-mecab) on fleurs (ko-en test intersection)
    self-reported
    13.080
  • en2ko-cot (ko-mecab) on fleurs (ko-en test intersection)
    self-reported
    9.350
  • test CER on zeroth_korean test
    self-reported
    7.020