Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x “错误”;以下参数是必需的--路径数据集目录=_Python 3.x_Magenta - Fatal编程技术网

Python 3.x “错误”;以下参数是必需的--路径数据集目录=

Python 3.x “错误”;以下参数是必需的--路径数据集目录=,python-3.x,magenta,Python 3.x,Magenta,我试图用提取的数据集的根文件夹替换PATH_数据集,该数据集是C/Users/swarn/hands-on-music generation with-magenta/lmd_-full/a。但它将错误显示为: 第06章示例:错误:需要以下参数:--path\u dataset\u dir=C/Users/swarn/hands-on-music generation with洋红/lmd\u full/a,-path\u output\u dir/C/Users/swarn/hands-on-

我试图用提取的数据集的根文件夹替换PATH_数据集,该数据集是C/Users/swarn/hands-on-music generation with-magenta/lmd_-full/a。但它将错误显示为:

第06章示例:错误:需要以下参数:--path\u dataset\u dir=C/Users/swarn/hands-on-music generation with洋红/lmd\u full/a,-path\u output\u dir/C/Users/swarn/hands-on-on-music generation with洋红,-低音鼓\u-on-beat\u threshold=0.75 发生异常,请使用%tb查看完整回溯

关于输入数据根文件夹位置,我是否做错了什么

我的github部分代码:

enter code here
    
parser = argparse.ArgumentParser()
parser.add_argument("--sample_size", type=int, default=1000)
parser.add_argument("--pool_size", type=int, default=4)
parser.add_argument("--path_dataset_dir = C/Users/swarn/ hands-on-music-generation-with-magenta/lmd_full/a", type=str, required=True)
parser.add_argument("--path_output_dir /C/Users/swarn/hands-on-music-generation-with-magenta", type=str, required=True)
parser.add_argument("--bass_drums_on_beat_threshold = 0.75",
                    type=float, required=True, default=0)
args = parser.parse_args()

# The list of all MIDI paths on disk (we might process only a sample)
MIDI_PATHS = glob.glob(os.path.join(args.path_dataset_dir, "**", "*.mid"),
                       recursive=True)




def process(midi_path: str, counter: AtomicCounter) -> Optional[dict]:
 
  try:
    pm_drums = extract_drums(midi_path)
    bass_drums_on_beat = get_bass_drums_on_beat(pm_drums)
    if bass_drums_on_beat >= args.bass_drums_on_beat_threshold:
      midi_filename = os.path.basename(midi_path)
      pm_drums.write(os.path.join(args.path_output_dir, f"{midi_filename}.mid"))
    else:
      raise Exception(f"Not on beat {midi_path}: {bass_drums_on_beat}")
    return {"midi_path": midi_path,
            "pm_drums": pm_drums,
            "bass_drums_on_beat": bass_drums_on_beat}
  except Exception as e:
    if "Not on beat" not in str(e):
      print(f"Exception during processing of {midi_path}: {e}")
  finally:
    counter.increment()


def app(midi_paths: List[str]):
  start = timeit.default_timer()




if __name__ == "__main__":
  if args.sample_size:
    # Process a sample of it
    MIDI_PATHS_SAMPLE = random.sample(list(MIDI_PATHS), args.sample_size)
  else:
    # Process all the dataset
    MIDI_PATHS_SAMPLE = list(MIDI_PATHS)
  app(MIDI_PATHS_SAMPLE)
enter code here