-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
150 lines (132 loc) · 6.26 KB
/
Copy pathmain.py
File metadata and controls
150 lines (132 loc) · 6.26 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
"""main.py ensures that the dependencies for all scripts are
installed, and allows you to start automatically if need be.
This file should be run before the aforementioned, and updated
whenever the dependencies change.
"""
import os
import sys
print('Installing dependencies...')
os.system('python3 -m pip install -r requirements.txt')
print('Dependencies installed.')
print()
print('Welcome to The Phonetic Song Project.')
print('If you encounter any bugs, feel free to report them at '
'https://github.com/adlez27/phonetic-songs')
print()
print('What would you like to do?')
print('1. Fetch Lyrics')
print('2. Convert Lyrics')
print('3. Fetch Billboard Charts')
print('4. Train Model')
print('5. Sample Output from Model')
print('Type "q" to exit.')
forward = input(': ')
while forward != 'q':
if forward == '1':
os.system('python3 fetcher.py')
if forward == '2':
os.system('python3 converter.py')
if forward == '3':
os.system('python3 charts.py')
if forward == '4' or '5':
try:
import torch
import torchvision
except ImportError:
print('torch and torchvision are required for training '
'and sampling models.')
print('Are you going to be training and sampling models?')
torch_choice = input('y/n: ')
print()
while not torch_choice in ['y', 'n']:
print('Please specify.')
torch_choice = input('y/n: ')
if torch_choice == 'n':
print()
continue
print()
if torch_choice == 'y':
print('Please specify the operating system you\'re using')
print('1. Linux')
print('2. MacOS')
print('3. Windows')
os_choice = input(': ')
print()
# Linux
if os_choice == '1':
print('Please specify if you want the CPU PyTorch '
'or GPU (NVIDIA - CUDA) PyTorch.')
print('The GPU version allows you to do CPU training as well.')
print('a. PyTorch CPU')
print('b. PyTorch GPU (CUDA)')
torch_ver = input(': ')
print()
if torch_ver == 'a':
print('This would download torch and torchvision wheels '
'and install them automatically.')
print('This may take a while depending on your internet '
'connection.')
os.system(
'python3 -m pip install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-linux_x86_64.whl')
os.system(
'python3 -m pip install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-linux_x86_64.whl')
if torch_ver == 'b':
print('This would download torch and torchvision wheels '
'and install them automatically.')
print('This may take a while depending on your internet '
'connection.')
os.system(
'python3 -m pip install https://download.pytorch.org/whl/cu90/torch-1.1.0-cp37-cp37m-linux_x86_64.whl')
os.system(
'python3 -m pip install https://download.pytorch.org/whl/cu90/torchvision-0.3.0-cp37-cp37m-manylinux1_x86_64.whl')
# MacOS
if os_choice == '2':
print('MacOS binaries don\'t support CUDA, install from '
'source if CUDA is needed.')
print('This would download the CPU binaries for torch and '
'torchvision and install them automatically.')
print('This may take a while depending on your internet '
'connection.')
os.system(
'python3 -m pip install torch==1.1.0 torchvision==0.3.0')
# Windows
if os_choice == '3':
print('Please specify if you want the CPU PyTorch '
'or GPU (NVIDIA - CUDA) PyTorch.')
print('The GPU version allows you to do CPU training as well.')
print('a. PyTorch CPU')
print('b. PyTorch GPU (CUDA)')
torch_ver = input(': ')
if torch_ver == 'a':
print('This would download torch and torchvision wheels '
'and install them automatically.')
print('This may take a while depending on your internet '
'connection.')
os.system(
'python3 -m pip install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-win_amd64.whl')
os.system(
'python3 -m pip install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-win_amd64.whl')
if torch_ver == 'b':
print('This would download torch and torchvision wheels '
'and install them automatically.')
print('This may take a while depending on your internet '
'connection.')
os.system(
'python3 -m pip install https://download.pytorch.org/whl/cu90/torch-1.1.0-cp37-cp37m-win_amd64.whl')
os.system(
'python3 -m pip install https://download.pytorch.org/whl/cu90/torchvision-0.3.0-cp37-cp37m-win_amd64.whl')
if forward == '4':
os.system('python3 trainer.py')
if forward == '5':
os.system('python3 sampler.py')
print()
print('Would you like to continue?')
print('1. Fetch Lyrics')
print('2. Convert Lyrics')
print('3. Fetch Billboard Charts')
print('4. Train Model')
print('5. Sample Output from Model')
print('Type "q" to exit.')
forward = input(': ')
print('Have a good day!')
sys.exit()