RASMUS/Finnish-ASR-Canary-v2
02.2k
1# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14 15from multiprocessing import set_start_method16 17from nemo.collections.asr.data.data_simulation import MultiSpeakerSimulator, RIRMultiSpeakerSimulator18from nemo.core.config import hydra_runner19 20 21"""22This script creates a synthetic diarization session using the provided audio dataset with ctm files.23Usage:24 python <NEMO_ROOT>/tools/speech_data_simulator/multispeaker_simulator.py \25 num_workers=10 \26 data_simulator.random_seed=42 \27 data_simulator.manifest_filepath=manifest_with_alignment_file.json \28 data_simulator.outputs.output_dir=./simulated_data \29 data_simulator.outputs.output_filename=sim_spk2_sess20 \30 data_simulator.session_config.num_sessions=1000 \31 data_simulator.session_config.num_speakers=2 \32 data_simulator.session_config.session_length=20 \33 data_simulator.background_noise.add_bg=False \34 data_simulator.background_noise.background_manifest=background_noise.json \35 data_simulator.background_noise.snr=40 \36 37Check out parameters in ./conf/data_simulator.yaml.38"""39 40 41@hydra_runner(config_path="conf", config_name="data_simulator.yaml")42def main(cfg):43 if cfg.data_simulator.rir_generation.use_rir:44 simulator = RIRMultiSpeakerSimulator(cfg=cfg)45 else:46 simulator = MultiSpeakerSimulator(cfg=cfg)47 48 set_start_method('spawn', force=True)49 simulator.generate_sessions()50 51 52if __name__ == "__main__":53 main()54 