Coder Social home page Coder Social logo

训练发生异常 about whisper-finetune HOT 7 CLOSED

ILG2021 avatar ILG2021 commented on May 25, 2024
训练发生异常

from whisper-finetune.

Comments (7)

yeyupiaoling avatar yeyupiaoling commented on May 25, 2024 1

不太清楚你的情况,你要使用我的项目微调的话,要看文档,生成我项目所需要的数据格式。

from whisper-finetune.

aguang1201 avatar aguang1201 commented on May 25, 2024 1

@ILG2021 要改数据前处理的代码:
utils/data_utils.py:47:
input_features = [{"input_features": feature["input_features"][0]} for feature in features]
改成:
input_features = [{"input_features": feature["input_features"]} for feature in features]

from whisper-finetune.

yeyupiaoling avatar yeyupiaoling commented on May 25, 2024

你是改了什么吗?通道数都不对了

from whisper-finetune.

ILG2021 avatar ILG2021 commented on May 25, 2024
@dataclass
class AudioFolderDataset:
    processor: Any

    def _prepare_dataset(self, batch):
        # load and resample audio data from 48 to 16kHz
        audio = batch["audio"]

        # compute log-Mel input features from input audio array
        batch["input_features"] = \
            self.processor.feature_extractor(audio["array"], sampling_rate=audio["sampling_rate"]).input_features[0]

        # encode target text to label ids
        batch["labels"] = self.processor.tokenizer(batch["sentence"]).input_ids
        return batch

    def load(self):
        common_voice = load_dataset("audiofolder", data_dir="dataset")
        common_voice = common_voice.cast_column("audio", Audio(sampling_rate=16000))
        common_voice = common_voice.map(self._prepare_dataset, num_proc=1)
        return common_voice['train'], common_voice['test']

train_dataset, test_dataset = AudioFolderDataset(processor=processor).load()

使用上面的dataset出现的

from whisper-finetune.

ILG2021 avatar ILG2021 commented on May 25, 2024

如果把per_device_train_batch_size设置为80,上面没错误提示了。但是会有另外的错误:

File "/opt/conda/lib/python3.10/site-packages/transformers/models/whisper/modeling_whisper.py", line 1486, in forward
   outputs = self.model(
 File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
   return forward_call(*args, **kwargs)
 File "/opt/conda/lib/python3.10/site-packages/transformers/models/whisper/modeling_whisper.py", line 1346, in forward
   encoder_outputs = self.encoder(
 File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
   return forward_call(*args, **kwargs)
 File "/opt/conda/lib/python3.10/site-packages/transformers/models/whisper/modeling_whisper.py", line 899, in forward
   inputs_embeds = inputs_embeds.permute(0, 2, 1)
RuntimeError: permute(sparse_coo): number of dimensions in the tensor input does not match the length of the desired ordering of dimensions i.e. input.dim() = 2 is not equal to len(dims) = 3

from whisper-finetune.

yeyupiaoling avatar yeyupiaoling commented on May 25, 2024

from whisper-finetune.

ILG2021 avatar ILG2021 commented on May 25, 2024

数据集是标准的方法,一直使用在全参数下微调。另外按照如下lora方法微调也是可以的:
https://github.com/Vaibhavs10/fast-whisper-finetuning

from whisper-finetune.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.