Spaces:
Runtime error
Runtime error
add slide show for multiple images
Browse files- app.py +113 -13
- lib/audio_generation.py +7 -11
- lib/image_captioning.py +2 -1
- notebooks/AudioPalette.ipynb +369 -1
app.py
CHANGED
@@ -5,6 +5,8 @@ import numpy as np
|
|
5 |
import gradio as gr
|
6 |
|
7 |
import PIL
|
|
|
|
|
8 |
|
9 |
from lib.audio_generation import AudioGeneration
|
10 |
from lib.image_captioning import ImageCaptioning
|
@@ -25,35 +27,79 @@ class AudioPalette:
|
|
25 |
"Slow": "low"
|
26 |
}
|
27 |
|
28 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
pace = self.pace_model.predict(input_image)
|
30 |
print("Pace Prediction Done")
|
31 |
|
32 |
generated_text = self.image_captioning.query(input_image)[0].get("generated_text")
|
33 |
print("Captioning Done")
|
34 |
-
|
35 |
generated_text = generated_text if generated_text is not None else ""
|
36 |
-
# prompt = f"Generate a soundtrack for {generated_text} with {pace} beats and the instrument of choice is the guitar, High quality"
|
37 |
|
38 |
-
|
39 |
-
prompt = f"A soundtrack for {generated_text} with {self.pace_map[pace]} beats per minute. High quality."
|
40 |
-
else:
|
41 |
-
prompt = f"A {instrument} soundtrack for {generated_text} with {self.pace_map[pace]} beats per minute. High quality."
|
42 |
-
|
43 |
print("Generated Prompt:", prompt)
|
44 |
|
45 |
audio_file = self.audio_generation.generate(prompt, ngrok_endpoint)
|
46 |
print("Audio Generation Done")
|
47 |
|
48 |
outputs = [prompt, pace, generated_text, audio_file]
|
49 |
-
|
50 |
return outputs
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
|
|
55 |
demo = gr.Interface(
|
56 |
-
fn=model.
|
57 |
inputs=[
|
58 |
gr.Image(
|
59 |
type="pil",
|
@@ -117,10 +163,64 @@ def main():
|
|
117 |
],
|
118 |
cache_examples=False,
|
119 |
live=False,
|
120 |
-
title="Audio Palette",
|
121 |
description="Provide an image to generate an appropriate background soundtrack",
|
122 |
)
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
demo.queue().launch()
|
125 |
|
126 |
if __name__ == "__main__":
|
|
|
5 |
import gradio as gr
|
6 |
|
7 |
import PIL
|
8 |
+
from PIL import Image
|
9 |
+
from moviepy.editor import *
|
10 |
|
11 |
from lib.audio_generation import AudioGeneration
|
12 |
from lib.image_captioning import ImageCaptioning
|
|
|
27 |
"Slow": "low"
|
28 |
}
|
29 |
|
30 |
+
def prompt_construction(self, caption: str, pace: str, instrument: typing.Union[str, None], first: bool = True):
|
31 |
+
instrument = instrument if instrument is not None else ""
|
32 |
+
|
33 |
+
if first:
|
34 |
+
prompt = f"A {instrument} soundtrack for {caption} with {self.pace_map[pace]} beats per minute. High Quality"
|
35 |
+
else:
|
36 |
+
prompt = f"A {instrument} soundtrack for {caption} with {self.pace_map[pace]} beats per minute. High Quality. Transitions smoothely from the previous audio while sounding different."
|
37 |
+
|
38 |
+
return prompt
|
39 |
+
|
40 |
+
def generate_single(self, input_image: PIL.Image.Image, instrument: typing.Union[str, None], ngrok_endpoint: str):
|
41 |
pace = self.pace_model.predict(input_image)
|
42 |
print("Pace Prediction Done")
|
43 |
|
44 |
generated_text = self.image_captioning.query(input_image)[0].get("generated_text")
|
45 |
print("Captioning Done")
|
|
|
46 |
generated_text = generated_text if generated_text is not None else ""
|
|
|
47 |
|
48 |
+
prompt = self.prompt_construction(generated_text, pace, instrument)
|
|
|
|
|
|
|
|
|
49 |
print("Generated Prompt:", prompt)
|
50 |
|
51 |
audio_file = self.audio_generation.generate(prompt, ngrok_endpoint)
|
52 |
print("Audio Generation Done")
|
53 |
|
54 |
outputs = [prompt, pace, generated_text, audio_file]
|
|
|
55 |
return outputs
|
56 |
+
|
57 |
+
def stitch_images(self, file_paths: typing.List[str], audio_paths: typing.List[str]):
|
58 |
+
clips = [ImageClip(m).set_duration(5) for m in file_paths]
|
59 |
+
audio_clips = [AudioFileClip(a) for a in audio_paths]
|
60 |
+
concat_audio = concatenate_audioclips(audio_clips)
|
61 |
+
new_audio = CompositeAudioClip([concat_audio])
|
62 |
|
63 |
+
concat_clip = concatenate_videoclips(clips, method="compose")
|
64 |
+
concat_clip.audio = new_audio
|
65 |
+
|
66 |
+
file_name = "generated_video.mp4"
|
67 |
+
concat_clip.write_videofile(file_name, fps=24)
|
68 |
+
return file_name
|
69 |
+
|
70 |
+
def generate_multiple(self, file_paths: typing.List[str], instrument: typing.Union[str, None], ngrok_endpoint: str):
|
71 |
+
images = [Image.open(image_path) for image_path in file_paths]
|
72 |
+
pace = []
|
73 |
+
generated_text = []
|
74 |
+
prompts = []
|
75 |
+
|
76 |
+
# Extracting the pace for all the images
|
77 |
+
for image in images:
|
78 |
+
pace_prediction = self.pace_model.predict(image)
|
79 |
+
pace.append(pace_prediction)
|
80 |
+
print("Pace Prediction Done")
|
81 |
+
|
82 |
+
# Generating the caption for all the images
|
83 |
+
for image in images:
|
84 |
+
caption = self.image_captioning.query(image)[0].get("generated_text")
|
85 |
+
generated_text.append(caption)
|
86 |
+
print("Captioning Done")
|
87 |
+
|
88 |
+
first = True
|
89 |
+
for generated_caption, pace_pred in zip(generated_text, pace):
|
90 |
+
prompts.append(self.prompt_construction(generated_caption, pace_pred, instrument, first))
|
91 |
+
first = False
|
92 |
+
print("Generated Prompts: ", prompts)
|
93 |
+
|
94 |
+
audio_file = self.audio_generation.generate(prompts, ngrok_endpoint)
|
95 |
+
print("Audio Generation Done")
|
96 |
+
|
97 |
+
video_file = self.stitch_images(file_paths, [audio_file])
|
98 |
+
return video_file
|
99 |
|
100 |
+
def single_image_interface(model: AudioPalette):
|
101 |
demo = gr.Interface(
|
102 |
+
fn=model.generate_single,
|
103 |
inputs=[
|
104 |
gr.Image(
|
105 |
type="pil",
|
|
|
163 |
],
|
164 |
cache_examples=False,
|
165 |
live=False,
|
|
|
166 |
description="Provide an image to generate an appropriate background soundtrack",
|
167 |
)
|
168 |
|
169 |
+
return demo
|
170 |
+
|
171 |
+
def multi_image_interface(model: AudioPalette):
|
172 |
+
demo = gr.Interface(
|
173 |
+
fn=model.generate_multiple,
|
174 |
+
inputs=[
|
175 |
+
gr.File(
|
176 |
+
file_count="multiple",
|
177 |
+
file_types=["image"],
|
178 |
+
type="filepath",
|
179 |
+
label="Upload images",
|
180 |
+
show_label=True,
|
181 |
+
container=True,
|
182 |
+
visible=True
|
183 |
+
),
|
184 |
+
gr.Radio(
|
185 |
+
choices=["Piano", "Drums", "Guitar", "Violin", "Flute"],
|
186 |
+
label="Instrument",
|
187 |
+
show_label=True,
|
188 |
+
container=True
|
189 |
+
),
|
190 |
+
gr.Textbox(
|
191 |
+
lines=1,
|
192 |
+
placeholder="ngrok endpoint",
|
193 |
+
label="colab endpoint",
|
194 |
+
show_label=True,
|
195 |
+
container=True,
|
196 |
+
type="text",
|
197 |
+
visible=True
|
198 |
+
)
|
199 |
+
],
|
200 |
+
outputs=[
|
201 |
+
gr.Video(
|
202 |
+
format="mp4",
|
203 |
+
label="Generated Video",
|
204 |
+
show_label=True,
|
205 |
+
container=True,
|
206 |
+
visible=True,
|
207 |
+
autoplay=False,
|
208 |
+
)
|
209 |
+
],
|
210 |
+
cache_examples=False,
|
211 |
+
live=False,
|
212 |
+
description="Provide images to generate an a slideshow of the images with appropriate music as background",
|
213 |
+
)
|
214 |
+
|
215 |
+
return demo
|
216 |
+
|
217 |
+
def main():
|
218 |
+
model = AudioPalette()
|
219 |
+
|
220 |
+
tab_1 = single_image_interface(model)
|
221 |
+
tab_2 = multi_image_interface(model)
|
222 |
+
|
223 |
+
demo = gr.TabbedInterface([tab_1, tab_2], ["Single Image", "Slide Show"], "Audio Palette")
|
224 |
demo.queue().launch()
|
225 |
|
226 |
if __name__ == "__main__":
|
lib/audio_generation.py
CHANGED
@@ -8,17 +8,14 @@ class AudioGeneration:
|
|
8 |
def __init__(self):
|
9 |
self.session = requests.session()
|
10 |
|
11 |
-
def
|
12 |
-
response = self.session.post(self.endpoint + "
|
13 |
"caption": prompt
|
14 |
})
|
15 |
|
16 |
file_path = response.json().get("file_path")
|
17 |
return file_path
|
18 |
|
19 |
-
def request_multiple(self, prompt: typing.List[str]):
|
20 |
-
pass
|
21 |
-
|
22 |
def request_download(self, file_path: str):
|
23 |
response = self.session.post(self.endpoint + "download", json={
|
24 |
"file_path": file_path
|
@@ -33,9 +30,8 @@ class AudioGeneration:
|
|
33 |
|
34 |
def generate(self, prompt: typing.Union[str, typing.List[str]], endpoint: str):
|
35 |
self.endpoint = endpoint
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
return audio_file
|
|
|
8 |
def __init__(self):
|
9 |
self.session = requests.session()
|
10 |
|
11 |
+
def request_generation(self, prompt: typing.Union[str, typing.List[str]]):
|
12 |
+
response = self.session.post(self.endpoint + "generate", json={
|
13 |
"caption": prompt
|
14 |
})
|
15 |
|
16 |
file_path = response.json().get("file_path")
|
17 |
return file_path
|
18 |
|
|
|
|
|
|
|
19 |
def request_download(self, file_path: str):
|
20 |
response = self.session.post(self.endpoint + "download", json={
|
21 |
"file_path": file_path
|
|
|
30 |
|
31 |
def generate(self, prompt: typing.Union[str, typing.List[str]], endpoint: str):
|
32 |
self.endpoint = endpoint
|
33 |
+
stored_file_path = self.request_generation(prompt)
|
34 |
+
|
35 |
+
audio_file = self.request_download(stored_file_path)
|
36 |
+
print(audio_file)
|
37 |
+
return audio_file
|
|
lib/image_captioning.py
CHANGED
@@ -13,6 +13,7 @@ class ImageCaptioning:
|
|
13 |
self.api_endpoint = os.environ["blip_api_url"]
|
14 |
self.org_token = os.environ["auth_token"]
|
15 |
self.headers = { "Authorization": f"Bearer {self.org_token}" }
|
|
|
16 |
|
17 |
def convert_to_bytes(self, image: PIL.Image.Image):
|
18 |
data = io.BytesIO()
|
@@ -20,7 +21,7 @@ class ImageCaptioning:
|
|
20 |
return data.getvalue()
|
21 |
|
22 |
def query(self, image: PIL.Image.Image):
|
23 |
-
response =
|
24 |
self.api_endpoint,
|
25 |
headers=self.headers,
|
26 |
data=self.convert_to_bytes(image)
|
|
|
13 |
self.api_endpoint = os.environ["blip_api_url"]
|
14 |
self.org_token = os.environ["auth_token"]
|
15 |
self.headers = { "Authorization": f"Bearer {self.org_token}" }
|
16 |
+
self.session = requests.session()
|
17 |
|
18 |
def convert_to_bytes(self, image: PIL.Image.Image):
|
19 |
data = io.BytesIO()
|
|
|
21 |
return data.getvalue()
|
22 |
|
23 |
def query(self, image: PIL.Image.Image):
|
24 |
+
response = self.session.post(
|
25 |
self.api_endpoint,
|
26 |
headers=self.headers,
|
27 |
data=self.convert_to_bytes(image)
|
notebooks/AudioPalette.ipynb
CHANGED
@@ -1 +1,369 @@
|
|
1 |
-
{"cells":[{"cell_type":"markdown","metadata":{"id":"w4LtdMb23tZ4"},"source":["## Prerequisites"]},{"cell_type":"markdown","metadata":{"id":"JgJLBIh3fm-W"},"source":["### Install Dependencies"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":11,"status":"ok","timestamp":1701192586082,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"EodUpreufqD-","outputId":"35816992-683c-486b-c174-8f4ab5b30e0b"},"outputs":[],"source":["!nvidia-smi"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":55044,"status":"ok","timestamp":1701192641119,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"bOn11huvfuXc","outputId":"c6f34e65-6253-4942-a779-a74ce6357aab"},"outputs":[],"source":["!pip install --upgrade --quiet pip\n","!pip install --quiet git+https://github.com/huggingface/transformers.git"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":69977,"status":"ok","timestamp":1701192711087,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"Nl0CQxwHCrFd","outputId":"a8c56186-23d3-4531-ff6a-11d6f61126b7"},"outputs":[],"source":["!pip install typing-extensions==4.5.0\n","!pip install python-multipart\n","!pip install kaleido\n","!pip install notebook>=6.5.5\n","!pip install click>=8.0\n","!pip install fastapi\n","!pip install \"uvicorn[standard]\"\n","!pip install pyngrok"]},{"cell_type":"markdown","metadata":{"id":"ROxnljVbf6_o"},"source":["### Load the models"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":0,"referenced_widgets":["d4f059066f534812aca7e55fe6ba37e0","1b1fb646414f463a941e757091c424cd","79e2820e80f4485e9b0a5117c1b46ede","605f44b988aa4f0895befca0d3b3fb44","b341f1596ac04560b3b2622261b9d94d","a034a4e24e8448889cbc5299e736c21a","147b03786e5f475b804ffa0e4b3126f3","6dbce370c76643369b7bdd438055bbbc","b2f87a2a117e400da584b23e6bacd500","5b3123bd83fa4c618faf8c131de662ab","ec39db95dd1046839acc37bdb914897c","dd15ac5529c44fabb55b0b3a87f16775","83aea96092f94262b6023ca8f7fcd6ca","9b0fa2f21bf544529302e47b5051d277","f6bfec4da9ea48c3981ed9421cc5c4b1","75d31df6137146ba820e60a2c16d4411","461aa7211959411ab116bc82fd2165c1","e6a9861c661b47faab1b834ec2aa4c78","7f77fd6745a84a2da02d7d41170d7af1","bac33fb303c04630a8efdf0bfb9790fe","2de4bb7ced1e4e10b51c82df173c987e","bdbc056ec0144e8bb01ab20be4f2706f","69d12e4b48f444c48895818a0828cad4","c50604d9526e400d9356392517a322df","b45c4923d4e449e28261bb4396081154","36ae6a59a3c24c7b8cc01cf5139f7616","a2f296abcc044dbb891813180e99876b","5786b1750d0646d9a6dd4fd56cb8b37c","0743e86fd2144c598a6a523fdb91ced0","dd02cad84ab44023bb44d8c0e17f3eb6","6dbbf1304d934c399dd02138541f7931","011336465e784f298036ea6790fed052","ef8943bc8ff34a0a97b900767614b6c0","8f133aeec44844e0a8f2105ca25537ee","bc115429cdc34c96b6cb4f40bade275e","76503f0db07c43538621c313f229e665","ca9d933e16fa4fccb95378aa79e1ed23","c7558a6ad7bf46209766ba35400f6c71","a81e59481edd4684b65945a5a0e15b7e","de60244a16444f8190c964742c78bcee","106dfc82e3b8458db4d1d79cb9018ce9","bc7379793bcc4a9daacccd8e20fc4939","70fc7a6ff58c4b918dcd402ea47c71ed","256a058561ab454f88011d1ef5067dc3","b2ed07e5aaa843a1b03f91cec6f292c5","9edd2781f80d4ea1b44b3c0d9c6228cb","dca965fb49054b2994504063823d1e45","985f60b8f775420fbf96756681edeaa1","7c13143aaf9e4ea5a981c3e01255db09","067a2fb78e2f4880a7859f3d4443efc7","01d6152aa0a84b5797c0d8d7485ece6b","5e18669c53b34717a7ab136987993f8d","c560c9cadfec4b4d9712061e4f131d9a","5fd1148bd5b147748f308b096110b195","38fd91db4ae74f3ca1fb4c93a61b4e4a","56d1aa41461841f28cf66f4a4a36e4c5","a5a135f9d5c3400bb11e97d8701a0c46","ce2c8f75d3fe4a7ab74ff36f0c933d74","4efae1e9896d49d8924c653b99f88506","425da6ccf8a848edb50b9a9795863651","cf90e11688aa47dd9987e25e15c42ae9","7eb8c7361089468da8ac4ba8b5706e78","ca32f9fcad8c455b95e9be177b5b3c53","35fd990491554b4bb55ff1deb67f6085","9d327383466748548cd8300dc3db05c5","04e7660db17e436f8382a180d7add4d3","36e7a8aa309a4bcf901c8acc185bca8e","06afc51d1e5744df9809e20a9ed593c9","d4b778e99dc243358b8851d87433bb05","b63328001a7d42b1b763b088a022ff0b","0404cdaca76544809f91837630728dba","c9119148bfea46f0b518e0ad0c61cb20","80012bda0de7476fa223598421d046a9","155a5102300f47c894b2a11bcbba0e7d","27284fcd59974e9baa1cd6f42bbd317a","09e27493d427431a9d449289234f9bba","92645005948c4cd98f036838361a0f9e","46fb87d0ea4f4460bed643a196ca41b4","c69ee7b1381f43fbba5c0304d64f23ab","cb8343cd0b8240e49c12bb7f8cf8d41c","3911de4376a2466683f0696fae258e24","d4cd5a793b3c4a1898e28303e5e2f991","0a7f528a0e204b3288755779cc300c56","c0c8ba97b8004a8e8332122ec297022b","69ec4d4dff864a648e8d6c03a2439b11","52f77fbf33354baf9f881f76276b4764","dc6cee3737f74e34b291a3d63d8842ba","d6981569cb5341ff9e9166c5fc0d513f"]},"executionInfo":{"elapsed":43348,"status":"ok","timestamp":1701192754410,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"ToxW1gbLf6tr","outputId":"6bc6b281-0f66-447c-946e-44f6985fff4a"},"outputs":[],"source":["from transformers import MusicgenForConditionalGeneration, MusicgenProcessor, set_seed\n","\n","model = MusicgenForConditionalGeneration.from_pretrained(\"facebook/musicgen-small\")\n","processor = MusicgenProcessor.from_pretrained(\"facebook/musicgen-small\")"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":10922,"status":"ok","timestamp":1701192765308,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"omP9Hg1ajUKM"},"outputs":[],"source":["import torch\n","from IPython.display import Audio\n","\n","sampling_rate = model.config.audio_encoder.sampling_rate\n","device = \"cuda:0\" if torch.cuda.is_available() else \"cpu\"\n","model.to(device)\n","None"]},{"cell_type":"markdown","metadata":{"id":"852jZKSqiKoT"},"source":["## Music Generation functionality"]},{"cell_type":"markdown","metadata":{"id":"8nydshMdxKab"},"source":["#### Model Class"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":615,"status":"ok","timestamp":1701192778417,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"4V49E7xpxNPu"},"outputs":[],"source":["import numpy as np\n","import typing\n","\n","class AudioPalette:\n"," def __init__(self):\n"," pass\n","\n"," def set_prompt(self, caption: str | typing.List[str]):\n"," self.caption = caption\n","\n"," def generate(self):\n"," if isinstance(self.caption, str):\n"," return self.generate_single()\n"," else:\n"," return self.generate_multiple()\n","\n"," def generate_single(self):\n"," inputs = processor(\n"," text=[self.caption],\n"," padding=True,\n"," return_tensors=\"pt\",\n"," sampling_rate=sampling_rate\n"," )\n","\n"," audio_values = model.generate(**inputs.to(device), do_sample=True, guidance_scale=3, max_new_tokens=256)\n"," return audio_values\n","\n"," def generate_multiple(self):\n"," return None"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":507,"status":"ok","timestamp":1701192783021,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"qW65Q68o-R7f"},"outputs":[],"source":["audiopalette = AudioPalette()"]},{"cell_type":"markdown","metadata":{"id":"P3OmxnaBA9E-"},"source":["#### API Creation"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":555,"status":"ok","timestamp":1701195121766,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"Dxlw3ODsTtuB"},"outputs":[],"source":["from fastapi import FastAPI\n","from pydantic import BaseModel, Field\n","from fastapi.middleware.cors import CORSMiddleware\n","\n","app = FastAPI()\n","\n","app.add_middleware(\n"," CORSMiddleware,\n"," allow_origins=['*'],\n"," allow_credentials=True,\n"," allow_methods=['*'],\n"," allow_headers=['*'],\n",")"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":4,"status":"ok","timestamp":1701195124083,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"iYUH3-GpfbN8"},"outputs":[],"source":["import typing\n","import numpy as np\n","\n","class Prompt(BaseModel):\n"," caption: str | typing.List[str]\n","\n","class FileData(BaseModel):\n"," file_path: str\n","\n","# class Melody(BaseModel):\n","# audio: np.ndarray\n","\n","# class Config:\n","# arbitrary_types_allowed = True"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":5,"status":"ok","timestamp":1701195126268,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"PTQCdon0A9FA"},"outputs":[],"source":["import tempfile\n","import scipy\n","\n","from fastapi.responses import FileResponse\n","\n","@app.get('/')\n","async def root():\n"," return {\"message\": \"Hello World\"}\n","\n","@app.post('/download')\n","async def download(file_data: FileData):\n"," file_path = file_data.file_path\n"," return FileResponse(file_path)\n","\n","@app.post('/single')\n","async def single_image(prompt: Prompt):\n"," audiopalette.set_prompt(prompt.caption)\n"," audio = audiopalette.generate()\n","\n"," file_path = None\n"," with tempfile.NamedTemporaryFile(delete=False) as f:\n"," scipy.io.wavfile.write(f, rate=sampling_rate, data=audio[0, 0].cpu().numpy())\n"," file_path = f.name\n","\n"," if not file_path:\n"," return {\"error\": \"There has been an error\"}\n"," return {\"file_path\": f\"{file_path}\"}\n"]},{"cell_type":"markdown","metadata":{"id":"ALpNtVpHA9FA"},"source":["#### Run the API"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":5,"status":"ok","timestamp":1701195128719,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"w3eG8rfRA9FB"},"outputs":[],"source":["import nest_asyncio\n","from pyngrok import ngrok\n","import uvicorn"]},{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"executionInfo":{"elapsed":517685,"status":"ok","timestamp":1701195648057,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"yOhMLxA5A9FB","outputId":"75844d00-b615-4a09-ac76-6b7dc212942d"},"outputs":[],"source":["ngrok_tunnel = ngrok.connect(8000)\n","print(\"Public URL:\", ngrok_tunnel.public_url)\n","nest_asyncio.apply()\n","uvicorn.run(app, port=8000)"]},{"cell_type":"markdown","metadata":{"id":"606pRql4A9FC"},"source":["#### Kill ngrok Connection"]},{"cell_type":"code","execution_count":null,"metadata":{"executionInfo":{"elapsed":537,"status":"ok","timestamp":1701195650871,"user":{"displayName":"Ari T","userId":"03786391891572230771"},"user_tz":-330},"id":"k7Tbq8w-A9FC"},"outputs":[],"source":["ngrok.kill()"]}],"metadata":{"accelerator":"GPU","colab":{"collapsed_sections":["w4LtdMb23tZ4"],"gpuType":"T4","provenance":[{"file_id":"https://github.com/csoneoneone/notebooks/blob/main/AudioPalette.ipynb","timestamp":1701164927931}]},"kernelspec":{"display_name":"Python 3","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.8.10"},"widgets":{"application/vnd.jupyter.widget-state+json":{"011336465e784f298036ea6790fed052":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"01d6152aa0a84b5797c0d8d7485ece6b":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"0404cdaca76544809f91837630728dba":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"04e7660db17e436f8382a180d7add4d3":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"067a2fb78e2f4880a7859f3d4443efc7":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"06afc51d1e5744df9809e20a9ed593c9":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_c9119148bfea46f0b518e0ad0c61cb20","placeholder":"","style":"IPY_MODEL_80012bda0de7476fa223598421d046a9","value":"tokenizer.json: 100%"}},"0743e86fd2144c598a6a523fdb91ced0":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"09e27493d427431a9d449289234f9bba":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"0a7f528a0e204b3288755779cc300c56":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"106dfc82e3b8458db4d1d79cb9018ce9":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"147b03786e5f475b804ffa0e4b3126f3":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"155a5102300f47c894b2a11bcbba0e7d":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"1b1fb646414f463a941e757091c424cd":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_a034a4e24e8448889cbc5299e736c21a","placeholder":"","style":"IPY_MODEL_147b03786e5f475b804ffa0e4b3126f3","value":"config.json: 100%"}},"256a058561ab454f88011d1ef5067dc3":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"27284fcd59974e9baa1cd6f42bbd317a":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"2de4bb7ced1e4e10b51c82df173c987e":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"35fd990491554b4bb55ff1deb67f6085":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"36ae6a59a3c24c7b8cc01cf5139f7616":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_011336465e784f298036ea6790fed052","placeholder":"","style":"IPY_MODEL_ef8943bc8ff34a0a97b900767614b6c0","value":" 224/224 [00:00<00:00, 9.51kB/s]"}},"36e7a8aa309a4bcf901c8acc185bca8e":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_06afc51d1e5744df9809e20a9ed593c9","IPY_MODEL_d4b778e99dc243358b8851d87433bb05","IPY_MODEL_b63328001a7d42b1b763b088a022ff0b"],"layout":"IPY_MODEL_0404cdaca76544809f91837630728dba"}},"38fd91db4ae74f3ca1fb4c93a61b4e4a":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"3911de4376a2466683f0696fae258e24":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_dc6cee3737f74e34b291a3d63d8842ba","placeholder":"","style":"IPY_MODEL_d6981569cb5341ff9e9166c5fc0d513f","value":" 2.20k/2.20k [00:00<00:00, 143kB/s]"}},"425da6ccf8a848edb50b9a9795863651":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"461aa7211959411ab116bc82fd2165c1":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"46fb87d0ea4f4460bed643a196ca41b4":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_c69ee7b1381f43fbba5c0304d64f23ab","IPY_MODEL_cb8343cd0b8240e49c12bb7f8cf8d41c","IPY_MODEL_3911de4376a2466683f0696fae258e24"],"layout":"IPY_MODEL_d4cd5a793b3c4a1898e28303e5e2f991"}},"4efae1e9896d49d8924c653b99f88506":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_9d327383466748548cd8300dc3db05c5","placeholder":"","style":"IPY_MODEL_04e7660db17e436f8382a180d7add4d3","value":" 792k/792k [00:00<00:00, 40.8MB/s]"}},"52f77fbf33354baf9f881f76276b4764":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"56d1aa41461841f28cf66f4a4a36e4c5":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_a5a135f9d5c3400bb11e97d8701a0c46","IPY_MODEL_ce2c8f75d3fe4a7ab74ff36f0c933d74","IPY_MODEL_4efae1e9896d49d8924c653b99f88506"],"layout":"IPY_MODEL_425da6ccf8a848edb50b9a9795863651"}},"5786b1750d0646d9a6dd4fd56cb8b37c":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"5b3123bd83fa4c618faf8c131de662ab":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"5e18669c53b34717a7ab136987993f8d":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"5fd1148bd5b147748f308b096110b195":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"605f44b988aa4f0895befca0d3b3fb44":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_5b3123bd83fa4c618faf8c131de662ab","placeholder":"","style":"IPY_MODEL_ec39db95dd1046839acc37bdb914897c","value":" 7.87k/7.87k [00:00<00:00, 406kB/s]"}},"69d12e4b48f444c48895818a0828cad4":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_c50604d9526e400d9356392517a322df","IPY_MODEL_b45c4923d4e449e28261bb4396081154","IPY_MODEL_36ae6a59a3c24c7b8cc01cf5139f7616"],"layout":"IPY_MODEL_a2f296abcc044dbb891813180e99876b"}},"69ec4d4dff864a648e8d6c03a2439b11":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"6dbbf1304d934c399dd02138541f7931":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"6dbce370c76643369b7bdd438055bbbc":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"70fc7a6ff58c4b918dcd402ea47c71ed":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"75d31df6137146ba820e60a2c16d4411":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"76503f0db07c43538621c313f229e665":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_106dfc82e3b8458db4d1d79cb9018ce9","max":275,"min":0,"orientation":"horizontal","style":"IPY_MODEL_bc7379793bcc4a9daacccd8e20fc4939","value":275}},"79e2820e80f4485e9b0a5117c1b46ede":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_6dbce370c76643369b7bdd438055bbbc","max":7866,"min":0,"orientation":"horizontal","style":"IPY_MODEL_b2f87a2a117e400da584b23e6bacd500","value":7866}},"7c13143aaf9e4ea5a981c3e01255db09":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"7eb8c7361089468da8ac4ba8b5706e78":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"7f77fd6745a84a2da02d7d41170d7af1":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"80012bda0de7476fa223598421d046a9":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"83aea96092f94262b6023ca8f7fcd6ca":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_461aa7211959411ab116bc82fd2165c1","placeholder":"","style":"IPY_MODEL_e6a9861c661b47faab1b834ec2aa4c78","value":"model.safetensors: 100%"}},"8f133aeec44844e0a8f2105ca25537ee":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_bc115429cdc34c96b6cb4f40bade275e","IPY_MODEL_76503f0db07c43538621c313f229e665","IPY_MODEL_ca9d933e16fa4fccb95378aa79e1ed23"],"layout":"IPY_MODEL_c7558a6ad7bf46209766ba35400f6c71"}},"92645005948c4cd98f036838361a0f9e":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"985f60b8f775420fbf96756681edeaa1":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_5fd1148bd5b147748f308b096110b195","placeholder":"","style":"IPY_MODEL_38fd91db4ae74f3ca1fb4c93a61b4e4a","value":" 2.37k/2.37k [00:00<00:00, 135kB/s]"}},"9b0fa2f21bf544529302e47b5051d277":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_7f77fd6745a84a2da02d7d41170d7af1","max":2364427288,"min":0,"orientation":"horizontal","style":"IPY_MODEL_bac33fb303c04630a8efdf0bfb9790fe","value":2364427288}},"9d327383466748548cd8300dc3db05c5":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"9edd2781f80d4ea1b44b3c0d9c6228cb":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_067a2fb78e2f4880a7859f3d4443efc7","placeholder":"","style":"IPY_MODEL_01d6152aa0a84b5797c0d8d7485ece6b","value":"tokenizer_config.json: 100%"}},"a034a4e24e8448889cbc5299e736c21a":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"a2f296abcc044dbb891813180e99876b":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"a5a135f9d5c3400bb11e97d8701a0c46":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_cf90e11688aa47dd9987e25e15c42ae9","placeholder":"","style":"IPY_MODEL_7eb8c7361089468da8ac4ba8b5706e78","value":"spiece.model: 100%"}},"a81e59481edd4684b65945a5a0e15b7e":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"b2ed07e5aaa843a1b03f91cec6f292c5":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_9edd2781f80d4ea1b44b3c0d9c6228cb","IPY_MODEL_dca965fb49054b2994504063823d1e45","IPY_MODEL_985f60b8f775420fbf96756681edeaa1"],"layout":"IPY_MODEL_7c13143aaf9e4ea5a981c3e01255db09"}},"b2f87a2a117e400da584b23e6bacd500":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"b341f1596ac04560b3b2622261b9d94d":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"b45c4923d4e449e28261bb4396081154":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_dd02cad84ab44023bb44d8c0e17f3eb6","max":224,"min":0,"orientation":"horizontal","style":"IPY_MODEL_6dbbf1304d934c399dd02138541f7931","value":224}},"b63328001a7d42b1b763b088a022ff0b":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_09e27493d427431a9d449289234f9bba","placeholder":"","style":"IPY_MODEL_92645005948c4cd98f036838361a0f9e","value":" 2.42M/2.42M [00:00<00:00, 4.92MB/s]"}},"bac33fb303c04630a8efdf0bfb9790fe":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"bc115429cdc34c96b6cb4f40bade275e":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_a81e59481edd4684b65945a5a0e15b7e","placeholder":"","style":"IPY_MODEL_de60244a16444f8190c964742c78bcee","value":"preprocessor_config.json: 100%"}},"bc7379793bcc4a9daacccd8e20fc4939":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"bdbc056ec0144e8bb01ab20be4f2706f":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"c0c8ba97b8004a8e8332122ec297022b":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"c50604d9526e400d9356392517a322df":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_5786b1750d0646d9a6dd4fd56cb8b37c","placeholder":"","style":"IPY_MODEL_0743e86fd2144c598a6a523fdb91ced0","value":"generation_config.json: 100%"}},"c560c9cadfec4b4d9712061e4f131d9a":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"ProgressStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"ProgressStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","bar_color":null,"description_width":""}},"c69ee7b1381f43fbba5c0304d64f23ab":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_0a7f528a0e204b3288755779cc300c56","placeholder":"","style":"IPY_MODEL_c0c8ba97b8004a8e8332122ec297022b","value":"special_tokens_map.json: 100%"}},"c7558a6ad7bf46209766ba35400f6c71":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"c9119148bfea46f0b518e0ad0c61cb20":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"ca32f9fcad8c455b95e9be177b5b3c53":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"ca9d933e16fa4fccb95378aa79e1ed23":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_70fc7a6ff58c4b918dcd402ea47c71ed","placeholder":"","style":"IPY_MODEL_256a058561ab454f88011d1ef5067dc3","value":" 275/275 [00:00<00:00, 13.8kB/s]"}},"cb8343cd0b8240e49c12bb7f8cf8d41c":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_69ec4d4dff864a648e8d6c03a2439b11","max":2201,"min":0,"orientation":"horizontal","style":"IPY_MODEL_52f77fbf33354baf9f881f76276b4764","value":2201}},"ce2c8f75d3fe4a7ab74ff36f0c933d74":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_ca32f9fcad8c455b95e9be177b5b3c53","max":791656,"min":0,"orientation":"horizontal","style":"IPY_MODEL_35fd990491554b4bb55ff1deb67f6085","value":791656}},"cf90e11688aa47dd9987e25e15c42ae9":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"d4b778e99dc243358b8851d87433bb05":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_155a5102300f47c894b2a11bcbba0e7d","max":2422095,"min":0,"orientation":"horizontal","style":"IPY_MODEL_27284fcd59974e9baa1cd6f42bbd317a","value":2422095}},"d4cd5a793b3c4a1898e28303e5e2f991":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"d4f059066f534812aca7e55fe6ba37e0":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_1b1fb646414f463a941e757091c424cd","IPY_MODEL_79e2820e80f4485e9b0a5117c1b46ede","IPY_MODEL_605f44b988aa4f0895befca0d3b3fb44"],"layout":"IPY_MODEL_b341f1596ac04560b3b2622261b9d94d"}},"d6981569cb5341ff9e9166c5fc0d513f":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"dc6cee3737f74e34b291a3d63d8842ba":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"dca965fb49054b2994504063823d1e45":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"FloatProgressModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"FloatProgressModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"ProgressView","bar_style":"success","description":"","description_tooltip":null,"layout":"IPY_MODEL_5e18669c53b34717a7ab136987993f8d","max":2366,"min":0,"orientation":"horizontal","style":"IPY_MODEL_c560c9cadfec4b4d9712061e4f131d9a","value":2366}},"dd02cad84ab44023bb44d8c0e17f3eb6":{"model_module":"@jupyter-widgets/base","model_module_version":"1.2.0","model_name":"LayoutModel","state":{"_model_module":"@jupyter-widgets/base","_model_module_version":"1.2.0","_model_name":"LayoutModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"LayoutView","align_content":null,"align_items":null,"align_self":null,"border":null,"bottom":null,"display":null,"flex":null,"flex_flow":null,"grid_area":null,"grid_auto_columns":null,"grid_auto_flow":null,"grid_auto_rows":null,"grid_column":null,"grid_gap":null,"grid_row":null,"grid_template_areas":null,"grid_template_columns":null,"grid_template_rows":null,"height":null,"justify_content":null,"justify_items":null,"left":null,"margin":null,"max_height":null,"max_width":null,"min_height":null,"min_width":null,"object_fit":null,"object_position":null,"order":null,"overflow":null,"overflow_x":null,"overflow_y":null,"padding":null,"right":null,"top":null,"visibility":null,"width":null}},"dd15ac5529c44fabb55b0b3a87f16775":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HBoxModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HBoxModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HBoxView","box_style":"","children":["IPY_MODEL_83aea96092f94262b6023ca8f7fcd6ca","IPY_MODEL_9b0fa2f21bf544529302e47b5051d277","IPY_MODEL_f6bfec4da9ea48c3981ed9421cc5c4b1"],"layout":"IPY_MODEL_75d31df6137146ba820e60a2c16d4411"}},"de60244a16444f8190c964742c78bcee":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"e6a9861c661b47faab1b834ec2aa4c78":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"ec39db95dd1046839acc37bdb914897c":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"ef8943bc8ff34a0a97b900767614b6c0":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"DescriptionStyleModel","state":{"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"DescriptionStyleModel","_view_count":null,"_view_module":"@jupyter-widgets/base","_view_module_version":"1.2.0","_view_name":"StyleView","description_width":""}},"f6bfec4da9ea48c3981ed9421cc5c4b1":{"model_module":"@jupyter-widgets/controls","model_module_version":"1.5.0","model_name":"HTMLModel","state":{"_dom_classes":[],"_model_module":"@jupyter-widgets/controls","_model_module_version":"1.5.0","_model_name":"HTMLModel","_view_count":null,"_view_module":"@jupyter-widgets/controls","_view_module_version":"1.5.0","_view_name":"HTMLView","description":"","description_tooltip":null,"layout":"IPY_MODEL_2de4bb7ced1e4e10b51c82df173c987e","placeholder":"","style":"IPY_MODEL_bdbc056ec0144e8bb01ab20be4f2706f","value":" 2.36G/2.36G [00:18<00:00, 30.4MB/s]"}}}}},"nbformat":4,"nbformat_minor":0}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"cells": [
|
3 |
+
{
|
4 |
+
"cell_type": "markdown",
|
5 |
+
"metadata": {
|
6 |
+
"id": "w4LtdMb23tZ4"
|
7 |
+
},
|
8 |
+
"source": [
|
9 |
+
"## Prerequisites"
|
10 |
+
]
|
11 |
+
},
|
12 |
+
{
|
13 |
+
"cell_type": "markdown",
|
14 |
+
"metadata": {
|
15 |
+
"id": "JgJLBIh3fm-W"
|
16 |
+
},
|
17 |
+
"source": [
|
18 |
+
"### Install Dependencies"
|
19 |
+
]
|
20 |
+
},
|
21 |
+
{
|
22 |
+
"cell_type": "code",
|
23 |
+
"execution_count": null,
|
24 |
+
"metadata": {
|
25 |
+
"id": "EodUpreufqD-"
|
26 |
+
},
|
27 |
+
"outputs": [],
|
28 |
+
"source": [
|
29 |
+
"!nvidia-smi"
|
30 |
+
]
|
31 |
+
},
|
32 |
+
{
|
33 |
+
"cell_type": "code",
|
34 |
+
"execution_count": null,
|
35 |
+
"metadata": {
|
36 |
+
"id": "bOn11huvfuXc"
|
37 |
+
},
|
38 |
+
"outputs": [],
|
39 |
+
"source": [
|
40 |
+
"!pip install --upgrade --quiet pip\n",
|
41 |
+
"!pip install --quiet git+https://github.com/huggingface/transformers.git"
|
42 |
+
]
|
43 |
+
},
|
44 |
+
{
|
45 |
+
"cell_type": "code",
|
46 |
+
"execution_count": null,
|
47 |
+
"metadata": {
|
48 |
+
"id": "Nl0CQxwHCrFd"
|
49 |
+
},
|
50 |
+
"outputs": [],
|
51 |
+
"source": [
|
52 |
+
"!pip install typing-extensions==4.5.0\n",
|
53 |
+
"!pip install python-multipart\n",
|
54 |
+
"!pip install kaleido\n",
|
55 |
+
"!pip install notebook>=6.5.5\n",
|
56 |
+
"!pip install click>=8.0\n",
|
57 |
+
"!pip install fastapi\n",
|
58 |
+
"!pip install \"uvicorn[standard]\"\n",
|
59 |
+
"!pip install pyngrok"
|
60 |
+
]
|
61 |
+
},
|
62 |
+
{
|
63 |
+
"cell_type": "markdown",
|
64 |
+
"metadata": {
|
65 |
+
"id": "ROxnljVbf6_o"
|
66 |
+
},
|
67 |
+
"source": [
|
68 |
+
"### Load the models"
|
69 |
+
]
|
70 |
+
},
|
71 |
+
{
|
72 |
+
"cell_type": "code",
|
73 |
+
"execution_count": null,
|
74 |
+
"metadata": {
|
75 |
+
"id": "ToxW1gbLf6tr"
|
76 |
+
},
|
77 |
+
"outputs": [],
|
78 |
+
"source": [
|
79 |
+
"from transformers import MusicgenForConditionalGeneration, MusicgenProcessor, set_seed\n",
|
80 |
+
"\n",
|
81 |
+
"model = MusicgenForConditionalGeneration.from_pretrained(\"facebook/musicgen-small\")\n",
|
82 |
+
"processor = MusicgenProcessor.from_pretrained(\"facebook/musicgen-small\")"
|
83 |
+
]
|
84 |
+
},
|
85 |
+
{
|
86 |
+
"cell_type": "code",
|
87 |
+
"execution_count": null,
|
88 |
+
"metadata": {
|
89 |
+
"id": "omP9Hg1ajUKM"
|
90 |
+
},
|
91 |
+
"outputs": [],
|
92 |
+
"source": [
|
93 |
+
"import torch\n",
|
94 |
+
"from IPython.display import Audio\n",
|
95 |
+
"\n",
|
96 |
+
"sampling_rate = model.config.audio_encoder.sampling_rate\n",
|
97 |
+
"device = \"cuda:0\" if torch.cuda.is_available() else \"cpu\"\n",
|
98 |
+
"model.to(device)\n",
|
99 |
+
"None"
|
100 |
+
]
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"cell_type": "markdown",
|
104 |
+
"metadata": {
|
105 |
+
"id": "852jZKSqiKoT"
|
106 |
+
},
|
107 |
+
"source": [
|
108 |
+
"## Music Generation functionality"
|
109 |
+
]
|
110 |
+
},
|
111 |
+
{
|
112 |
+
"cell_type": "markdown",
|
113 |
+
"metadata": {
|
114 |
+
"id": "8nydshMdxKab"
|
115 |
+
},
|
116 |
+
"source": [
|
117 |
+
"#### Model Class"
|
118 |
+
]
|
119 |
+
},
|
120 |
+
{
|
121 |
+
"cell_type": "code",
|
122 |
+
"execution_count": null,
|
123 |
+
"metadata": {
|
124 |
+
"id": "4V49E7xpxNPu"
|
125 |
+
},
|
126 |
+
"outputs": [],
|
127 |
+
"source": [
|
128 |
+
"import numpy as np\n",
|
129 |
+
"import typing\n",
|
130 |
+
"\n",
|
131 |
+
"class AudioPalette:\n",
|
132 |
+
" def __init__(self):\n",
|
133 |
+
" pass\n",
|
134 |
+
"\n",
|
135 |
+
" def set_prompt(self, caption: str | typing.List[str]):\n",
|
136 |
+
" self.caption = caption\n",
|
137 |
+
"\n",
|
138 |
+
" def generate(self):\n",
|
139 |
+
" if isinstance(self.caption, str):\n",
|
140 |
+
" return self.generate_single()\n",
|
141 |
+
" else:\n",
|
142 |
+
" return self.generate_multiple()\n",
|
143 |
+
"\n",
|
144 |
+
" def generate_single(self, prompt=None, max_new_tokens=512):\n",
|
145 |
+
" if not prompt:\n",
|
146 |
+
" prompt = self.caption\n",
|
147 |
+
" inputs = processor(\n",
|
148 |
+
" text=[prompt],\n",
|
149 |
+
" padding=True,\n",
|
150 |
+
" return_tensors=\"pt\",\n",
|
151 |
+
" sampling_rate=sampling_rate\n",
|
152 |
+
" )\n",
|
153 |
+
"\n",
|
154 |
+
" audio_values = model.generate(**inputs.to(device), do_sample=True, guidance_scale=3, max_new_tokens=max_new_tokens)\n",
|
155 |
+
" return audio_values\n",
|
156 |
+
"\n",
|
157 |
+
" def generate_audio_with_melody_conditioning(self, prompt, melody, max_new_tokens=256):\n",
|
158 |
+
" inputs = processor(\n",
|
159 |
+
" text=[prompt],\n",
|
160 |
+
" audio=melody[0, 0].cpu().numpy(),\n",
|
161 |
+
" padding=True,\n",
|
162 |
+
" return_tensors=\"pt\",\n",
|
163 |
+
" sampling_rate=sampling_rate\n",
|
164 |
+
" )\n",
|
165 |
+
"\n",
|
166 |
+
" # set_seed(1)\n",
|
167 |
+
" audio_values = model.generate(**inputs.to(device), do_sample=True, guidance_scale=3, max_new_tokens=max_new_tokens)\n",
|
168 |
+
" return audio_values\n",
|
169 |
+
"\n",
|
170 |
+
" def generate_multiple(self):\n",
|
171 |
+
" for idx, prompt in enumerate(self.caption):\n",
|
172 |
+
" if idx == 0:\n",
|
173 |
+
" audio = self.generate_single(prompt, 256)\n",
|
174 |
+
" else:\n",
|
175 |
+
" audio = self.generate_audio_with_melody_conditioning(prompt, audio)\n",
|
176 |
+
" return audio"
|
177 |
+
]
|
178 |
+
},
|
179 |
+
{
|
180 |
+
"cell_type": "code",
|
181 |
+
"execution_count": null,
|
182 |
+
"metadata": {
|
183 |
+
"id": "qW65Q68o-R7f"
|
184 |
+
},
|
185 |
+
"outputs": [],
|
186 |
+
"source": [
|
187 |
+
"audiopalette = AudioPalette()"
|
188 |
+
]
|
189 |
+
},
|
190 |
+
{
|
191 |
+
"cell_type": "markdown",
|
192 |
+
"metadata": {
|
193 |
+
"id": "P3OmxnaBA9E-"
|
194 |
+
},
|
195 |
+
"source": [
|
196 |
+
"#### API Creation"
|
197 |
+
]
|
198 |
+
},
|
199 |
+
{
|
200 |
+
"cell_type": "code",
|
201 |
+
"execution_count": null,
|
202 |
+
"metadata": {
|
203 |
+
"id": "Dxlw3ODsTtuB"
|
204 |
+
},
|
205 |
+
"outputs": [],
|
206 |
+
"source": [
|
207 |
+
"from fastapi import FastAPI\n",
|
208 |
+
"from pydantic import BaseModel, Field\n",
|
209 |
+
"from fastapi.middleware.cors import CORSMiddleware\n",
|
210 |
+
"\n",
|
211 |
+
"app = FastAPI()\n",
|
212 |
+
"\n",
|
213 |
+
"app.add_middleware(\n",
|
214 |
+
" CORSMiddleware,\n",
|
215 |
+
" allow_origins=['*'],\n",
|
216 |
+
" allow_credentials=True,\n",
|
217 |
+
" allow_methods=['*'],\n",
|
218 |
+
" allow_headers=['*'],\n",
|
219 |
+
")"
|
220 |
+
]
|
221 |
+
},
|
222 |
+
{
|
223 |
+
"cell_type": "code",
|
224 |
+
"execution_count": null,
|
225 |
+
"metadata": {
|
226 |
+
"id": "iYUH3-GpfbN8"
|
227 |
+
},
|
228 |
+
"outputs": [],
|
229 |
+
"source": [
|
230 |
+
"import typing\n",
|
231 |
+
"import numpy as np\n",
|
232 |
+
"\n",
|
233 |
+
"class Prompt(BaseModel):\n",
|
234 |
+
" caption: str | typing.List[str]\n",
|
235 |
+
"\n",
|
236 |
+
"class FileData(BaseModel):\n",
|
237 |
+
" file_path: str\n",
|
238 |
+
"\n",
|
239 |
+
"# class Melody(BaseModel):\n",
|
240 |
+
"# audio: np.ndarray\n",
|
241 |
+
"\n",
|
242 |
+
"# class Config:\n",
|
243 |
+
"# arbitrary_types_allowed = True"
|
244 |
+
]
|
245 |
+
},
|
246 |
+
{
|
247 |
+
"cell_type": "code",
|
248 |
+
"execution_count": null,
|
249 |
+
"metadata": {
|
250 |
+
"id": "PTQCdon0A9FA"
|
251 |
+
},
|
252 |
+
"outputs": [],
|
253 |
+
"source": [
|
254 |
+
"import tempfile\n",
|
255 |
+
"import scipy\n",
|
256 |
+
"\n",
|
257 |
+
"from fastapi.responses import FileResponse\n",
|
258 |
+
"\n",
|
259 |
+
"@app.get('/')\n",
|
260 |
+
"async def root():\n",
|
261 |
+
" return {\"message\": \"Hello World\"}\n",
|
262 |
+
"\n",
|
263 |
+
"@app.post('/download')\n",
|
264 |
+
"async def download(file_data: FileData):\n",
|
265 |
+
" file_path = file_data.file_path\n",
|
266 |
+
" return FileResponse(file_path)\n",
|
267 |
+
"\n",
|
268 |
+
"@app.post('/generate')\n",
|
269 |
+
"async def gen_music(prompt: Prompt):\n",
|
270 |
+
" audiopalette.set_prompt(prompt.caption)\n",
|
271 |
+
" audio = audiopalette.generate()\n",
|
272 |
+
"\n",
|
273 |
+
" file_path = None\n",
|
274 |
+
" with tempfile.NamedTemporaryFile(delete=False) as f:\n",
|
275 |
+
" scipy.io.wavfile.write(f, rate=sampling_rate, data=audio[0, 0].cpu().numpy())\n",
|
276 |
+
" file_path = f.name\n",
|
277 |
+
"\n",
|
278 |
+
" if not file_path:\n",
|
279 |
+
" return {\"error\": \"There has been an error\"}\n",
|
280 |
+
" return {\"file_path\": f\"{file_path}\"}\n"
|
281 |
+
]
|
282 |
+
},
|
283 |
+
{
|
284 |
+
"cell_type": "markdown",
|
285 |
+
"metadata": {
|
286 |
+
"id": "ALpNtVpHA9FA"
|
287 |
+
},
|
288 |
+
"source": [
|
289 |
+
"#### Run the API"
|
290 |
+
]
|
291 |
+
},
|
292 |
+
{
|
293 |
+
"cell_type": "code",
|
294 |
+
"execution_count": null,
|
295 |
+
"metadata": {
|
296 |
+
"id": "w3eG8rfRA9FB"
|
297 |
+
},
|
298 |
+
"outputs": [],
|
299 |
+
"source": [
|
300 |
+
"import nest_asyncio\n",
|
301 |
+
"from pyngrok import ngrok\n",
|
302 |
+
"import uvicorn"
|
303 |
+
]
|
304 |
+
},
|
305 |
+
{
|
306 |
+
"cell_type": "code",
|
307 |
+
"execution_count": null,
|
308 |
+
"metadata": {
|
309 |
+
"id": "yOhMLxA5A9FB"
|
310 |
+
},
|
311 |
+
"outputs": [],
|
312 |
+
"source": [
|
313 |
+
"ngrok_tunnel = ngrok.connect(8000)\n",
|
314 |
+
"print(\"Public URL:\", ngrok_tunnel.public_url)\n",
|
315 |
+
"nest_asyncio.apply()\n",
|
316 |
+
"uvicorn.run(app, port=8000)"
|
317 |
+
]
|
318 |
+
},
|
319 |
+
{
|
320 |
+
"cell_type": "markdown",
|
321 |
+
"metadata": {
|
322 |
+
"id": "606pRql4A9FC"
|
323 |
+
},
|
324 |
+
"source": [
|
325 |
+
"#### Kill ngrok Connection"
|
326 |
+
]
|
327 |
+
},
|
328 |
+
{
|
329 |
+
"cell_type": "code",
|
330 |
+
"execution_count": null,
|
331 |
+
"metadata": {
|
332 |
+
"id": "k7Tbq8w-A9FC"
|
333 |
+
},
|
334 |
+
"outputs": [],
|
335 |
+
"source": [
|
336 |
+
"ngrok.kill()"
|
337 |
+
]
|
338 |
+
}
|
339 |
+
],
|
340 |
+
"metadata": {
|
341 |
+
"accelerator": "GPU",
|
342 |
+
"colab": {
|
343 |
+
"collapsed_sections": [
|
344 |
+
"w4LtdMb23tZ4",
|
345 |
+
"46yDPBYqpYYN"
|
346 |
+
],
|
347 |
+
"gpuType": "T4",
|
348 |
+
"provenance": []
|
349 |
+
},
|
350 |
+
"kernelspec": {
|
351 |
+
"display_name": "Python 3",
|
352 |
+
"name": "python3"
|
353 |
+
},
|
354 |
+
"language_info": {
|
355 |
+
"codemirror_mode": {
|
356 |
+
"name": "ipython",
|
357 |
+
"version": 3
|
358 |
+
},
|
359 |
+
"file_extension": ".py",
|
360 |
+
"mimetype": "text/x-python",
|
361 |
+
"name": "python",
|
362 |
+
"nbconvert_exporter": "python",
|
363 |
+
"pygments_lexer": "ipython3",
|
364 |
+
"version": "3.8.10"
|
365 |
+
}
|
366 |
+
},
|
367 |
+
"nbformat": 4,
|
368 |
+
"nbformat_minor": 0
|
369 |
+
}
|