| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: RankFullLocalShuffleBatchSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 32 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: RankFullLocalShuffleBatchSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 32 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: RankFullLocalShuffleBatchSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 32 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: RankFullLocalShuffleBatchSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 32 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: RankFullLocalShuffleBatchSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 32 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioLLMDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: RankFullLocalShuffleBatchSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 8 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | def main(**kwargs): |
| | | print(kwargs) |
| | | # set random seed |
| | | tables.print() |
| | | # tables.print() |
| | | set_all_random_seed(kwargs.get("seed", 0)) |
| | | torch.backends.cudnn.enabled = kwargs.get("cudnn_enabled", torch.backends.cudnn.enabled) |
| | | torch.backends.cudnn.benchmark = kwargs.get("cudnn_benchmark", torch.backends.cudnn.benchmark) |
| | |
| | | dataset_train = dataset_class(kwargs.get("train_data_set_list"), frontend=frontend, tokenizer=None, is_training=False, **kwargs.get("dataset_conf")) |
| | | |
| | | # dataloader |
| | | batch_sampler = kwargs["dataset_conf"].get("batch_sampler", "DynamicBatchLocalShuffleSampler") |
| | | batch_sampler_train = None |
| | | if batch_sampler is not None: |
| | | batch_sampler_class = tables.batch_sampler_classes.get(batch_sampler) |
| | | dataset_conf = kwargs.get("dataset_conf") |
| | | dataset_conf["batch_type"] = "example" |
| | | dataset_conf["batch_size"] = 1 |
| | | batch_sampler_train = batch_sampler_class(dataset_train, is_training=False, **dataset_conf) |
| | | batch_sampler = kwargs["dataset_conf"].get("batch_sampler", "BatchSampler") |
| | | batch_sampler_class = tables.batch_sampler_classes.get(batch_sampler) |
| | | dataset_conf = kwargs.get("dataset_conf") |
| | | dataset_conf["batch_type"] = "example" |
| | | dataset_conf["batch_size"] = 1 |
| | | batch_sampler_train = batch_sampler_class(dataset_train, is_training=False, **dataset_conf) |
| | | |
| | | |
| | | dataloader_train = torch.utils.data.DataLoader(dataset_train, |
| | | collate_fn=dataset_train.collator, |
| | | batch_sampler=batch_sampler_train, |
| | | num_workers=int(kwargs.get("dataset_conf").get("num_workers", 4)), |
| | | pin_memory=True) |
| | | dataloader_train = torch.utils.data.DataLoader(dataset_train, collate_fn=dataset_train.collator, **batch_sampler_train) |
| | | |
| | | iter_stop = int(kwargs.get("scale", 1.0)*len(dataloader_train)) |
| | | |
| | |
| | | |
| | | # dataset |
| | | logging.info("Build dataloader") |
| | | dataloader_class = tables.dataloader_classes.get( kwargs["dataset_conf"].get("dataloader", "DataloaderMapStyle")) |
| | | dataloader_class = tables.dataloader_classes.get(kwargs["dataset_conf"].get("dataloader", "DataloaderMapStyle")) |
| | | dataloader_tr, dataloader_val = dataloader_class(**kwargs) |
| | | |
| | | trainer = Trainer(local_rank=local_rank, |
| | |
| | | def main_hydra(cfg: DictConfig): |
| | | |
| | | kwargs = OmegaConf.to_container(cfg, resolve=True) |
| | | print(kwargs) |
| | | |
| | | scp_file_list = kwargs.get("scp_file_list", ("/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt")) |
| | | if isinstance(scp_file_list, str): |
| | |
| | | def main_hydra(cfg: DictConfig): |
| | | |
| | | kwargs = OmegaConf.to_container(cfg, resolve=True) |
| | | print(kwargs) |
| | | |
| | | scp_file_list = kwargs.get("scp_file_list", ("/Users/zhifu/funasr1.0/test_local/wav.scp", "/Users/zhifu/funasr1.0/test_local/text.txt")) |
| | | if isinstance(scp_file_list, str): |
| | |
| | | dataset_val = dataset_class(kwargs.get("valid_data_set_list"), frontend=frontend, tokenizer=tokenizer, is_training=False, **kwargs.get("dataset_conf")) |
| | | |
| | | # dataloader |
| | | batch_sampler = kwargs["dataset_conf"].get("batch_sampler", "DynamicBatchLocalShuffleSampler") |
| | | batch_sampler = kwargs["dataset_conf"].get("batch_sampler", "BatchSampler") |
| | | batch_sampler_val = None |
| | | if batch_sampler is not None: |
| | | batch_sampler_class = tables.batch_sampler_classes.get(batch_sampler) |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |
| | |
| | | dataset: AudioDataset |
| | | dataset_conf: |
| | | index_ds: IndexDSJsonl |
| | | batch_sampler: DynamicBatchLocalShuffleSampler |
| | | batch_sampler: BatchSampler |
| | | batch_type: example # example or length |
| | | batch_size: 1 # if batch_type is example, batch_size is the numbers of samples; if length, batch_size is source_token_len+target_token_len; |
| | | max_token_length: 2048 # filter samples if source_token_len+target_token_len > max_token_length, |