diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..60f079a39c9a6bf7c4e12ed8ea518b1553878a05 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,37 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +images/comfyui-speak.png filter=lfs diff=lfs merge=lfs -text +images/comfyui-train.png filter=lfs diff=lfs merge=lfs -text diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..b847bbc7ae8347083c3b9c23f9bf4ebd2a1c5cec --- /dev/null +++ b/LICENSE @@ -0,0 +1,284 @@ + + Fixed Seed Open License + Version 1.0, November 2026 + + This License is based on the Apache License, Version 2.0. It adds a + limit on Commercial Use above a revenue threshold (Section 5), a section + on Output (Section 6), termination (Section 12) and governing law + (Section 13), and makes the grants in Sections 2 and 3 subject to the + limit. Fixed Seed may publish new versions of this License; a Work + stays under the version it was released with. + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 13 of this document. + + "Licensor" shall mean Fixed Seed LLC, a California limited liability + company doing business as Fixed Seed Research Laboratory ("Fixed + Seed"). + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to model weights and parameters, software + source code, documentation source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. For the avoidance of doubt, + Derivative Works include any model, weights or adapter (including + LoRA and similar adapter weights) made by training, fine-tuning, + merging, quantizing, pruning or distilling the Work or a Derivative + Work. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + "Output" shall mean audio, speech, speech tokens, latents and any + other content generated by running the Work or a Derivative Work. + + "Commercial Use" shall mean any use of the Work, a Derivative Work or + Output that is directed toward commercial advantage or monetary + compensation, including offering the Work or a Derivative Work, or + access to either, as a product or service, and using the Work, a + Derivative Work or Output in or to make products, services or + content that are sold, licensed or otherwise monetized. + + "Attributable Revenue" shall mean the gross revenue, before + deductions of any kind, that You receive from (i) the Work or any + Derivative Work, or access to either (for example through an + application, an API or a hosted service), and (ii) any product, + service or content that uses, includes or was made with the Work, a + Derivative Work or Output, including through sales, subscriptions, + licensing, advertising and usage fees. Revenue from such a product, + service or content counts in full and is not apportioned among its + parts. Where You are a Legal Entity, Attributable Revenue includes + the revenue of every entity that makes up that Legal Entity. + + "Threshold" shall mean two million United States dollars + (US$2,000,000) of Attributable Revenue in any period of twelve (12) + consecutive months. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, including the Commercial Use Limitation in Section 5, + each Contributor hereby grants to You a perpetual, worldwide, + non-exclusive, no-charge, royalty-free, irrevocable (except as stated + in Sections 5 and 12) copyright license to reproduce, prepare + Derivative Works of, publicly display, publicly perform, sublicense, + and distribute the Work and such Derivative Works in Source or + Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, including the Commercial Use Limitation in Section 5, + each Contributor hereby grants to You a perpetual, worldwide, + non-exclusive, no-charge, royalty-free, irrevocable (except as stated + in this section and in Sections 5 and 12) patent license to make, + have made, use, offer to sell, sell, import, and otherwise transfer + the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + (e) You must distribute the Work and any Derivative Works under the + terms of this License, so that every recipient's Commercial Use + is subject to Section 5. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License, and provided that no such + terms remove or limit Section 5 for any recipient. + + 5. Commercial Use Limitation. + + (a) Below the Threshold. You may make Commercial Use of the Work, + Derivative Works and Output under this License for as long as + Your Attributable Revenue has not exceeded the Threshold. + + (b) Above the Threshold. If Your Attributable Revenue exceeds the + Threshold, You must tell Fixed Seed in writing within thirty (30) + days, at support@fixedseed.com or at another address Fixed Seed + publishes for this purpose, so that You and Fixed Seed can discuss + a separate commercial license. Your Commercial Use may continue + under this License for ninety (90) days after Your Attributable + Revenue first exceeded the Threshold, while You and Fixed Seed + negotiate in good faith. After that, this License grants You no + rights for Commercial Use, and Commercial Use requires a separate + written agreement with Fixed Seed. Fixed Seed may extend that + period in writing. + + (c) Other use. Use that is not Commercial Use, such as personal use, + research, education and evaluation, is not limited by this + Section, whatever Your revenue. + + (d) Good faith. If Fixed Seed asks in writing, You will tell Fixed + Seed in good faith whether Your Attributable Revenue has + exceeded the Threshold. + + 6. Output. Fixed Seed claims no ownership of Output. You are responsible + for Output and for how You use it, including for having any rights + You need in the text, recordings and other material You give the + Work or a Derivative Work. Commercial Use of Output is subject to + Section 5. + + 7. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 8. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 9. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 10. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 11. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + 12. Termination. If You fail to comply with any term of this License, + Your rights under it terminate automatically. They are reinstated if + You cure the failure within thirty (30) days after You first learn of + it, unless You have failed to comply with this License before. + Termination does not end the licenses of anyone who received the Work + or a Derivative Work from You and complies with this License. + Sections 9, 10, 12 and 13 survive termination. + + 13. Governing Law. This License is governed by the laws of the State of + California, without regard to its conflict-of-laws rules. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply this License to your work. + + Include a copy of this License with the Work, and a NOTICE file that + names the Work and its copyright owner, for example: + + Robin + Copyright 2026 Fixed Seed LLC + + Licensed under the Fixed Seed Open License, Version 1.0 (the + "License"); you may not use this file except in compliance with the + License. You may obtain a copy of the License in the LICENSE file + distributed with this Work. + + Unless required by applicable law or agreed to in writing, software + and models distributed under the License are distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + express or implied. See the License for the specific language + governing permissions and limitations under the License. diff --git a/LICENSE-APACHE-2.0 b/LICENSE-APACHE-2.0 new file mode 100644 index 0000000000000000000000000000000000000000..d645695673349e3947e8e5ae42332d0ac3164cd7 --- /dev/null +++ b/LICENSE-APACHE-2.0 @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..e2756120757ce03ae64d0a7ffeda49f6f3a595ca --- /dev/null +++ b/NOTICE @@ -0,0 +1,11 @@ +Robin +Copyright 2026 Fixed Seed LLC (Fixed Seed Research Laboratory) + +Licensed under the Fixed Seed Open License, Version 1.0 (see LICENSE). + +This repository also contains a third-party file that is not covered by +the Fixed Seed Open License: + +- speech_tokenizer_v3_25hz.onnx: the speech tokenizer from CosyVoice 3 + (https://github.com/FunAudioLLM/CosyVoice), used under the Apache + License, Version 2.0 (a copy is in LICENSE-APACHE-2.0). diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c195f91ef5eac0905c6004127b6202d35e21a048 --- /dev/null +++ b/README.md @@ -0,0 +1,142 @@ +--- +license: other +license_name: fixed-seed-open-license +license_link: LICENSE +language: +- en +- ja +pipeline_tag: text-to-speech +tags: +- text-to-speech +- lora +- comfyui +--- + +
+
+
Speak, change voices, train voices.
') + with gr.Row(elem_id='adapter', equal_height=True): + adapter = gr.Dropdown(studio.adapters(), value=NONE, label='Voice adapter', allow_custom_value=True, scale=3, + info='A voice trained in "Train a voice", or the path to one.') + strength = gr.Slider(0, 2, 1, step=.05, label='Strength', info='1 is the voice as trained.', scale=2) + language = gr.Dropdown(list(LANGUAGES), value='English', label='Language', scale=1, + info='The language Robin speaks, on every tab.') + with gr.Column(scale=1, min_width=120): + apply = gr.Button('Use', variant='primary', size='sm') + refresh = gr.Button('Refresh list', size='sm') + status_line = gr.Markdown(studio.adapter_status) + demo.load(lambda: (gr.update(choices=studio.adapters(), value=studio.adapter[0] if studio.adapter else NONE), + studio.adapter[1] if studio.adapter else 1, studio.adapter_status()), None, [adapter, strength, status_line]) + apply.click(studio.apply, [adapter, strength], status_line) + refresh.click(lambda: gr.update(choices=studio.adapters()), None, adapter) + strength.change(studio.strength, strength, status_line) + with gr.Tabs(): + with gr.Tab('Speak'): + speak_tab(studio, language) + with gr.Tab('Voice changer'): + changer_tab(studio, language) + with gr.Tab('Train a voice'): + train_tab(studio, adapter, strength, status_line, language) + return demo + + +def launch(robin, out='robin_studio', host='127.0.0.1', port=7860): + studio = Studio(robin, out) + demo = build(studio) + demo.queue(default_concurrency_limit=1) + demo.launch(server_name=host, server_port=port, theme=theme(), css=CSS, allowed_paths=[str(studio.out)], show_error=True) diff --git a/comfyui-robin/robin/lora.py b/comfyui-robin/robin/lora.py new file mode 100644 index 0000000000000000000000000000000000000000..8104b3c86711e1a657cf6ed451a1eb1a5c0bd01e --- /dev/null +++ b/comfyui-robin/robin/lora.py @@ -0,0 +1,94 @@ +import hashlib +import json +import math +import os +from pathlib import Path + +import torch +from safetensors import safe_open +from safetensors.torch import save_file +from torch import nn + +TARGETS = ('self_attn.qkv_proj', 'self_attn.o_proj', 'mlp.gate_up_proj') +FORMAT = 'robin-lora-1' + + +def file_sha256(path): + path = Path(path).resolve(); st = path.stat() + key = f'{path}:{st.st_size}:{st.st_mtime_ns}' + cache = Path(os.environ.get('ROBIN_CACHE', Path.home()/'.cache'/'robin'))/'sha256.json' + known = {} + try: known = json.loads(cache.read_text()) + except (OSError, ValueError): pass + if key not in known: + h = hashlib.sha256() + with path.open('rb') as f: + for chunk in iter(lambda: f.read(1 << 24), b''): h.update(chunk) + known[key] = h.hexdigest() + try: + cache.parent.mkdir(parents=True, exist_ok=True); cache.write_text(json.dumps(known)) + except OSError: pass + return known[key] + + +class LoRA(nn.Module): + def __init__(self, nets, ranks, alphas=None, targets=TARGETS, seed=0): + super().__init__() + self.ranks, self.alphas, self.targets = dict(ranks), dict(alphas or ranks), tuple(targets) + self.scale, self.names, self._mods, self._factor, self._handles = 1.0, [], [], [], [] + self.A, self.B = nn.ParameterList(), nn.ParameterList() + g = torch.Generator().manual_seed(seed) + for net, layers in nets.items(): + r = self.ranks[net] + for i, layer in enumerate(layers): + for t in self.targets: + m = layer.get_submodule(t) + a = torch.randn(r, m.in_features, generator=g) / math.sqrt(m.in_features) + self.A.append(nn.Parameter(a.to(m.weight.device))) + self.B.append(nn.Parameter(torch.zeros(m.out_features, r, device=m.weight.device))) + self.names.append(f'{net}.layers.{i}.{t}'); self._mods.append(m); self._factor.append(self.alphas[net] / r) + + def attach(self): + if not self._handles: + self._handles = [m.register_forward_hook(self._hook(i)) for i, m in enumerate(self._mods)] + return self + + def detach(self): + for h in self._handles: h.remove() + self._handles = [] + + def _hook(self, i): + def hook(_module, args, out): + if self.scale == 0: return out + delta = (args[0].float() @ self.A[i].T) @ self.B[i].T + return out + (delta * (self._factor[i] * self.scale)).to(out.dtype) + return hook + + def config(self, base_sha256=None): + return dict(format=FORMAT, ranks=self.ranks, alphas=self.alphas, targets=list(self.targets), base_sha256=base_sha256) + + def save(self, path, base_sha256=None, dtype=torch.bfloat16): + path = Path(path); tmp = path.with_name(path.name + '.tmp') + state = {} + for name, a, b in zip(self.names, self.A, self.B): + state[f'{name}.lora_A'] = a.detach().to(dtype).cpu().contiguous(); state[f'{name}.lora_B'] = b.detach().to(dtype).cpu().contiguous() + save_file(state, str(tmp), metadata=dict(robin_lora=json.dumps(self.config(base_sha256)))) + os.replace(tmp, path) + + @classmethod + def load(cls, path, nets, device='cuda'): + with safe_open(str(path), framework='pt', device='cpu') as f: + meta = f.metadata() or {} + if 'robin_lora' not in meta: + raise ValueError(f'{path} is not a Robin LoRA') + config = json.loads(meta['robin_lora']) + lora = cls({k: v for k, v in nets.items() if k in config['ranks']}, config['ranks'], config['alphas'], config['targets']) + keys = set(f.keys()) + for i, name in enumerate(lora.names): + for which, params in (('lora_A', lora.A), ('lora_B', lora.B)): + k = f'{name}.{which}' + if k not in keys: raise ValueError(f'{path} is missing {k}') + t = f.get_tensor(k) + if t.shape != params[i].shape: raise ValueError(f'{path}: {k} has shape {tuple(t.shape)}, expected {tuple(params[i].shape)}') + params[i].data.copy_(t) + return lora.to(device).requires_grad_(False), config diff --git a/comfyui-robin/robin/model.py b/comfyui-robin/robin/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3bd5dabda5a0971a01d4089f9b43333ad6aa56a6 --- /dev/null +++ b/comfyui-robin/robin/model.py @@ -0,0 +1,195 @@ +import math +from dataclasses import dataclass + +import torch +import torch.nn.functional as F +from torch import nn +from torch.utils.checkpoint import checkpoint + + +@dataclass +class Config: + vocab_size: int = 184704 + hidden_size: int = 2048 + intermediate_size: int = 6144 + num_hidden_layers: int = 28 + num_attention_heads: int = 16 + num_key_value_heads: int = 8 + head_dim: int = 128 + rope_theta: float = 1_000_000.0 + rms_norm_eps: float = 1e-6 + max_position_embeddings: int = 24576 + latent_dim: int = 64 + + +class RMSNorm(nn.Module): + def __init__(self, dim, eps): + super().__init__() + self.weight = nn.Parameter(torch.ones(dim)); self.eps = eps + + def forward(self, x): + return F.rms_norm(x, self.weight.shape, self.weight.to(x.dtype), self.eps) + + +def rope(positions, head_dim, theta, device): + inv = 1.0 / (theta ** (torch.arange(0, head_dim, 2, dtype=torch.float32, device=device) / head_dim)) + ang = positions.float().to(device)[:, None] * inv[None] + return ang.cos(), ang.sin() + + +def apply_rope(x, cos, sin): + f = x.float(); h = f.shape[-1] // 2 + lo, hi = f[..., :h], f[..., h:] + return torch.cat([lo * cos - hi * sin, hi * cos + lo * sin], dim=-1).to(x.dtype) + + +class Attention(nn.Module): + def __init__(self, c): + super().__init__() + self.h, self.kv, self.d = c.num_attention_heads, c.num_key_value_heads, c.head_dim + self.qkv_proj = nn.Linear(c.hidden_size, (self.h + 2 * self.kv) * self.d, bias=False) + self.o_proj = nn.Linear(self.h * self.d, c.hidden_size, bias=False) + self.q_norm, self.k_norm = RMSNorm(self.d, c.rms_norm_eps), RMSNorm(self.d, c.rms_norm_eps) + + def qkv(self, x, cos, sin): + B, T, _ = x.shape + q, k, v = self.qkv_proj(x).split((self.h * self.d, self.kv * self.d, self.kv * self.d), dim=-1) + q = self.q_norm(q.view(B, T, self.h, self.d)).transpose(1, 2) + k = self.k_norm(k.view(B, T, self.kv, self.d)).transpose(1, 2) + v = v.view(B, T, self.kv, self.d).transpose(1, 2) + return apply_rope(q, cos, sin), apply_rope(k, cos, sin), v + + def attend(self, q, k, v, mask=None): + o = F.scaled_dot_product_attention(q, k, v, attn_mask=mask, enable_gqa=self.h != self.kv) + return self.o_proj(o.transpose(1, 2).reshape(q.shape[0], q.shape[2], -1)) + + +class MLP(nn.Module): + def __init__(self, c): + super().__init__() + self.gate_up_proj = nn.Linear(c.hidden_size, 2 * c.intermediate_size, bias=False) + self.down_proj = nn.Linear(c.intermediate_size, c.hidden_size, bias=False) + + def forward(self, x): + g, u = self.gate_up_proj(x).chunk(2, dim=-1) + return self.down_proj(F.silu(g) * u) + + +class Block(nn.Module): + def __init__(self, c): + super().__init__() + self.input_layernorm = RMSNorm(c.hidden_size, c.rms_norm_eps) + self.self_attn = Attention(c) + self.post_attention_layernorm = RMSNorm(c.hidden_size, c.rms_norm_eps) + self.mlp = MLP(c) + + +def planner_block(layer, x, cos, sin, mask): + q, k, v = layer.self_attn.qkv(layer.input_layernorm(x), cos, sin) + x = x + layer.self_attn.attend(q, k, v, mask) + return x + layer.mlp(layer.post_attention_layernorm(x)) + + +def decoder_block(layer, s, cos, sin, prefix_k, prefix_v): + q, k, v = layer.self_attn.qkv(layer.input_layernorm(s), cos, sin) + k = torch.cat((prefix_k.to(k.dtype), k), dim=2); v = torch.cat((prefix_v.to(v.dtype), v), dim=2) + s = s + layer.self_attn.attend(q, k, v) + return s + layer.mlp(layer.post_attention_layernorm(s)) + + +class Planner(nn.Module): + def __init__(self, c: Config): + super().__init__() + self.c = c + self.embed_tokens = nn.Embedding(c.vocab_size, c.hidden_size) + self.layers = nn.ModuleList(Block(c) for _ in range(c.num_hidden_layers)) + self.norm = RMSNorm(c.hidden_size, c.rms_norm_eps) + self.lm_head = nn.Linear(c.hidden_size, c.vocab_size, bias=False) + + def forward(self, ids, mask): + x = self.embed_tokens(ids) + cos, sin = rope(torch.arange(ids.shape[1]), self.c.head_dim, self.c.rope_theta, x.device) + mask = mask.to(x.dtype) + for layer in self.layers: + x = checkpoint(planner_block, layer, x, cos, sin, mask, use_reentrant=False) + return self.norm(x) + + @torch.no_grad() + def prefill(self, ids, mask): + x = self.embed_tokens(ids[None]); T = ids.shape[0] + cos, sin = rope(torch.arange(T), self.c.head_dim, self.c.rope_theta, x.device) + ks, vs = [], [] + for layer in self.layers: + q, k, v = layer.self_attn.qkv(layer.input_layernorm(x), cos, sin) + x = x + layer.self_attn.attend(q, k, v, mask.to(x.dtype)) + x = x + layer.mlp(layer.post_attention_layernorm(x)) + ks.append(k); vs.append(v) + return ks, vs, self.norm(x) + + @torch.no_grad() + def step(self, token, pos, kbuf, vbuf): + x = self.embed_tokens(torch.tensor([[token]], device=self.lm_head.weight.device)) + cos, sin = rope(torch.tensor([pos]), self.c.head_dim, self.c.rope_theta, x.device) + for i, layer in enumerate(self.layers): + q, k, v = layer.self_attn.qkv(layer.input_layernorm(x), cos, sin) + kbuf[i][:, :, pos] = k[:, :, 0]; vbuf[i][:, :, pos] = v[:, :, 0] + x = x + layer.self_attn.attend(q, kbuf[i][:, :, :pos + 1], vbuf[i][:, :, :pos + 1]) + x = x + layer.mlp(layer.post_attention_layernorm(x)) + return self.lm_head(self.norm(x)[:, -1]).float()[0] + + +class TimestepEmbedder(nn.Module): + def __init__(self, hidden): + super().__init__() + self.mlp = nn.Sequential(nn.Linear(256, hidden), nn.SiLU(), nn.Linear(hidden, hidden)) + + def forward(self, t): + half = 128 + freqs = torch.exp(-math.log(10000) * torch.arange(half, dtype=torch.float32, device=t.device) / half) + a = t.float()[:, None] * freqs[None] + return self.mlp(torch.cat([a.cos(), a.sin()], dim=-1).to(self.mlp[0].weight.dtype)) + + +def positions(n, dim, device): + pos = torch.arange(n, dtype=torch.float32, device=device)[:, None] + ang = pos * torch.exp(torch.arange(0, dim, 2, dtype=torch.float32, device=device) * (-math.log(10000.0) / dim)) + pe = torch.zeros(n, dim, device=device) + pe[:, 0::2], pe[:, 1::2] = ang.sin(), ang.cos() + return pe + + +class _Stack(nn.Module): + def __init__(self, c): + super().__init__() + self.layers = nn.ModuleList(Block(c) for _ in range(c.num_hidden_layers)) + self.norm = RMSNorm(c.hidden_size, c.rms_norm_eps) + + +class Decoder(nn.Module): + def __init__(self, c: Config): + super().__init__() + self.c = c + self.model = _Stack(c) + self.vae2llm = nn.Linear(c.latent_dim, c.hidden_size) + self.llm2vae = nn.Linear(c.hidden_size, c.latent_dim) + self.time_embedder = TimestepEmbedder(c.hidden_size) + self._pe = None + + @torch.no_grad() + def velocity(self, x, sigma, prefix_k, prefix_v): + return self(x, sigma, prefix_k, prefix_v) + + def forward(self, x, sigma, prefix_k, prefix_v, checkpointing=False): + dt = self.vae2llm.weight.dtype + A = prefix_k[0].shape[2]; n = x.shape[1] + 2 + s = F.pad(x.to(dt), (0, 0, 1, 1)) + if self._pe is None or self._pe.shape[0] < n or self._pe.device != x.device: + self._pe = positions(max(n, 1024), self.c.hidden_size, x.device).to(dt) + s = self.vae2llm(s) + self.time_embedder(sigma.to(dt))[:, None] + self._pe[:n][None] + cos, sin = rope(torch.arange(A, A + n), self.c.head_dim, self.c.rope_theta, x.device) + for i, layer in enumerate(self.model.layers): + if checkpointing: + s = checkpoint(decoder_block, layer, s, cos, sin, prefix_k[i], prefix_v[i], use_reentrant=False) + else: + s = decoder_block(layer, s, cos, sin, prefix_k[i], prefix_v[i]) + return self.llm2vae(self.model.norm(s))[:, 1:-1].float() diff --git a/comfyui-robin/robin/pieces.py b/comfyui-robin/robin/pieces.py new file mode 100644 index 0000000000000000000000000000000000000000..d383999cc258c2e9048afe8e9beebe8b34733474 --- /dev/null +++ b/comfyui-robin/robin/pieces.py @@ -0,0 +1,181 @@ +import re + +import numpy as np + +from .text import speakable + +RATE = 48000 +SAMPLE_LINE = 'Here is a short sample of my voice, read clearly and at an easy pace.' +SAMPLE_LINES = dict(en=SAMPLE_LINE, ja='これは私の声の短いサンプルです。はっきりと、ゆっくり読んでいます。', mix=SAMPLE_LINE) +TAG = re.compile(r'\[[^\]]*\]') +ENDS = re.compile(r'(?<=[.!?])\s+|(?<=[.!?]")\s+|(?<=[。!?])\s*') + + +def size(text, lang='en'): + text = TAG.sub(' ', text) + if lang == 'en': + return len(re.findall(r"[A-Za-z0-9']+", text)) + return len(re.sub(r'[\s\W]', '', text)) / 2.8 + + +def sentences(text): + out, cur = [], '' + for part in ENDS.split(text.strip()): + if not part: continue + cur = f'{cur} {part}'.strip() if cur else part + if cur.count('"') % 2 == 0: out.append(cur); cur = '' + return out + ([cur] if cur else []) + + +def clauses(s, limit, lang): + if size(s, lang) <= limit: return [s] + best = None + for m in re.finditer(r'[,;:、,]\s*', s): + i = m.end() + if s[:i].count('"') % 2 or i >= len(s): continue + d = abs(size(s[:i], lang) - size(s, lang) / 2) + if best is None or d < best[0]: best = (d, i) + if best is None: return [s] + return clauses(s[:best[1]].strip(), limit, lang) + clauses(s[best[1]:].strip(), limit, lang) + + +def glue(parts, lang): + if lang == 'en': return ' '.join(parts) + out = '' + for p in parts: + out += (' ' if lang == 'mix' and out and (out[-1].isascii() or p[0].isascii()) else '') + p + return out + + +def split(text, max_words=35, lang='en', as_written=False): + if lang == 'en' and not as_written: text = speakable(text) + parts = [c for s in sentences(text) for c in clauses(s, max_words, lang)] + chunks, cur = [], [] + for p in parts: + if cur and size(glue(cur + [p], lang), lang) > max_words: + chunks.append(glue(cur, lang)); cur = [] + cur.append(p) + return chunks + ([glue(cur, lang)] if cur else []) + + +def frames_on(x, rate=RATE): + f = rate // 20; n = len(x) // f + return 20 * np.log10(np.sqrt((x[:n * f].reshape(n, f) ** 2).mean(1)) + 1e-9) > -45 + + +def stats(x, rate=RATE): + on = frames_on(x, rate); idx = np.flatnonzero(on); dur = len(on) / 20 + if not len(idx): return dict(sound=0., lead=dur, gap=0., tail=0.) + gap = run = 0 + for v in on[idx[0]:idx[-1] + 1]: + run = 0 if v else run + 1; gap = max(gap, run) + return dict(sound=on.sum() / 20, lead=idx[0] / 20, gap=gap / 20, tail=dur - (idx[-1] + 1) / 20) + + +def expected_seconds(text, lang='en'): + per_second = 2.7 if lang == 'en' else 2.5 + return max(1., size(text, lang) / per_second + .8 * len(TAG.findall(text))) + + +def check(x, text, lang='en', capped=False): + st = stats(x); ratio = st['sound'] / expected_seconds(text, lang); problems = [] + if st['sound'] < .3: problems.append('no sound') + if st['lead'] > 1.: problems.append('starts late') + if st['gap'] > 2.5: problems.append('goes quiet') + if ratio < .45: problems.append('too short') + if ratio > 1.8: problems.append('too long') + if capped and st['tail'] < .5: problems.append('still talking at the length limit') + return (10 * len(problems) + abs(np.log(max(ratio, 1e-3)))), problems + + +def trim(x): + f = RATE // 20; idx = np.flatnonzero(frames_on(x)) + if not len(idx): return x[:0] + y = x[max(0, idx[0] * f - RATE // 20):min(len(x), (idx[-1] + 1) * f + int(.12 * RATE))].copy() + f = min(len(y) // 2, RATE // 100) + y[:f] *= np.linspace(0, 1, f); y[len(y) - f:] *= np.linspace(1, 0, f) + return y + + +def loudness(x): + f = RATE // 20; n = len(x) // f + e = (x[:n * f].reshape(n, f) ** 2).mean(1); on = 10 * np.log10(e + 1e-12) > -45 + return float(np.sqrt(e[on].mean())) if on.any() else 0. + + +def join(pieces, texts): + ref = loudness(pieces[0]) or 1.; out = [] + for i, (y, t) in enumerate(zip(pieces, texts)): + level = loudness(y) + out.append(y * (min(2., max(.5, ref / level)) if level else 1.)) + if i < len(pieces) - 1: + pause = .35 if re.search(r'[.!?。!?]["\]]?\s*$', t) else .2 + out.append(np.zeros(int(pause * RATE), dtype=np.float32)) + return np.concatenate(out).astype(np.float32) + + +class Quiet: + def start(self, seconds): pass + + def finish(self, extra=0): pass + + def __call__(self, stage, step, total): pass + + +def _best_take(robin, text, voice, lang, seed, retries, progress, **kwargs): + best = None + for k in range(retries + 1): + progress.start(expected_seconds(text, lang)) + audio, _, info = robin.speak(text, voice, lang=lang, seed=seed + 7919 * k, callback=progress, **kwargs) + score, problems = check(audio, text, lang, info['capped']) + if best is None or score < best[0]: best = (score, problems, audio) + if not problems or k == retries: + progress.finish(); break + progress.finish(extra=1) + return best[2], best[1] + + +def read(robin, text, voice=None, *, reference=None, reference_rate=None, reference_text=None, seed=0, cfg=1., retries=2, max_words=35, + lang='en', as_written=False, progress=None, **sampling): + progress = progress or Quiet() + chunks = split(text, max_words, lang, as_written) + if not chunks: raise ValueError('There is no text to read.') + voice = (voice or '').strip() or None + ref = None if reference is None else (reference, reference_rate, (reference_text or '').strip() or None) + kept = [] + for i, chunk in enumerate(chunks): + audio, problems = _best_take(robin, chunk, voice, lang, seed + 1000 * i, retries, progress, cfg=cfg, + reference=ref[0] if ref else None, reference_rate=ref[1] if ref else None, + reference_text=ref[2] if ref else None, **sampling) + take = trim(audio) + kept.append(take) + if not problems and len(chunks) > 1 and len(take): + ref = (take, RATE, chunk) + return join(kept, chunks) + + +def change(robin, source, source_rate, source_text, *, reference=None, reference_rate=None, reference_text=None, voice=None, seed=0, + retries=2, lang='en', progress=None, **sampling): + progress = progress or Quiet() + voice = (voice or '').strip() or None + if not (source_text or '').strip(): raise ValueError('The source text must say exactly what the source clip says.') + if reference is None: + line = SAMPLE_LINES.get(lang, SAMPLE_LINE) + audio, _ = _best_take(robin, line, voice, lang, seed, retries, progress, **sampling) + reference, reference_rate, reference_text = trim(audio), RATE, line + seconds = len(source) / source_rate + target = stats(source, source_rate)['sound'] or seconds + best = None + for k in range(retries + 1): + progress.start(seconds) + audio, _, info = robin.convert(source, source_text.strip(), reference, reference_text=(reference_text or '').strip() or None, + source_rate=source_rate, reference_rate=reference_rate, description=voice, lang=lang, + seed=seed + 7919 * k, callback=progress, **sampling) + st = stats(audio); ratio = st['sound'] / max(target, .1) + problems = st['sound'] < .3 or not .5 <= ratio <= 2. or (info['capped'] and st['tail'] < .5) + score = 10 * problems + abs(np.log(max(ratio, 1e-3))) + if best is None or score < best[0]: best = (score, audio) + if not problems or k == retries: + progress.finish(); break + progress.finish(extra=1) + return best[1] diff --git a/comfyui-robin/robin/pipeline.py b/comfyui-robin/robin/pipeline.py new file mode 100644 index 0000000000000000000000000000000000000000..2a358958e38a03db07c4dd979c07e7f58ad88cf4 --- /dev/null +++ b/comfyui-robin/robin/pipeline.py @@ -0,0 +1,248 @@ +import json +import warnings +from pathlib import Path + +import numpy as np +import torch +from safetensors.torch import load_file +from tokenizers import Tokenizer + +from .model import Config, Planner, Decoder + +LANGS = dict(en='English', ja='Japanese', mix='English and Japanese') +WEIGHTS = 'robin_v1.safetensors' +VAE = 'robin_vae.safetensors' +SPEECH = 'speech_tokenizer_v3_25hz.onnx' +APOSTROPHES = str.maketrans(dict.fromkeys('\u2019\u2018\u201b\u02bc\uff07\u2032\u00b4`', "'")) + + +def plain(s): + return s.translate(APOSTROPHES) if s else s +FRAME_RATE, SAMPLE_RATE = 25, 48000 + + +class Cancelled(Exception): + pass + + +def prefix_mask(n, ss, device): + m = torch.full((n, n), float('-inf'), device=device).triu_(1) + m[:ss, :ss] = 0 + return m + + +class Robin: + def __init__(self, planner, decoder, vae, tokenizer, config, device): + self.planner, self.decoder, self.vae, self.tok, self.device = planner, decoder, vae, tokenizer, device + t = config['tokens'] + self.eod, self.score_start, self.score_end = t['eod'], t['score_start'], t['score_end'] + self.audio_start, self.audio_end, self.offset, self.codes = t['audio_start'], t['audio_end'], t['audio_offset'], t['audio_codes'] + self.instruction, self.defaults = config['instruction'], config['sampling'] + self._speech, self.lora, self.weights_file, self.vae_file = None, None, None, None + + @classmethod + def from_pretrained(cls, path, vae=None, device='cuda', dtype=torch.bfloat16, lora=None, lora_scale=1.0): + path = Path(path) + if not path.exists(): + from huggingface_hub import snapshot_download + path = Path(snapshot_download(str(path))) + if vae is None: + vae = path/VAE + if not vae.is_file(): + raise ValueError(f'VAE weights are required: put {VAE} in {path}, or pass vae=Speak, change voices, train voices.
') + with gr.Row(elem_id='adapter', equal_height=True): + adapter = gr.Dropdown(studio.adapters(), value=NONE, label='Voice adapter', allow_custom_value=True, scale=3, + info='A voice trained in "Train a voice", or the path to one.') + strength = gr.Slider(0, 2, 1, step=.05, label='Strength', info='1 is the voice as trained.', scale=2) + language = gr.Dropdown(list(LANGUAGES), value='English', label='Language', scale=1, + info='The language Robin speaks, on every tab.') + with gr.Column(scale=1, min_width=120): + apply = gr.Button('Use', variant='primary', size='sm') + refresh = gr.Button('Refresh list', size='sm') + status_line = gr.Markdown(studio.adapter_status) + demo.load(lambda: (gr.update(choices=studio.adapters(), value=studio.adapter[0] if studio.adapter else NONE), + studio.adapter[1] if studio.adapter else 1, studio.adapter_status()), None, [adapter, strength, status_line]) + apply.click(studio.apply, [adapter, strength], status_line) + refresh.click(lambda: gr.update(choices=studio.adapters()), None, adapter) + strength.change(studio.strength, strength, status_line) + with gr.Tabs(): + with gr.Tab('Speak'): + speak_tab(studio, language) + with gr.Tab('Voice changer'): + changer_tab(studio, language) + with gr.Tab('Train a voice'): + train_tab(studio, adapter, strength, status_line, language) + return demo + + +def launch(robin, out='robin_studio', host='127.0.0.1', port=7860): + studio = Studio(robin, out) + demo = build(studio) + demo.queue(default_concurrency_limit=1) + demo.launch(server_name=host, server_port=port, theme=theme(), css=CSS, allowed_paths=[str(studio.out)], show_error=True) diff --git a/package/robin/lora.py b/package/robin/lora.py new file mode 100644 index 0000000000000000000000000000000000000000..8104b3c86711e1a657cf6ed451a1eb1a5c0bd01e --- /dev/null +++ b/package/robin/lora.py @@ -0,0 +1,94 @@ +import hashlib +import json +import math +import os +from pathlib import Path + +import torch +from safetensors import safe_open +from safetensors.torch import save_file +from torch import nn + +TARGETS = ('self_attn.qkv_proj', 'self_attn.o_proj', 'mlp.gate_up_proj') +FORMAT = 'robin-lora-1' + + +def file_sha256(path): + path = Path(path).resolve(); st = path.stat() + key = f'{path}:{st.st_size}:{st.st_mtime_ns}' + cache = Path(os.environ.get('ROBIN_CACHE', Path.home()/'.cache'/'robin'))/'sha256.json' + known = {} + try: known = json.loads(cache.read_text()) + except (OSError, ValueError): pass + if key not in known: + h = hashlib.sha256() + with path.open('rb') as f: + for chunk in iter(lambda: f.read(1 << 24), b''): h.update(chunk) + known[key] = h.hexdigest() + try: + cache.parent.mkdir(parents=True, exist_ok=True); cache.write_text(json.dumps(known)) + except OSError: pass + return known[key] + + +class LoRA(nn.Module): + def __init__(self, nets, ranks, alphas=None, targets=TARGETS, seed=0): + super().__init__() + self.ranks, self.alphas, self.targets = dict(ranks), dict(alphas or ranks), tuple(targets) + self.scale, self.names, self._mods, self._factor, self._handles = 1.0, [], [], [], [] + self.A, self.B = nn.ParameterList(), nn.ParameterList() + g = torch.Generator().manual_seed(seed) + for net, layers in nets.items(): + r = self.ranks[net] + for i, layer in enumerate(layers): + for t in self.targets: + m = layer.get_submodule(t) + a = torch.randn(r, m.in_features, generator=g) / math.sqrt(m.in_features) + self.A.append(nn.Parameter(a.to(m.weight.device))) + self.B.append(nn.Parameter(torch.zeros(m.out_features, r, device=m.weight.device))) + self.names.append(f'{net}.layers.{i}.{t}'); self._mods.append(m); self._factor.append(self.alphas[net] / r) + + def attach(self): + if not self._handles: + self._handles = [m.register_forward_hook(self._hook(i)) for i, m in enumerate(self._mods)] + return self + + def detach(self): + for h in self._handles: h.remove() + self._handles = [] + + def _hook(self, i): + def hook(_module, args, out): + if self.scale == 0: return out + delta = (args[0].float() @ self.A[i].T) @ self.B[i].T + return out + (delta * (self._factor[i] * self.scale)).to(out.dtype) + return hook + + def config(self, base_sha256=None): + return dict(format=FORMAT, ranks=self.ranks, alphas=self.alphas, targets=list(self.targets), base_sha256=base_sha256) + + def save(self, path, base_sha256=None, dtype=torch.bfloat16): + path = Path(path); tmp = path.with_name(path.name + '.tmp') + state = {} + for name, a, b in zip(self.names, self.A, self.B): + state[f'{name}.lora_A'] = a.detach().to(dtype).cpu().contiguous(); state[f'{name}.lora_B'] = b.detach().to(dtype).cpu().contiguous() + save_file(state, str(tmp), metadata=dict(robin_lora=json.dumps(self.config(base_sha256)))) + os.replace(tmp, path) + + @classmethod + def load(cls, path, nets, device='cuda'): + with safe_open(str(path), framework='pt', device='cpu') as f: + meta = f.metadata() or {} + if 'robin_lora' not in meta: + raise ValueError(f'{path} is not a Robin LoRA') + config = json.loads(meta['robin_lora']) + lora = cls({k: v for k, v in nets.items() if k in config['ranks']}, config['ranks'], config['alphas'], config['targets']) + keys = set(f.keys()) + for i, name in enumerate(lora.names): + for which, params in (('lora_A', lora.A), ('lora_B', lora.B)): + k = f'{name}.{which}' + if k not in keys: raise ValueError(f'{path} is missing {k}') + t = f.get_tensor(k) + if t.shape != params[i].shape: raise ValueError(f'{path}: {k} has shape {tuple(t.shape)}, expected {tuple(params[i].shape)}') + params[i].data.copy_(t) + return lora.to(device).requires_grad_(False), config diff --git a/package/robin/model.py b/package/robin/model.py new file mode 100644 index 0000000000000000000000000000000000000000..3bd5dabda5a0971a01d4089f9b43333ad6aa56a6 --- /dev/null +++ b/package/robin/model.py @@ -0,0 +1,195 @@ +import math +from dataclasses import dataclass + +import torch +import torch.nn.functional as F +from torch import nn +from torch.utils.checkpoint import checkpoint + + +@dataclass +class Config: + vocab_size: int = 184704 + hidden_size: int = 2048 + intermediate_size: int = 6144 + num_hidden_layers: int = 28 + num_attention_heads: int = 16 + num_key_value_heads: int = 8 + head_dim: int = 128 + rope_theta: float = 1_000_000.0 + rms_norm_eps: float = 1e-6 + max_position_embeddings: int = 24576 + latent_dim: int = 64 + + +class RMSNorm(nn.Module): + def __init__(self, dim, eps): + super().__init__() + self.weight = nn.Parameter(torch.ones(dim)); self.eps = eps + + def forward(self, x): + return F.rms_norm(x, self.weight.shape, self.weight.to(x.dtype), self.eps) + + +def rope(positions, head_dim, theta, device): + inv = 1.0 / (theta ** (torch.arange(0, head_dim, 2, dtype=torch.float32, device=device) / head_dim)) + ang = positions.float().to(device)[:, None] * inv[None] + return ang.cos(), ang.sin() + + +def apply_rope(x, cos, sin): + f = x.float(); h = f.shape[-1] // 2 + lo, hi = f[..., :h], f[..., h:] + return torch.cat([lo * cos - hi * sin, hi * cos + lo * sin], dim=-1).to(x.dtype) + + +class Attention(nn.Module): + def __init__(self, c): + super().__init__() + self.h, self.kv, self.d = c.num_attention_heads, c.num_key_value_heads, c.head_dim + self.qkv_proj = nn.Linear(c.hidden_size, (self.h + 2 * self.kv) * self.d, bias=False) + self.o_proj = nn.Linear(self.h * self.d, c.hidden_size, bias=False) + self.q_norm, self.k_norm = RMSNorm(self.d, c.rms_norm_eps), RMSNorm(self.d, c.rms_norm_eps) + + def qkv(self, x, cos, sin): + B, T, _ = x.shape + q, k, v = self.qkv_proj(x).split((self.h * self.d, self.kv * self.d, self.kv * self.d), dim=-1) + q = self.q_norm(q.view(B, T, self.h, self.d)).transpose(1, 2) + k = self.k_norm(k.view(B, T, self.kv, self.d)).transpose(1, 2) + v = v.view(B, T, self.kv, self.d).transpose(1, 2) + return apply_rope(q, cos, sin), apply_rope(k, cos, sin), v + + def attend(self, q, k, v, mask=None): + o = F.scaled_dot_product_attention(q, k, v, attn_mask=mask, enable_gqa=self.h != self.kv) + return self.o_proj(o.transpose(1, 2).reshape(q.shape[0], q.shape[2], -1)) + + +class MLP(nn.Module): + def __init__(self, c): + super().__init__() + self.gate_up_proj = nn.Linear(c.hidden_size, 2 * c.intermediate_size, bias=False) + self.down_proj = nn.Linear(c.intermediate_size, c.hidden_size, bias=False) + + def forward(self, x): + g, u = self.gate_up_proj(x).chunk(2, dim=-1) + return self.down_proj(F.silu(g) * u) + + +class Block(nn.Module): + def __init__(self, c): + super().__init__() + self.input_layernorm = RMSNorm(c.hidden_size, c.rms_norm_eps) + self.self_attn = Attention(c) + self.post_attention_layernorm = RMSNorm(c.hidden_size, c.rms_norm_eps) + self.mlp = MLP(c) + + +def planner_block(layer, x, cos, sin, mask): + q, k, v = layer.self_attn.qkv(layer.input_layernorm(x), cos, sin) + x = x + layer.self_attn.attend(q, k, v, mask) + return x + layer.mlp(layer.post_attention_layernorm(x)) + + +def decoder_block(layer, s, cos, sin, prefix_k, prefix_v): + q, k, v = layer.self_attn.qkv(layer.input_layernorm(s), cos, sin) + k = torch.cat((prefix_k.to(k.dtype), k), dim=2); v = torch.cat((prefix_v.to(v.dtype), v), dim=2) + s = s + layer.self_attn.attend(q, k, v) + return s + layer.mlp(layer.post_attention_layernorm(s)) + + +class Planner(nn.Module): + def __init__(self, c: Config): + super().__init__() + self.c = c + self.embed_tokens = nn.Embedding(c.vocab_size, c.hidden_size) + self.layers = nn.ModuleList(Block(c) for _ in range(c.num_hidden_layers)) + self.norm = RMSNorm(c.hidden_size, c.rms_norm_eps) + self.lm_head = nn.Linear(c.hidden_size, c.vocab_size, bias=False) + + def forward(self, ids, mask): + x = self.embed_tokens(ids) + cos, sin = rope(torch.arange(ids.shape[1]), self.c.head_dim, self.c.rope_theta, x.device) + mask = mask.to(x.dtype) + for layer in self.layers: + x = checkpoint(planner_block, layer, x, cos, sin, mask, use_reentrant=False) + return self.norm(x) + + @torch.no_grad() + def prefill(self, ids, mask): + x = self.embed_tokens(ids[None]); T = ids.shape[0] + cos, sin = rope(torch.arange(T), self.c.head_dim, self.c.rope_theta, x.device) + ks, vs = [], [] + for layer in self.layers: + q, k, v = layer.self_attn.qkv(layer.input_layernorm(x), cos, sin) + x = x + layer.self_attn.attend(q, k, v, mask.to(x.dtype)) + x = x + layer.mlp(layer.post_attention_layernorm(x)) + ks.append(k); vs.append(v) + return ks, vs, self.norm(x) + + @torch.no_grad() + def step(self, token, pos, kbuf, vbuf): + x = self.embed_tokens(torch.tensor([[token]], device=self.lm_head.weight.device)) + cos, sin = rope(torch.tensor([pos]), self.c.head_dim, self.c.rope_theta, x.device) + for i, layer in enumerate(self.layers): + q, k, v = layer.self_attn.qkv(layer.input_layernorm(x), cos, sin) + kbuf[i][:, :, pos] = k[:, :, 0]; vbuf[i][:, :, pos] = v[:, :, 0] + x = x + layer.self_attn.attend(q, kbuf[i][:, :, :pos + 1], vbuf[i][:, :, :pos + 1]) + x = x + layer.mlp(layer.post_attention_layernorm(x)) + return self.lm_head(self.norm(x)[:, -1]).float()[0] + + +class TimestepEmbedder(nn.Module): + def __init__(self, hidden): + super().__init__() + self.mlp = nn.Sequential(nn.Linear(256, hidden), nn.SiLU(), nn.Linear(hidden, hidden)) + + def forward(self, t): + half = 128 + freqs = torch.exp(-math.log(10000) * torch.arange(half, dtype=torch.float32, device=t.device) / half) + a = t.float()[:, None] * freqs[None] + return self.mlp(torch.cat([a.cos(), a.sin()], dim=-1).to(self.mlp[0].weight.dtype)) + + +def positions(n, dim, device): + pos = torch.arange(n, dtype=torch.float32, device=device)[:, None] + ang = pos * torch.exp(torch.arange(0, dim, 2, dtype=torch.float32, device=device) * (-math.log(10000.0) / dim)) + pe = torch.zeros(n, dim, device=device) + pe[:, 0::2], pe[:, 1::2] = ang.sin(), ang.cos() + return pe + + +class _Stack(nn.Module): + def __init__(self, c): + super().__init__() + self.layers = nn.ModuleList(Block(c) for _ in range(c.num_hidden_layers)) + self.norm = RMSNorm(c.hidden_size, c.rms_norm_eps) + + +class Decoder(nn.Module): + def __init__(self, c: Config): + super().__init__() + self.c = c + self.model = _Stack(c) + self.vae2llm = nn.Linear(c.latent_dim, c.hidden_size) + self.llm2vae = nn.Linear(c.hidden_size, c.latent_dim) + self.time_embedder = TimestepEmbedder(c.hidden_size) + self._pe = None + + @torch.no_grad() + def velocity(self, x, sigma, prefix_k, prefix_v): + return self(x, sigma, prefix_k, prefix_v) + + def forward(self, x, sigma, prefix_k, prefix_v, checkpointing=False): + dt = self.vae2llm.weight.dtype + A = prefix_k[0].shape[2]; n = x.shape[1] + 2 + s = F.pad(x.to(dt), (0, 0, 1, 1)) + if self._pe is None or self._pe.shape[0] < n or self._pe.device != x.device: + self._pe = positions(max(n, 1024), self.c.hidden_size, x.device).to(dt) + s = self.vae2llm(s) + self.time_embedder(sigma.to(dt))[:, None] + self._pe[:n][None] + cos, sin = rope(torch.arange(A, A + n), self.c.head_dim, self.c.rope_theta, x.device) + for i, layer in enumerate(self.model.layers): + if checkpointing: + s = checkpoint(decoder_block, layer, s, cos, sin, prefix_k[i], prefix_v[i], use_reentrant=False) + else: + s = decoder_block(layer, s, cos, sin, prefix_k[i], prefix_v[i]) + return self.llm2vae(self.model.norm(s))[:, 1:-1].float() diff --git a/package/robin/pieces.py b/package/robin/pieces.py new file mode 100644 index 0000000000000000000000000000000000000000..d383999cc258c2e9048afe8e9beebe8b34733474 --- /dev/null +++ b/package/robin/pieces.py @@ -0,0 +1,181 @@ +import re + +import numpy as np + +from .text import speakable + +RATE = 48000 +SAMPLE_LINE = 'Here is a short sample of my voice, read clearly and at an easy pace.' +SAMPLE_LINES = dict(en=SAMPLE_LINE, ja='これは私の声の短いサンプルです。はっきりと、ゆっくり読んでいます。', mix=SAMPLE_LINE) +TAG = re.compile(r'\[[^\]]*\]') +ENDS = re.compile(r'(?<=[.!?])\s+|(?<=[.!?]")\s+|(?<=[。!?])\s*') + + +def size(text, lang='en'): + text = TAG.sub(' ', text) + if lang == 'en': + return len(re.findall(r"[A-Za-z0-9']+", text)) + return len(re.sub(r'[\s\W]', '', text)) / 2.8 + + +def sentences(text): + out, cur = [], '' + for part in ENDS.split(text.strip()): + if not part: continue + cur = f'{cur} {part}'.strip() if cur else part + if cur.count('"') % 2 == 0: out.append(cur); cur = '' + return out + ([cur] if cur else []) + + +def clauses(s, limit, lang): + if size(s, lang) <= limit: return [s] + best = None + for m in re.finditer(r'[,;:、,]\s*', s): + i = m.end() + if s[:i].count('"') % 2 or i >= len(s): continue + d = abs(size(s[:i], lang) - size(s, lang) / 2) + if best is None or d < best[0]: best = (d, i) + if best is None: return [s] + return clauses(s[:best[1]].strip(), limit, lang) + clauses(s[best[1]:].strip(), limit, lang) + + +def glue(parts, lang): + if lang == 'en': return ' '.join(parts) + out = '' + for p in parts: + out += (' ' if lang == 'mix' and out and (out[-1].isascii() or p[0].isascii()) else '') + p + return out + + +def split(text, max_words=35, lang='en', as_written=False): + if lang == 'en' and not as_written: text = speakable(text) + parts = [c for s in sentences(text) for c in clauses(s, max_words, lang)] + chunks, cur = [], [] + for p in parts: + if cur and size(glue(cur + [p], lang), lang) > max_words: + chunks.append(glue(cur, lang)); cur = [] + cur.append(p) + return chunks + ([glue(cur, lang)] if cur else []) + + +def frames_on(x, rate=RATE): + f = rate // 20; n = len(x) // f + return 20 * np.log10(np.sqrt((x[:n * f].reshape(n, f) ** 2).mean(1)) + 1e-9) > -45 + + +def stats(x, rate=RATE): + on = frames_on(x, rate); idx = np.flatnonzero(on); dur = len(on) / 20 + if not len(idx): return dict(sound=0., lead=dur, gap=0., tail=0.) + gap = run = 0 + for v in on[idx[0]:idx[-1] + 1]: + run = 0 if v else run + 1; gap = max(gap, run) + return dict(sound=on.sum() / 20, lead=idx[0] / 20, gap=gap / 20, tail=dur - (idx[-1] + 1) / 20) + + +def expected_seconds(text, lang='en'): + per_second = 2.7 if lang == 'en' else 2.5 + return max(1., size(text, lang) / per_second + .8 * len(TAG.findall(text))) + + +def check(x, text, lang='en', capped=False): + st = stats(x); ratio = st['sound'] / expected_seconds(text, lang); problems = [] + if st['sound'] < .3: problems.append('no sound') + if st['lead'] > 1.: problems.append('starts late') + if st['gap'] > 2.5: problems.append('goes quiet') + if ratio < .45: problems.append('too short') + if ratio > 1.8: problems.append('too long') + if capped and st['tail'] < .5: problems.append('still talking at the length limit') + return (10 * len(problems) + abs(np.log(max(ratio, 1e-3)))), problems + + +def trim(x): + f = RATE // 20; idx = np.flatnonzero(frames_on(x)) + if not len(idx): return x[:0] + y = x[max(0, idx[0] * f - RATE // 20):min(len(x), (idx[-1] + 1) * f + int(.12 * RATE))].copy() + f = min(len(y) // 2, RATE // 100) + y[:f] *= np.linspace(0, 1, f); y[len(y) - f:] *= np.linspace(1, 0, f) + return y + + +def loudness(x): + f = RATE // 20; n = len(x) // f + e = (x[:n * f].reshape(n, f) ** 2).mean(1); on = 10 * np.log10(e + 1e-12) > -45 + return float(np.sqrt(e[on].mean())) if on.any() else 0. + + +def join(pieces, texts): + ref = loudness(pieces[0]) or 1.; out = [] + for i, (y, t) in enumerate(zip(pieces, texts)): + level = loudness(y) + out.append(y * (min(2., max(.5, ref / level)) if level else 1.)) + if i < len(pieces) - 1: + pause = .35 if re.search(r'[.!?。!?]["\]]?\s*$', t) else .2 + out.append(np.zeros(int(pause * RATE), dtype=np.float32)) + return np.concatenate(out).astype(np.float32) + + +class Quiet: + def start(self, seconds): pass + + def finish(self, extra=0): pass + + def __call__(self, stage, step, total): pass + + +def _best_take(robin, text, voice, lang, seed, retries, progress, **kwargs): + best = None + for k in range(retries + 1): + progress.start(expected_seconds(text, lang)) + audio, _, info = robin.speak(text, voice, lang=lang, seed=seed + 7919 * k, callback=progress, **kwargs) + score, problems = check(audio, text, lang, info['capped']) + if best is None or score < best[0]: best = (score, problems, audio) + if not problems or k == retries: + progress.finish(); break + progress.finish(extra=1) + return best[2], best[1] + + +def read(robin, text, voice=None, *, reference=None, reference_rate=None, reference_text=None, seed=0, cfg=1., retries=2, max_words=35, + lang='en', as_written=False, progress=None, **sampling): + progress = progress or Quiet() + chunks = split(text, max_words, lang, as_written) + if not chunks: raise ValueError('There is no text to read.') + voice = (voice or '').strip() or None + ref = None if reference is None else (reference, reference_rate, (reference_text or '').strip() or None) + kept = [] + for i, chunk in enumerate(chunks): + audio, problems = _best_take(robin, chunk, voice, lang, seed + 1000 * i, retries, progress, cfg=cfg, + reference=ref[0] if ref else None, reference_rate=ref[1] if ref else None, + reference_text=ref[2] if ref else None, **sampling) + take = trim(audio) + kept.append(take) + if not problems and len(chunks) > 1 and len(take): + ref = (take, RATE, chunk) + return join(kept, chunks) + + +def change(robin, source, source_rate, source_text, *, reference=None, reference_rate=None, reference_text=None, voice=None, seed=0, + retries=2, lang='en', progress=None, **sampling): + progress = progress or Quiet() + voice = (voice or '').strip() or None + if not (source_text or '').strip(): raise ValueError('The source text must say exactly what the source clip says.') + if reference is None: + line = SAMPLE_LINES.get(lang, SAMPLE_LINE) + audio, _ = _best_take(robin, line, voice, lang, seed, retries, progress, **sampling) + reference, reference_rate, reference_text = trim(audio), RATE, line + seconds = len(source) / source_rate + target = stats(source, source_rate)['sound'] or seconds + best = None + for k in range(retries + 1): + progress.start(seconds) + audio, _, info = robin.convert(source, source_text.strip(), reference, reference_text=(reference_text or '').strip() or None, + source_rate=source_rate, reference_rate=reference_rate, description=voice, lang=lang, + seed=seed + 7919 * k, callback=progress, **sampling) + st = stats(audio); ratio = st['sound'] / max(target, .1) + problems = st['sound'] < .3 or not .5 <= ratio <= 2. or (info['capped'] and st['tail'] < .5) + score = 10 * problems + abs(np.log(max(ratio, 1e-3))) + if best is None or score < best[0]: best = (score, audio) + if not problems or k == retries: + progress.finish(); break + progress.finish(extra=1) + return best[1] diff --git a/package/robin/pipeline.py b/package/robin/pipeline.py new file mode 100644 index 0000000000000000000000000000000000000000..2a358958e38a03db07c4dd979c07e7f58ad88cf4 --- /dev/null +++ b/package/robin/pipeline.py @@ -0,0 +1,248 @@ +import json +import warnings +from pathlib import Path + +import numpy as np +import torch +from safetensors.torch import load_file +from tokenizers import Tokenizer + +from .model import Config, Planner, Decoder + +LANGS = dict(en='English', ja='Japanese', mix='English and Japanese') +WEIGHTS = 'robin_v1.safetensors' +VAE = 'robin_vae.safetensors' +SPEECH = 'speech_tokenizer_v3_25hz.onnx' +APOSTROPHES = str.maketrans(dict.fromkeys('\u2019\u2018\u201b\u02bc\uff07\u2032\u00b4`', "'")) + + +def plain(s): + return s.translate(APOSTROPHES) if s else s +FRAME_RATE, SAMPLE_RATE = 25, 48000 + + +class Cancelled(Exception): + pass + + +def prefix_mask(n, ss, device): + m = torch.full((n, n), float('-inf'), device=device).triu_(1) + m[:ss, :ss] = 0 + return m + + +class Robin: + def __init__(self, planner, decoder, vae, tokenizer, config, device): + self.planner, self.decoder, self.vae, self.tok, self.device = planner, decoder, vae, tokenizer, device + t = config['tokens'] + self.eod, self.score_start, self.score_end = t['eod'], t['score_start'], t['score_end'] + self.audio_start, self.audio_end, self.offset, self.codes = t['audio_start'], t['audio_end'], t['audio_offset'], t['audio_codes'] + self.instruction, self.defaults = config['instruction'], config['sampling'] + self._speech, self.lora, self.weights_file, self.vae_file = None, None, None, None + + @classmethod + def from_pretrained(cls, path, vae=None, device='cuda', dtype=torch.bfloat16, lora=None, lora_scale=1.0): + path = Path(path) + if not path.exists(): + from huggingface_hub import snapshot_download + path = Path(snapshot_download(str(path))) + if vae is None: + vae = path/VAE + if not vae.is_file(): + raise ValueError(f'VAE weights are required: put {VAE} in {path}, or pass vae=&":5789,"CON":5790,"Ġrepl":5791,"Ġregular":5792,"Storage":5793,"ramework":5794,"Ġgoal":5795,"Ġtouch":5796,".widget":5797,"Ġbuilt":5798,"des":5799,"Part":5800,"(re":5801,"Ġworth":5802,"hib":5803,"game":5804,"Ġв":5805,"acion":5806,"ĠWhite":5807,"(type":5808,"(`":5809,"Ġnatural":5810,"Ġinj":5811,"Ġcalcul":5812,"ĠApril":5813,".List":5814,"Ġassociated":5815,"ĉSystem":5816,"~~":5817,"=[":5818,"Ġstorage":5819,"Ġbytes":5820,"Ġtravel":5821,"Ġsou":5822,"Ġpassed":5823,"!=":5824,"ascript":5825,".open":5826,"Ġgrid":5827,"Ġbus":5828,"Ġrecogn":5829,"Ab":5830,"Ġhon":5831,"ĠCenter":5832,"Ġprec":5833,"build":5834,"HTML":5835,"ĠSan":5836,"Ġcountries":5837,"aled":5838,"token":5839,"kt":5840,"Ġqual":5841,"Last":5842,"adow":5843,"Ġmanufact":5844,"idad":5845,"jango":5846,"Next":5847,"xf":5848,".a":5849,"Ġporno":5850,"ĠPM":5851,"erve":5852,"iting":5853,"_th":5854,"ci":5855,"=None":5856,"gs":5857,"Ġlogin":5858,"atives":5859,"']);Ċ":5860,"Äħ":5861,"Ġill":5862,"IA":5863,"children":5864,"DO":5865,"Ġlevels":5866,"Ġ{{":5867,"Ġlooks":5868,"Ġ\"#":5869,"ToString":5870,"Ġnecessary":5871,"ĠĠĠĊ":5872,"cell":5873,"Entry":5874,"Ġ'#":5875,"Ġextrem":5876,"Selector":5877,"Ġplaceholder":5878,"Load":5879,"Ġreleased":5880,"ORE":5881,"Enumer":5882,"ĠTV":5883,"SET":5884,"inq":5885,"Press":5886,"ĠDepartment":5887,"Ġproperties":5888,"Ġrespond":5889,"Search":5890,"ael":5891,"Ġrequ":5892,"ĠBook":5893,"/Ċ":5894,"(st":5895,"Ġfinancial":5896,"icket":5897,"_input":5898,"Ġthreat":5899,"(in":5900,"Strip":5901,"ìĿ":5902,"ção":5903,"Ġevidence":5904,"));":5905,"ĠBro":5906,"Ġ[];Ċ":5907,"Ġou":5908,"buf":5909,"Script":5910,"dat":5911,"Ġrule":5912,"#import":5913,"=\"/":5914,"Serial":5915,"Ġstarting":5916,"[index":5917,"ae":5918,"Ġcontrib":5919,"session":5920,"_new":5921,"utable":5922,"ober":5923,"Ġ\"./":5924,"Ġlogger":5925,"Ġrecently":5926,"Ġreturned":5927,"ččĊ":5928,")))Ċ":5929,"itions":5930,"Ġseek":5931,"Ġcommunic":5932,"Ġ\".":5933,"Ġusername":5934,"ECT":5935,"DS":5936,"Ġotherwise":5937,"ĠGerman":5938,".aw":5939,"Adapter":5940,"ixel":5941,"Ġsystems":5942,"Ġdrop":5943,"Ġstructure":5944,"Ġ$(\"#":5945,"encies":5946,"anning":5947,"ĠLink":5948,"ĠResponse":5949,"Ġstri":5950,"ż":5951,"ĠDB":5952,"æĹ":5953,"android":5954,"submit":5955,"otion":5956,"(@":5957,".test":5958,"ĊĊĊĊĊĊĊĊ":5959,"];čĊ":5960,"Ġdirectly":5961,"Ġ\"%":5962,"ris":5963,"elta":5964,"AIL":5965,"){čĊ":5966,"mine":5967,"ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ":5968,"(k":5969,"bon":5970,"asic":5971,"pite":5972,"___":5973,"Max":5974,"Ġerrors":5975,"ĠWhile":5976,"Ġarguments":5977,"Ġensure":5978,"Right":5979,"-based":5980,"Web":5981,"Ġ-=":5982,"Ġintrodu":5983,"ĠInst":5984,"ĠWash":5985,"ordin":5986,"join":5987,"Database":5988,"Ġgrad":5989,"Ġusually":5990,"ITE":5991,"Props":5992,"?>Ċ":5993,"ĠGo":5994,"@Override":5995,"REF":5996,"Ġip":5997,"ĠAustral":5998,"Ġist":5999,"ViewById":6000,"Ġserious":6001,"Ġcustomer":6002,".prototype":6003,"odo":6004,"cor":6005,"Ġdoor":6006,"ĠWITHOUT":6007,"Ġplant":6008,"Ġbegan":6009,"Ġdistance":6010,"()).":6011,"Ġchance":6012,"Ġord":6013,"came":6014,"pragma":6015,"Ġprotect":6016,"ragment":6017,"ĠNode":6018,"ening":6019,"Ñĩ":6020,"Ġroute":6021,"ĠSchool":6022,"hi":6023,"Ġneighb":6024,"After":6025,"licit":6026,"Ġcontr":6027,"Ġprimary":6028,"AA":6029,".WriteLine":6030,"utils":6031,"Ġbi":6032,"Red":6033,".Linq":6034,".object":6035,"Ġleaders":6036,"unities":6037,"Ġgun":6038,"onth":6039,"ĠDev":6040,"FILE":6041,"Ġcomments":6042,"_len":6043,"arrow":6044,"amount":6045,"Range":6046,"sert":6047,"GridView":6048,"Ġupdated":6049,"ĠMo":6050,"Ġinform":6051,"ociety":6052,"ala":6053,"Access":6054,"Ġhab":6055,"Ġcreat":6056,"_arg":6057,"ĠJanuary":6058,"ĠDay":6059,"\")čĊ":6060,"uple":6061,"document":6062,"gorith":6063,"menu":6064,"ĠOver":6065,"bb":6066,".title":6067,"_out":6068,"Ġled":6069,"uri":6070,"Ġ?>":6071,"gl":6072,"Ġbank":6073,"ayment":6074,"ĉprintf":6075,"MD":6076,"Ġsample":6077,"Ġhands":6078,"ĠVersion":6079,"uario":6080,"Ġoffers":6081,"ityEngine":6082,"Ġshape":6083,"Ġsleep":6084,"_point":6085,"Settings":6086,"Ġachie":6087,"Ġsold":6088,"ota":6089,".bind":6090,"Am":6091,"Ġsafe":6092,"Store":6093,"Ġshared":6094,"Ġpriv":6095,"_VAL":6096,"Ġsens":6097,"){":6098,"Ġremember":6099,"shared":6100,"element":6101,"Ġshoot":6102,"Vert":6103,"cout":6104,"Ġenv":6105,"_label":6106,"Ġ>Ċ":6107,"run":6108,"Ġscene":6109,"(array":6110,"device":6111,"_title":6112,"agon":6113,"]čĊ":6114,"aby":6115,"Ġbecame":6116,"boolean":6117,"Ġpark":6118,"ĠCode":6119,"upload":6120,"riday":6121,"ĠSeptember":6122,"Fe":6123,"Ġsen":6124,"cing":6125,"FL":6126,"Col":6127,"uts":6128,"_page":6129,"inn":6130,"Ġimplied":6131,"aling":6132,"Ġyourself":6133,".Count":6134,"conf":6135,"Ġaud":6136,"_init":6137,".)":6138,"Ġwrote":6139,"NG":6140,".Error":6141,"ä»":6142,".for":6143,"Ġequal":6144,"ĠRequest":6145,"Ġserial":6146,"Ġallows":6147,"XX":6148,"Ġmiddle":6149,"chor":6150,"ø":6151,"erval":6152,".Column":6153,"reading":6154,"Ġescort":6155,"ĠAugust":6156,"Ġquickly":6157,"Ġweap":6158,"ĠCG":6159,"ropri":6160,"ho":6161,"Ġcop":6162,"(struct":6163,"ĠBig":6164,"Ġvs":6165,"Ġfrequ":6166,".Value":6167,"Ġactions":6168,"Ġproper":6169,"Ġinn":6170,"Ġobjects":6171,"Ġmatrix":6172,"avascript":6173,"Ġones":6174,".group":6175,"Ġgreen":6176,"Ġpaint":6177,"ools":6178,"ycl":6179,"encode":6180,"olt":6181,"comment":6182,".api":6183,"Dir":6184,"Ġune":6185,"izont":6186,".position":6187,"Ġdesigned":6188,"_val":6189,"avi":6190,"iring":6191,"tab":6192,"Ġlayer":6193,"Ġviews":6194,"Ġreve":6195,"rael":6196,"ĠON":6197,"rics":6198,"np":6199,"Ġcore":6200,"());čĊ":6201,"Main":6202,"Ġexpert":6203,"ĉĉčĊ":6204,"_en":6205,"Ġ/>":6206,"utter":6207,"IAL":6208,"ails":6209,"ĠKing":6210,"*/ĊĊ":6211,"ĠMet":6212,"_end":6213,"addr":6214,"ora":6215,"Ġir":6216,"Min":6217,"Ġsurpr":6218,"Ġrepe":6219,"Ġdirectory":6220,"PUT":6221,"-S":6222,"Ġelection":6223,"haps":6224,".pre":6225,"cm":6226,"Values":6227,"Ġ\"Ċ":6228,"column":6229,"ivil":6230,"Login":6231,"inue":6232,"Ġbeautiful":6233,"Ġsecret":6234,"(event":6235,"Ġchat":6236,"ums":6237,"Ġorigin":6238,"Ġeffects":6239,"Ġmanagement":6240,"illa":6241,"tk":6242,"Ġsetting":6243,"ĠCour":6244,"Ġmassage":6245,"ĉend":6246,"Ġhappy":6247,"Ġfinish":6248,"Ġcamera":6249,"ĠVer":6250,"ĠDemocr":6251,"ĠHer":6252,"(Q":6253,"cons":6254,"ita":6255,"Ġ'.":6256,"{}":6257,"ĉC":6258,"Ġstuff":6259,"Ġ:Ċ":6260,"ĠAR":6261,"Task":6262,"hidden":6263,"eros":6264,"IGN":6265,"atio":6266,"ĠHealth":6267,"olute":6268,"Enter":6269,"'>":6270,"ĠTwitter":6271,"ĠCounty":6272,"scribe":6273,"Ġ=>Ċ":6274,"Ġhy":6275,"fit":6276,"Ġmilitary":6277,"Ġsale":6278,"required":6279,"non":6280,"bootstrap":6281,"hold":6282,"rim":6283,"-old":6284,"ĠDown":6285,"Ġmention":6286,"contact":6287,"_group":6288,"oday":6289,"Ġtown":6290,"Ġsolution":6291,"uate":6292,"elling":6293,"]->":6294,"otes":6295,"ental":6296,"omen":6297,"ospital":6298,"ĠSup":6299,"_EN":6300,"Ġslow":6301,"SESSION":6302,"Ġblue":6303,"ago":6304,"Ġlives":6305,"Ġ^":6306,".un":6307,"inst":6308,"enge":6309,"Ġcustomers":6310,"Ġcast":6311,"udget":6312,"ï¼ģ":6313,"icens":6314,"Ġdetermin":6315,"Selected":6316,"_pl":6317,"ueue":6318,"Ġdark":6319,"//ĊĊ":6320,"si":6321,"thern":6322,"ĠJapan":6323,"/w":6324,"PU":6325,"ĠEast":6326,"ovie":6327,"Ġpackage":6328,"Ġnor":6329,"Ġapi":6330,"bot":6331,"\"];Ċ":6332,"_post":6333,"ulate":6334,"Ġclub":6335,"'));Ċ":6336,"Ġloop":6337,"PIO":6338,"ione":6339,"shot":6340,"Initial":6341,"Ġplayed":6342,"register":6343,"rought":6344,"_max":6345,"acement":6346,"match":6347,"raphics":6348,"AST":6349,"Ġexisting":6350,"Ġcomplex":6351,"DA":6352,".Ch":6353,".common":6354,"mo":6355,"Ġ'../../":6356,"ito":6357,"Ġanalysis":6358,"Ġdeliver":6359,"ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĊ":6360,"idx":6361,"Ãł":6362,"ongo":6363,"ĠEnglish":6364,"Ċ":9992,"_default":9993,"ĠDatabase":9994,"rep":9995,"ESS":9996,"nergy":9997,".Find":9998,"_mask":9999,"Ġrise":10000,"Ġkernel":10001,"::$":10002,".Q":10003,"Ġoffering":10004,"decl":10005,"ĠCS":10006,"Ġlisted":10007,"Ġmostly":10008,"enger":10009,"Ġblocks":10010,"olo":10011,"Ġgoverning":10012,"\\F":10013,"Ġconcent":10014,".getText":10015,"Ġmb":10016,"Ġoccurred":10017,"Ġchanging":10018,"Scene":10019,"_CODE":10020,"Beh":10021,"\"The":10022,"Ġtile":10023,"ĠAssociation":10024,"ĉP":10025,"alty":10026,"_ad":10027,"odies":10028,"iated":10029,"Ġprepared":10030,"possible":10031,"Ġmort":10032,"TEST":10033,"Ġignore":10034,"Ġcalc":10035,"Ġrs":10036,"ĠassertEquals":10037,"Ġsz":10038,"ĠTHIS":10039,".\"Ċ":10040,"Ġcanvas":10041,"java":10042,"Ġdut":10043,"VALID":10044,".sql":10045,".input":10046,"Ġaux":10047,"Sup":10048,"Ġartist":10049,"Vec":10050,"_TIME":10051,".stringify":10052,"etween":10053,"ĠCategory":10054,"Ġ[-":10055,"ĠDevExpress":10056,"ĠJul":10057,"Ġring":10058,".ed":10059,"YY":10060,"Let":10061,"TextField":10062,"Ġflat":10063,"_print":10064,"ĠOTHER":10065,"adian":10066,"Ġchecked":10067,"ele":10068,"Align":10069,"standing":10070,"Ġ[],":10071,"Ġlab":10072,"ucky":10073,"ĠChristmas":10074,"(image":10075,".module":10076,"Ġlots":10077,"Ġslightly":10078,"(final":10079,"erge":10080,"è¿":10081,"ĠPolice":10082,"ĠRight":10083,"Ġaward":10084,"ĠOS":10085,"Ġ{}ĊĊ":10086,"Ġptr":10087,"oves":10088,"icated":10089,"ем":10090,"Ġmanage":10091,"oliday":10092,"Amount":10093,"oolStrip":10094,"tbody":10095,"Nav":10096,"wrap":10097,"BB":10098,"Ġwatching":10099,"arios":10100,"Ġoptional":10101,"_K":10102,"ĠLicensed":10103,".Map":10104,"Timer":10105,"ĠAP":10106,"ĠRev":10107,"(o":10108,",c":10109,"umin":10110,"etailed":10111,"ĠHy":10112,"Ġblank":10113,"agger":10114,"ĠSelf":10115,"()[":10116,".make":10117,"earn":10118,"channel":10119,";Ċ":10133,"World":10134,"Ġpython":10135,"Ġlif":10136,"Ġtrav":10137,"Ġconven":10138,"company":10139,"ĠClub":10140,"Ver":10141,"Btn":10142,"Ġzone":10143,"products":10144,"ĠEduc":10145,"Ġverify":10146,"ĠMil":10147,"ono":10148,"]);ĊĊ":10149,"ENCE":10150,"Ġpacket":10151,"Ġcer":10152,"Ġenumer":10153,"Ġpars":10154,"formed":10155,"Ġoccup":10156,"tre":10157,"Ġexercise":10158,"Day":10159,"_sum":10160,"Ġasking":10161,"aption":10162,"Ġorders":10163,"Ġspending":10164,"ĠERR":10165,".Dis":10166,"ĠUtil":10167,"âĢľI":10168,"\\'":10169,"?)":10170,"/>Ċ":10171,"Ġemot":10172,"Ġinfluence":10173,"ĠAfrica":10174,"atters":10175,"Ùħ":10176,".session":10177,"Ġchief":10178,"ĉĉĉĉĉĉĉĉĉĉĉ":10179,"Ġtom":10180,"cluded":10181,"serial":10182,"_handler":10183,".Type":10184,"aped":10185,"Ġpolicies":10186,"-ex":10187,"-tr":10188,"blank":10189,"merce":10190,"Ġcoverage":10191,"Ġrc":10192,"_matrix":10193,"_box":10194,"Ġcharges":10195,"ĠBoston":10196,"Pe":10197,"Ġcircum":10198,"Ġfilled":10199,"Ġnorth":10200,"ictureBox":10201,"ĉres":10202,"è®":10203,"Ġtermin":10204,"Ġ[â̦":10205,"IRECT":10206,"Ġber":10207,"Ġ\"../../":10208,"retch":10209,".code":10210,"_col":10211,"ĠGovernment":10212,"Ġargv":10213,"ĠLord":10214,"asi":10215,"Exec":10216,"ĉlet":10217,"vertis":10218,"Ġdiscussion":10219,"enance":10220,"outube":10221,"typeof":10222,"Ġserved":10223,"ĠPut":10224,"ĉx":10225,"Ġsweet":10226,"Before":10227,"ategy":10228,".of":10229,"ĠMaterial":10230,"Sort":10231,"ONT":10232,"igital":10233,"Why":10234,"Ġsust":10235,"Ġç":10236,"abet":10237,"Ġsegment":10238,"Ġ[],Ċ":10239,"ĠMuslim":10240,"ĠfindViewById":10241,"cut":10242,"_TEXT":10243,"ĠMary":10244,"Ġloved":10245,"Ġlie":10246,"ĠJO":10247,"Ġisset":10248,"month":10249,"Ġprime":10250,"ti":10251,"ĠCarol":10252,"Use":10253,"ĠPop":10254,"ĠSave":10255,"Interval":10256,"execute":10257,"dy":10258,"ĠIran":10259,"_cont":10260,"ĉT":10261,"Ġphase":10262,"checkbox":10263,"week":10264,"Ġhide":10265,"Ġtil":10266,"Ġju":10267,"Custom":10268,"burg":10269,"/M":10270,"TON":10271,"Ġquant":10272,"Ġrub":10273,"ixels":10274,"Ġinstalled":10275,"Ġdump":10276,"Ġproperly":10277,"(List":10278,"Ġdecide":10279,"apply":10280,"Has":10281,"Ġkeeping":10282,"Ġcitizens":10283,"Ġjoint":10284,"pool":10285,"Socket":10286,"_op":10287,"Ġweapon":10288,"gnore":10289,"ĠExec":10290,"otten":10291,"ĠMS":10292,"Ġ(-":10293,"ĠReview":10294,"Ġexamples":10295,"Ġtight":10296,"!(":10297,"DP":10298,"ĠMessageBox":10299,"Ġphotograph":10300,"URI":10301,"ét":10302,"low":10303,"ĠGrand":10304,".persistence":10305,"Ġmaintain":10306,"Ġnums":10307,"Ġzip":10308,"ials":10309,"ĠGets":10310,"peg":10311,"ĠBuffer":10312,"~~~~":10313,"rastructure":10314,"ĠPL":10315,"uen":10316,"obby":10317,"sizeof":10318,"Ġpic":10319,"Ġseed":10320,"Ġexperienced":10321,"Ġodd":10322,"Ġkick":10323,"Ġprocedure":10324,"avigator":10325,"-on":10326,",j":10327,"ĠAlthough":10328,"ĠuserId":10329,"accept":10330,"Blue":10331,"IColor":10332,"layer":10333,"available":10334,"Ġends":10335,".table":10336,"Ġdataset":10337,"bus":10338,"Ġexplain":10339,"(pro":10340,"ĠCommittee":10341,"Ġnoted":10342,"]:Ċ":10343,"Dim":10344,"stdio":10345,".\",Ċ":10346,"_source":10347,"ĠWeek":10348,"ĠEdge":10349,"Ġoperating":10350,"Ġeste":10351,"ipl":10352,"agination":10353,"Ġproceed":10354,"Ġanimation":10355,".Models":10356,"ĠWatch":10357,"iat":10358,"Ġoppon":10359,"/A":10360,"Report":10361,"Ġsounds":10362,"_buf":10363,"IELD":10364,"Ġbund":10365,"ĉget":10366,".pr":10367,"(tmp":10368,"Ġkid":10369,">ĊĊĊ":10370,"Ġyang":10371,"NotFound":10372,"ÑĨ":10373,"math":10374,"@gmail":10375,"ĠLIMIT":10376,"redients":10377,"Ġvent":10378,"avigate":10379,"Look":10380,"Ġreligious":10381,"Ġrand":10382,"rio":10383,"(GL":10384,"_ip":10385,"uan":10386,"iciency":10387,"ĠChange":10388,">čĊčĊ":10389,"ĠEntity":10390,"Ġrencontre":10391,"ĠRet":10392,"plan":10393,"én":10394,"BOOL":10395,"uries":10396,"train":10397,"Definition":10398,"============":10399,"zz":10400,"Animation":10401,"ĠOK":10402,"_menu":10403,".bl":10404,"_score":10405,"Ġacad":10406,"(System":10407,"Ġrefresh":10408,"'=>$":10409,".Graphics":10410,"amento":10411,"pid":10412,"tc":10413,"Ġtips":10414,"Ġhomes":10415,"Ġfuel":10416,"âĸ":10417,"_helper":10418,"ĠĠčĊ":10419,"ĠRoom":10420,".Close":10421,"_attr":10422,"ĠMount":10423,"ĠEv":10424,"arser":10425,"_top":10426,"eah":10427,"ĠDelete":10428,"ãĢį":10429,"uke":10430,"Ġusage":10431,"aria":10432,"_dev":10433,"Ġtexture":10434,"Ġconversation":10435,"eper":10436,"Bean":10437,"done":10438,"nonatomic":10439,"ĠSecond":10440,"Ġshooting":10441,"_pre":10442,"Components":10443,"Ġ]ĊĊ":10444,"__,":10445,"stitution":10446,".Char":10447,">();ĊĊ":10448,"Ġpresented":10449,"Ġwa":10450,"oker":10451,"-ĊĊ":10452,"iner":10453,"Ġbecoming":10454,"Ġincident":10455,"Att":10456,"Ġrevealed":10457,"forc":10458,"Ġboot":10459,".page":10460,"Enumerator":10461,"_->":10462,"Photo":10463,"Ġspring":10464,".\",":10465,"ĠDictionary":10466,"BJECT":10467,"Ġlocations":10468,"Ġsamples":10469,"InputStream":10470,"ĠBrown":10471,"Ġstats":10472,"quality":10473,"Ñħ":10474,"-dis":10475,"Ġhelping":10476,"Ġped":10477,"(se":10478,"ĠWho":10479,"alian":10480,"internal":10481,"Ġft":10482,">().":10483,"->{":10484,"Ġmine":10485,"Ġsector":10486,"Ġgro":10487,"Ġopportunities":10488,"Ġü":10489,"Ġmp":10490,"Ġalleged":10491,"Ġdoubt":10492,"Mouse":10493,"About":10494,"_part":10495,"Ġchair":10496,"Ġstopped":10497,"loop":10498,"entities":10499,"Ġapps":10500,"ansion":10501,"Ġmental":10502,"ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ":10503,"FR":10504,"Ġdefend":10505,"care":10506,"Ġideal":10507,"/api":10508,"urface":10509,"Ġele":10510,"ulator":10511,"ĠRights":10512,"anguages":10513,"Ġfunds":10514,"Ġadapt":10515,"Attributes":10516,"Ġdeploy":10517,"opts":10518,"Ġvalidation":10519,"Ġconcerns":10520,"uce":10521,".num":10522,"ulture":10523,"ila":10524,"Ġcup":10525,"Ġpure":10526,".Fore":10527,"ĠHashMap":10528,".valueOf":10529,"asm":10530,"MO":10531,"Ġcs":10532,"Ġstores":10533,"Ġ************************************************************************":10534,"Ġcommunication":10535,"mem":10536,".EventHandler":10537,".Status":10538,"_right":10539,".setOn":10540,"Sheet":10541,"Ġidentify":10542,"enerated":10543,"ordered":10544,"Ġ\"[":10545,"Ġswe":10546,"Condition":10547,"ĠAccording":10548,"Ġprepare":10549,"Ġrob":10550,"Pool":10551,"Ġsport":10552,"rv":10553,"ĠRouter":10554,"Ġalternative":10555,"([]":10556,"ĠChicago":10557,"ipher":10558,"ische":10559,"ĠDirector":10560,"kl":10561,"ĠWil":10562,"keys":10563,"Ġmysql":10564,"Ġwelcome":10565,"king":10566,"ĠManager":10567,"Ġcaught":10568,")}Ċ":10569,"Score":10570,"_PR":10571,"Ġsurvey":10572,"hab":10573,"Headers":10574,"ADER":10575,"Ġdecor":10576,"Ġturns":10577,"Ġradius":10578,"errupt":10579,"Cor":10580,"Ġmel":10581,"Ġintr":10582,"(q":10583,"ĠAC":10584,"amos":10585,"MAX":10586,"ĠGrid":10587,"ĠJesus":10588,"ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ":10589,".DE":10590,"Ġts":10591,"Ġlinked":10592,"free":10593,"ĠQt":10594,"Ġ/**čĊ":10595,"Ġfaster":10596,"ctr":10597,"_J":10598,"DT":10599,".Check":10600,"Ġcombination":10601,"Ġintended":10602,"-the":10603,"-type":10604,"ectors":10605,"ami":10606,"uting":10607,"Ġuma":10608,"XML":10609,"UCT":10610,"Ap":10611,"ĠRandom":10612,"Ġran":10613,".sort":10614,"Ġsorted":10615,".Un":10616,"_PER":10617,"itory":10618,"Ġpriority":10619,"ĠGal":10620,"ĠOld":10621,"hot":10622,"ĠDisplay":10623,"(sub":10624,"_TH":10625,"_Y":10626,"ĠCare":10627,"loading":10628,"Kind":10629,"_handle":10630,",,":10631,"rase":10632,"_replace":10633,".addEventListener":10634,"ĠRT":10635,"Ġentered":10636,"gers":10637,"Ġich":10638,"(start":10639,"/app":10640,"Ġbrother":10641,"Memory":10642,"Outlet":10643,"Ġutf":10644,"prec":10645,"Ġnavigation":10646,"ORK":10647,"Ġdst":10648,"Detail":10649,"Ġaudience":10650,"Ġdur":10651,"Ġcluster":10652,"unched":10653,"Ġ],":10654,"Ġcomfortable":10655,".values":10656,"ĠTotal":10657,"Ġsnap":10658,"Ġstandards":10659,"Ġperformed":10660,"hand":10661,"(\"@":10662,"åŃ":10663,"Ġphil":10664,"ibr":10665,"trim":10666,"Ġforget":10667,"Ġdoctor":10668,".TextBox":10669,"icons":10670,",s":10671,"ĠOp":10672,"Sm":10673,"Stop":10674,"ĉList":10675,"ĉu":10676,"Comment":10677,"_VERSION":10678,".Xtra":10679,"Person":10680,"rb":10681,"LOB":10682,"ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĊ":10683,"ĠCentral":10684,"ICK":10685,"raq":10686,"Ġputting":10687,"Ġmd":10688,"ĠLove":10689,"Program":10690,"Border":10691,"oor":10692,"Ġallowing":10693,"after":10694,"Ġentries":10695,"ĠMaybe":10696,"]).":10697,"ĠShort":10698,")\\":10699,".now":10700,"friend":10701,"Ġprefer":10702,"ĠGPIO":10703,"osis":10704,"ĠGameObject":10705,"Ġskip":10706,"Ġcompetition":10707,"_match":10708,"lications":10709,"_CONT":10710,".groupBox":10711,"Ġals":10712,"\"We":10713,"_eq":10714,"lan":10715,"_search":10716,"ĠMusic":10717,"asis":10718,"Ġbind":10719,"ĠIsland":10720,"rum":10721,"(E":10722,"Ġseat":10723,"Video":10724,"Ġack":10725,"reek":10726,"={()":10727,"Ġrating":10728,"Ġrestaurant":10729,"DEX":10730,"(buf":10731,"pping":10732,"uality":10733,"Ġleague":10734,"Ġfocused":10735,"apon":10736,"$data":10737,"CLUD":10738,"CLUDING":10739,"Ġabsolute":10740,"(query":10741,"Ġtells":10742,"Ang":10743,"Ġcommunities":10744,"Ġhonest":10745,"oking":10746,"Ġapart":10747,"arity":10748,"/$":10749,"_module":10750,"ĠEnc":10751,".an":10752,".Config":10753,"Cre":10754,"Ġshock":10755,"ĠArab":10756,"IENT":10757,"/re":10758,"Ġretrie":10759,"ycler":10760,"isa":10761,"ĠOrgan":10762,".graph":10763,"Ġí":10764,"ĠBAS":10765,"Enum":10766,"Ġpossibly":10767,"ÑĢаÐ":10768,"ĠJapanese":10769,"Ġcraft":10770,"ĠPlace":10771,"Ġtalent":10772,"Ġfunding":10773,"Ġconfirmed":10774,"Ġcycle":10775,"/x":10776,"GE":10777,"Ġhearing":10778,"Ġplants":10779,"Ġmouth":10780,"pages":10781,"oria":10782,"ĠRemove":10783,"_total":10784,"Ġod":10785,"ollapse":10786,"door":10787,"Ġbought":10788,"Ġaddr":10789,"ARCH":10790,"_dim":10791,"dden":10792,"Ġdecades":10793,"REQUEST":10794,"Ġversions":10795,"fire":10796,"Ġmoves":10797,"fb":10798,"Ġcoffee":10799,".connect":10800,"ĠRow":10801,"Ġschema":10802,"Scope":10803,"-Type":10804,"Ġfighting":10805,"Ġretail":10806,"Ġmodified":10807,"TF":10808,"Files":10809,"nie":10810,"_command":10811,"stone":10812,"ĠÑĤ":10813,"_thread":10814,"Ġbond":10815,"ĠDevelopment":10816,"Ġpt":10817,"FORM":10818,"plet":10819,"Ġidentified":10820,"cpp":10821,"Ġcoding":10822,"oked":10823,"ĠMaster":10824,"IDTH":10825,"Ġresidents":10826,"redit":10827,"ĠPhoto":10828,"=-":10829,"unte":10830,"ateur":10831,"_STATE":10832,"ĠSing":10833,"Ġsheet":10834,".val":10835,"orse":10836,"Ġhers":10837,"Ġdetermined":10838,"Common":10839,"Ġwed":10840,"_queue":10841,"PH":10842,"ĠAtl":10843,"cred":10844,"/LICENSE":10845,"Ġmes":10846,"Ġadvanced":10847,".java":10848,".Sh":10849,"Go":10850,"kill":10851,"fp":10852,"_settings":10853,"Ġpal":10854,"Ġtruck":10855,"Ġcombined":10856,"Ġ\"${":10857,"ĠCorpor":10858,"Ġjoined":10859,"ĠJose":10860,"ĠCup":10861,"uns":10862,"estival":10863,"levision":10864,"Ġbroken":10865,"Ġmarriage":10866,"ĠWestern":10867,"Ġrepresents":10868,"ĠTitle":10869,"Ġss":10870,".Ass":10871,"ongoose":10872,"iento":10873,"<>();Ċ":10874,"Ġabsolutely":10875,"Ġsmooth":10876,"TERN":10877,"ĠUnless":10878,"Word":10879,"Ġmerge":10880,"igan":10881,"ĠVol":10882,"Ġnn":10883,".getId":10884,"Ġз":10885,"Ġsexy":10886,"Ġseeking":10887,"Single":10888,".this":10889,"Ġkom":10890,"bound":10891,";\"":10892,"ĠfontSize":10893,"_df":10894,"Ġinjury":10895,"(H":10896,"Ġissued":10897,"_END":10898,":self":10899,"Ġpatch":10900,"Ġleaves":10901,"Ġadopt":10902,"FileName":10903,"ãĢIJ":10904,"Ġexecutive":10905,"ĠByte":10906,"]))Ċ":10907,"Ġnu":10908,"outing":10909,"cluding":10910,"-R":10911,".options":10912,"Ġsubstant":10913,"avax":10914,"ĠBUT":10915,"Ġtechnical":10916,"Ġtwice":10917,"Ġmás":10918,"Ġunivers":10919,"yr":10920,"Ġdrag":10921,"ĠDC":10922,"Ġsed":10923,"Ġbot":10924,"ĠPal":10925,"ĠHall":10926,"forcement":10927,"Ġauch":10928,".mod":10929,"notation":10930,"_files":10931,".line":10932,"_flag":10933,"[name":10934,"Ġresolution":10935,"Ġbott":10936,"(\"[":10937,"ende":10938,"(arr":10939,"Free":10940,"(@\"":10941,"ĠDistrict":10942,"PEC":10943,":-":10944,"Picker":10945,"ĠJo":10946,"ĠĠĠĠĠĊ":10947,"ĠRiver":10948,"_rows":10949,"Ġhelpful":10950,"Ġmassive":10951,"---Ċ":10952,"Ġmeasures":10953,"ĠRuntime":10954,"Ġworry":10955,"ĠSpec":10956,"ĉD":10957,"ãĢij":10958,"Ġ){Ċ":10959,"Ġworse":10960,"(filename":10961,"Ġlay":10962,"Ġmagic":10963,"ĠTheir":10964,"oul":10965,"stroy":10966,"ĠWhere":10967,"Ġsudden":10968,"Ġdefe":10969,"Ġbinding":10970,"Ġflight":10971,"ĠOnInit":10972,"ĠWomen":10973,"ĠPolicy":10974,"Ġdrugs":10975,"ishing":10976,"('../":10977,"ĠMel":10978,"peat":10979,"tor":10980,"Ġproposed":10981,"Ġstated":10982,"_RES":10983,"Ġeast":10984,"ĠCONDITION":10985,"_desc":10986,"Ġwinning":10987,"folio":10988,"Mapper":10989,"ĠPan":10990,"ĠAnge":10991,".servlet":10992,"Ġcopies":10993,"LM":10994,"Ġvm":10995,"åį":10996,"Ġdictionary":10997,"Seg":10998,"elines":10999,"ĠSend":11000,"Ġiron":11001,"ĠFort":11002,".domain":11003,"Ġdebate":11004,"NotNull":11005,"eq":11006,"acher":11007,"lf":11008,"ĉfmt":11009,"Ġlawy":11010,"ÄŁ":11011,"ĠMen":11012,"Ġtrim":11013,"(NULL":11014,"Ġ!!":11015,"Ġpad":11016,"Ġfollows":11017,"\"][\"":11018,"requ":11019,"ĠEp":11020,".github":11021,"(img":11022,"eto":11023,"('\\":11024,"Services":11025,"umbnail":11026,"_main":11027,"pleted":11028,"fortunately":11029,"Ġwindows":11030,"Ġplane":11031,"ĠConnection":11032,".local":11033,"uard":11034,"}\\":11035,"==\"":11036,"andon":11037,"ĠRoy":11038,"west":11039,"iginal":11040,"emies":11041,"itz":11042,"'):Ċ":11043,"ĠPeter":11044,"Ġtough":11045,"Ġreduced":11046,"Ġcalculate":11047,"Ġrapid":11048,"customer":11049,"Ġefficient":11050,"Ġmedium":11051,"Ġfell":11052,".ref":11053,"ĠCas":11054,"Ġfeedback":11055,"Speed":11056,"(output":11057,"aje":11058,"Ġcategories":11059,"Ġfee":11060,"};":11061,"Ġdeleted":11062,"reh":11063,"Ġproof":11064,"Desc":11065,"Build":11066,"Ġsides":11067,".ArrayList":11068,"-%":11069,"ĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ":11070,"ر":11071,".match":11072,"ли":11073,"Ġfeels":11074,"Ġachieve":11075,"Ġclim":11076,"_ON":11077,"ĠCD":11078,"Ġteacher":11079,"_current":11080,"bn":11081,"_PL":11082,"isting":11083,"Enable":11084,"GEN":11085,"Ġtv":11086,"Ġsock":11087,"Ġplays":11088,"Ġdiscount":11089,"ĠKE":11090,"ĠDebug":11091,"Fore":11092,"ĠIraq":11093,"Ġappearance":11094,"Mon":11095,"Ġstyled":11096,"ĠHuman":11097,"iot":11098,"ĠHistory":11099,"Ġsac":11100,"ĠCollection":11101,"Ġrecommended":11102,".Selected":11103,"Ġorganizations":11104,"Ġdiscovered":11105,"cohol":11106,"adas":11107,"ĠThomas":11108,"May":11109,"Ġconserv":11110,"Ġdomin":11111,"ĠFollow":11112,"ĠSection":11113,"ĠThanks":11114,"Username":11115,"Ġrecipe":11116,"Ġwonderful":11117,".sleep":11118,"_if":11119,"ĉĊĉĊ":11120,"orno":11121,"Ġru":11122,"_target":11123,".\"\"":11124,"à¦":11125,"EventArgs":11126,"Ġinputs":11127,"Ġfif":11128,"Ġvision":11129,"cy":11130,"ĠSeries":11131,")(((":11132,"Ġtrading":11133,"Ġmarker":11134,"Begin":11135,"Ġtypically":11136,"Ġcauses":11137,"dropdown":11138,"_DEBUG":11139,"Ġdetect":11140,"country":11141,"!\");Ċ":11142,"ĉR":11143,"appy":11144,"Ġcref":11145,"('<":11146,"\"=>":11147,"ĠLE":11148,"reader":11149,"Ġadministr":11150,"õ":11151,"ucket":11152,"Ġfashion":11153,".char":11154,"izar":11155,"Ġdisable":11156,"Ġsuc":11157,"ĠLive":11158,"issue":11159,"Ġmetadata":11160,"flags":11161,"ĠðŁ":11162,"Ġcommitted":11163,"Ġva":11164,"Ġrough":11165,"Ġ'''Ċ":11166,"Ġhighlight":11167,"_vars":11168,"VO":11169,"Ġencoding":11170,"-Z":11171,"_sign":11172,"$(\"#":11173,"Ġrain":11174,"reatest":11175,"ĠEND":11176,"Selection":11177,"Ġcandidates":11178,"Ġsav":11179,".Empty":11180,"Ġdecisions":11181,"Ġcollabor":11182,"ridge":11183,"feed":11184,"ression":11185,"Ġpersons":11186,"VM":11187,"ega":11188,"_BIT":11189,"According":11190,"acked":11191,"Ġdollars":11192,"_loss":11193,"ĠCost":11194,"}\"Ċ":11195,"Notification":11196,"Ġprostit":11197,"Ġauthority":11198,".rec":11199,"Ġspokes":11200,"ĠToday":11201,"istant":11202,"ĠHead":11203,"âĢĿ.":11204,"ertainment":11205,"cean":11206,"culate":11207,"Ġven":11208,"However":11209,"_arr":11210,"Ġtokens":11211,"Graph":11212,"ĠJud":11213,"ĠVirgin":11214,"ĠSerial":11215,"unning":11216,"Mutable":11217,"agers":11218,".csv":11219,"Ġdeveloping":11220,"Ġinstructions":11221,"Ġpromise":11222,"Ġrequested":11223,"_encode":11224,"/\"":11225,"ĠIcon":11226,"uilt":11227,"-day":11228,"Ġintelligence":11229,".IS":11230,"ĠObservable":11231,"ĠHard":11232,"Bool":11233,"idential":11234,".Anchor":11235,"Ġselling":11236,"CI":11237,"AGES":11238,"tle":11239,"bur":11240,"UFFER":11241,"RY":11242,"Ġbigger":11243,"Ġrat":11244,"Ġfamous":11245,"Ġtypename":11246,"Ġexplained":11247,"}}Ċ":11248,"Ġnuclear":11249,"-N":11250,"Ġcrisis":11251,"ĠEnter":11252,"Ġanswers":11253,"/${":11254,"/pl":11255,"Ġsequ":11256,"_next":11257,"mask":11258,"Ġstanding":11259,"Ġplenty":11260,"ĠCross":11261,"ĉret":11262,"dro":11263,"ĠCast":11264,"=true":11265,"ĠChris":11266,"icio":11267,"ĠMike":11268,"Decimal":11269,"addComponent":11270,"Len":11271,"Ġcock":11272,"Ġ#{":11273,"URN":11274,"":11403,"Ġ*=":11404,"ĠPS":11405,"Ġdangerous":11406,"[p":11407,"OME":11408,"Other":11409,"ĠStringBuilder":11410,"Points":11411,"heading":11412,"Ġcurrency":11413,"Ġpercentage":11414,"_API":11415,"Ġclassic":11416,"thead":11417,"ĠMO":11418,"FE":11419,"Idx":11420,"await":11421,"Ġè":11422,"Ġaccident":11423,"Ġvariant":11424,"Ġmyst":11425,"ĠLand":11426,"ĠBre":11427,"Ġharm":11428,"ĠAcc":11429,"Ġcharged":11430,"iones":11431,"Visibility":11432,"arry":11433,"ĠLanguage":11434,"Ġwalking":11435,"\".ĊĊ":11436,"ifer":11437,"Ġleadership":11438,".From":11439,"ynam":11440,"Ġtimestamp":11441,"ipt":11442,"ĠHas":11443,"REFER":11444,"ĠIts":11445,"Ġlistener":11446,"UTE":11447,"_description":11448,"Ġexperiences":11449,"Ġcreates":11450,"RS":11451,"cart":11452,"black":11453,"Ġchoices":11454,"war":11455,"Ġ'''":11456,"Ġordered":11457,"Ġevening":11458,"Ġpil":11459,"Ġtun":11460,"ĠBad":11461,"(app":11462,"random":11463,"Ġexplicit":11464,"Ġarrived":11465,"Ġfly":11466,"Ġeconom":11467,"-mail":11468,"Ġlists":11469,"Ġarchitect":11470,"ĠPay":11471,"Ġds":11472,"ĠSol":11473,"Ġvehicles":11474,"Hz":11475,"-com":11476,"Ġking":11477,"_equal":11478,"ĠHelp":11479,"Ġabuse":11480,"--;Ċ":11481,"Ġextr":11482,"Ġchemical":11483,"ä¿":11484,"Ġorient":11485,"Ġbreath":11486,"ĠSpace":11487,"(element":11488,"wait":11489,"DED":11490,"igma":11491,"Ġentr":11492,"Ġsob":11493,"-name":11494,"Ġaffected":11495,"ika":11496,"Ġcoal":11497,"_work":11498,"Ġhundreds":11499,"Ġpolitics":11500,"subject":11501,"Ġconsumer":11502,"ANGE":11503,"Ġrepeated":11504,"Send":11505,"Ġ#[":11506,"Ġprotocol":11507,"Ġleads":11508,"useum":11509,"Every":11510,"Import":11511,"(count":11512,"Ġchallenges":11513,"Ġnovel":11514,"Ġdepart":11515,"bits":11516,".Current":11517,"Ġ`${":11518,"oting":11519,"(\\":11520,"Ġcreative":11521,"Ġbuff":11522,"Ġintroduced":11523,"usic":11524,"modules":11525,"Are":11526,"-doc":11527,"language":11528,"_cache":11529,"Ġtod":11530,"?>":11531,"omething":11532,"Ġhun":11533,"åº":11534,"aters":11535,"Intent":11536,"Ġimplemented":11537,"ĠCase":11538,"Children":11539,"Ġnotification":11540,"Renderer":11541,"Wrapper":11542,"Objects":11543,"tl":11544,".Contains":11545,"Plugin":11546,".row":11547,"Ġforg":11548,"Ġpermit":11549,"Ġtargets":11550,"ĠIF":11551,"Ġtip":11552,"sex":11553,"Ġsupports":11554,"Ġfold":11555,"photo":11556,"},čĊ":11557,"Ġgoogle":11558,"$('#":11559,"Ġsharing":11560,"Ġgoods":11561,"vs":11562,"ĠDan":11563,"Rate":11564,"ĠMartin":11565,"Ġmanner":11566,"lie":11567,".The":11568,"Internal":11569,"ĠCONTR":11570,"Mock":11571,"RIGHT":11572,"Ġ'{":11573,"Ġcontrols":11574,"Mat":11575,"Ġmand":11576,"Ġextended":11577,"Ok":11578,"Ġembed":11579,"Ġplanet":11580,"ĠNon":11581,"-ch":11582,")\",":11583,"epar":11584,"Ġbelieved":11585,"ĠEnvironment":11586,"ĠFriend":11587,"-res":11588,"Ġhandling":11589,"nic":11590,"-level":11591,"scri":11592,"Xml":11593,"BE":11594,"ungen":11595,"Ġalter":11596,"[idx":11597,"Pop":11598,"cam":11599,"Ġ(((":11600,"Ġshipping":11601,"Ġbattery":11602,"iddleware":11603,"MC":11604,"Ġimpl":11605,"otation":11606,"ĠLab":11607,"