Spaces:
Sleeping
Sleeping
Added caching in docker and dmb type changed
Browse files- Dockerfile +15 -10
- app.py +6 -2
Dockerfile
CHANGED
@@ -12,28 +12,33 @@ RUN pip install --trusted-host pypi.python.org -r requirements.txt && \
|
|
12 |
pip uninstall transformers && \
|
13 |
pip install transformers==4.29.2
|
14 |
|
|
|
|
|
15 |
# Make port 80 available to the world outside this container
|
16 |
EXPOSE 80
|
17 |
|
18 |
# Set the TORTOISE_MODELS_DIR environment variable
|
19 |
ENV TORTOISE_MODELS_DIR tortoise/models/pretrained_models
|
20 |
|
|
|
|
|
|
|
21 |
# Create the directory for pretrained models
|
22 |
# RUN mkdir -p $TORTOISE_MODELS_DIR
|
23 |
|
24 |
RUN echo "Downloading models through docker container..."
|
25 |
|
26 |
# Download all the models
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
RUN echo "Finished downloading models through docker container..."
|
39 |
|
|
|
12 |
pip uninstall transformers && \
|
13 |
pip install transformers==4.29.2
|
14 |
|
15 |
+
RUN --mount=type=cache,target=/home/user/.cache/
|
16 |
+
|
17 |
# Make port 80 available to the world outside this container
|
18 |
EXPOSE 80
|
19 |
|
20 |
# Set the TORTOISE_MODELS_DIR environment variable
|
21 |
ENV TORTOISE_MODELS_DIR tortoise/models/pretrained_models
|
22 |
|
23 |
+
ENV DBM_TYPE=dbm.ndbm
|
24 |
+
|
25 |
+
|
26 |
# Create the directory for pretrained models
|
27 |
# RUN mkdir -p $TORTOISE_MODELS_DIR
|
28 |
|
29 |
RUN echo "Downloading models through docker container..."
|
30 |
|
31 |
# Download all the models
|
32 |
+
RUN wget -O $TORTOISE_MODELS_DIR/autoregressive.pth https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/autoregressive.pth && \
|
33 |
+
wget -O $TORTOISE_MODELS_DIR/classifier.pth https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/classifier.pth && \
|
34 |
+
wget -O $TORTOISE_MODELS_DIR/clvp2.pth https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/clvp2.pth && \
|
35 |
+
wget -O $TORTOISE_MODELS_DIR/cvvp.pth https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/cvvp.pth && \
|
36 |
+
wget -O $TORTOISE_MODELS_DIR/diffusion_decoder.pth https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/diffusion_decoder.pth && \
|
37 |
+
wget -O $TORTOISE_MODELS_DIR/vocoder.pth https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/vocoder.pth && \
|
38 |
+
wget -O $TORTOISE_MODELS_DIR/rlg_auto.pth https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/rlg_auto.pth && \
|
39 |
+
wget -O $TORTOISE_MODELS_DIR/rlg_diffuser.pth https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/rlg_diffuser.pth && \
|
40 |
+
wget -O $TORTOISE_MODELS_DIR/bigvgan_base_24khz_100band_g.pth https://drive.google.com/uc?id=1_cKskUDuvxQJUEBwdgjAxKuDTUW6kPdY && \
|
41 |
+
wget -O $TORTOISE_MODELS_DIR/bigvgan_24khz_100band_g.pth https://drive.google.com/uc?id=1wmP_mAs7d00KHVfVEl8B5Gb72Kzpcavp
|
42 |
|
43 |
RUN echo "Finished downloading models through docker container..."
|
44 |
|
app.py
CHANGED
@@ -33,7 +33,7 @@ LATENT_MODES = [
|
|
33 |
|
34 |
def main():
|
35 |
conf = TortoiseConfig()
|
36 |
-
|
37 |
with st.expander("Create New Voice", expanded=True):
|
38 |
if "file_uploader_key" not in st.session_state:
|
39 |
st.session_state["file_uploader_key"] = str(randint(1000, 100000000))
|
@@ -71,7 +71,11 @@ def main():
|
|
71 |
bytes_data = uploaded_file.read()
|
72 |
with open(f"{voices_dir}voice_sample{index}.wav", "wb") as wav_file:
|
73 |
wav_file.write(bytes_data)
|
74 |
-
|
|
|
|
|
|
|
|
|
75 |
st.session_state["text_input_key"] = str(randint(1000, 100000000))
|
76 |
st.session_state["file_uploader_key"] = str(randint(1000, 100000000))
|
77 |
st.experimental_rerun()
|
|
|
33 |
|
34 |
def main():
|
35 |
conf = TortoiseConfig()
|
36 |
+
voice_samples, conditioning_latents = None, None
|
37 |
with st.expander("Create New Voice", expanded=True):
|
38 |
if "file_uploader_key" not in st.session_state:
|
39 |
st.session_state["file_uploader_key"] = str(randint(1000, 100000000))
|
|
|
71 |
bytes_data = uploaded_file.read()
|
72 |
with open(f"{voices_dir}voice_sample{index}.wav", "wb") as wav_file:
|
73 |
wav_file.write(bytes_data)
|
74 |
+
|
75 |
+
#create conditioning latents and save them
|
76 |
+
voice_samples, conditioning_latents = get_condi(
|
77 |
+
[new_voice_name], []
|
78 |
+
)
|
79 |
st.session_state["text_input_key"] = str(randint(1000, 100000000))
|
80 |
st.session_state["file_uploader_key"] = str(randint(1000, 100000000))
|
81 |
st.experimental_rerun()
|