File size: 1,848 Bytes
2e1dc7f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from pathlib import Path
import os
from typing import Optional
import os

ENTITY: str = ""
PROJECT: str = ""

ROOT = Path(__file__).parent
LOCAL_WEIGHTS_DIR: Path = ROOT / "weights"
LOCAL_CKP_DIR: Path = ROOT / "checkpoints"
AUDIO_DIR: Path = ROOT / "audio"
EVAL_DIR: Path = ROOT / "eval"
EXP_DIR: Path = ROOT / "experiments"
CKP_DIR = LOCAL_CKP_DIR


class ConfigurationError(ValueError):
    ...


def first_existing(*paths: Path | str) -> Optional[Path]:
    for path in paths:
        if Path(path).exists():
            return Path(path)


def moises_path() -> Path:
    path = first_existing(Path.home() / "dev/dataset/moisesdb/moisesdb_v0.1",
                          Path.home() / "dev/datasets/moisesdb/moisesdb_v0.1",
                          Path.home() / "lag-data/lag-moisesdb",
                          ROOT / "datasets/moisesdb")
    if path is None:
        raise RuntimeError("I can't find moisesdb")
    return path


def mus_path() -> Path:
    path = first_existing(
        Path.home() / "dev/dataset/moisesdb/musdb",
        Path.home() / "datasets/moisesdb/musdb",
        Path.home() / "lag-data/musdb",
        ROOT / "datasets/musdb",
    )
    if path is None:
        raise RuntimeError("I can't find musdb")
    return path


def mixdata_path() -> Path:
    path = first_existing(
        Path.home() / "dev/datasets/moisesdb",
        Path.home() / "datasets/moisesdb",
        Path.home() / "lag-data",
        Path.home() / "datasets/lag-data",
    )
    if path is None:
        raise RuntimeError("I can't find the mixed dataset path")
    return path


def weights_dir() -> Path:
    return LOCAL_WEIGHTS_DIR


def output_dir() -> Path:
    return CKP_DIR


def shutdown():
    print(f"Shutting down myself 💀")
    os.system("sudo shutdown now")


import torch

torch.set_float32_matmul_precision("medium")