techguytfs/voice_clone
0
1<!---2Copyright 2020 The HuggingFace Team. All rights reserved.3Licensed under the Apache License, Version 2.0 (the "License");4you may not use this file except in compliance with the License.5You may obtain a copy of the License at6 7 http://www.apache.org/licenses/LICENSE-2.08 9Unless required by applicable law or agreed to in writing, software10distributed under the License is distributed on an "AS IS" BASIS,11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12See the License for the specific language governing permissions and13limitations under the License.14-->15 16# Examples17 18We host a wide range of example scripts for multiple learning frameworks. Simply choose your favorite: [TensorFlow](https://github.com/huggingface/transformers/tree/main/examples/tensorflow), [PyTorch](https://github.com/huggingface/transformers/tree/main/examples/pytorch) or [JAX/Flax](https://github.com/huggingface/transformers/tree/main/examples/flax).19 20We also have some [research projects](https://github.com/huggingface/transformers/tree/main/examples/research_projects), as well as some [legacy examples](https://github.com/huggingface/transformers/tree/main/examples/legacy). Note that unlike the main examples these are not actively maintained, and may require specific older versions of dependencies in order to run. 21 22While we strive to present as many use cases as possible, the example scripts are just that - examples. It is expected that they won't work out-of-the-box on your specific problem and that you will be required to change a few lines of code to adapt them to your needs. To help you with that, most of the examples fully expose the preprocessing of the data, allowing you to tweak and edit them as required.23 24Please discuss on the [forum](https://discuss.huggingface.co/) or in an [issue](https://github.com/huggingface/transformers/issues) a feature you would like to implement in an example before submitting a PR; we welcome bug fixes, but since we want to keep the examples as simple as possible it's unlikely that we will merge a pull request adding more functionality at the cost of readability.25 26## Important note27 28**Important**29 30To make sure you can successfully run the latest versions of the example scripts, you have to **install the library from source** and install some example-specific requirements. To do this, execute the following steps in a new virtual environment:31```bash32git clone https://github.com/huggingface/transformers33cd transformers34pip install .35```36Then cd in the example folder of your choice and run37```bash38pip install -r requirements.txt39```40 41To browse the examples corresponding to released versions of ๐ค Transformers, click on the line below and then on your desired version of the library:42 43<details>44 <summary>Examples for older versions of ๐ค Transformers</summary>45 <ul>46 <li><a href="https://github.com/huggingface/transformers/tree/v4.21.0/examples">v4.21.0</a></li>47 <li><a href="https://github.com/huggingface/transformers/tree/v4.20.1/examples">v4.20.1</a></li>48 <li><a href="https://github.com/huggingface/transformers/tree/v4.19.4/examples">v4.19.4</a></li>49 <li><a href="https://github.com/huggingface/transformers/tree/v4.18.0/examples">v4.18.0</a></li>50 <li><a href="https://github.com/huggingface/transformers/tree/v4.17.0/examples">v4.17.0</a></li>51 <li><a href="https://github.com/huggingface/transformers/tree/v4.16.2/examples">v4.16.2</a></li>52 <li><a href="https://github.com/huggingface/transformers/tree/v4.15.0/examples">v4.15.0</a></li>53 <li><a href="https://github.com/huggingface/transformers/tree/v4.14.1/examples">v4.14.1</a></li>54 <li><a href="https://github.com/huggingface/transformers/tree/v4.13.0/examples">v4.13.0</a></li>55 <li><a href="https://github.com/huggingface/transformers/tree/v4.12.5/examples">v4.12.5</a></li>56 <li><a href="https://github.com/huggingface/transformers/tree/v4.11.3/examples">v4.11.3</a></li>57 <li><a href="https://github.com/huggingface/transformers/tree/v4.10.3/examples">v4.10.3</a></li>58 <li><a href="https://github.com/huggingface/transformers/tree/v4.9.2/examples">v4.9.2</a></li>59 <li><a href="https://github.com/huggingface/transformers/tree/v4.8.2/examples">v4.8.2</a></li>60 <li><a href="https://github.com/huggingface/transformers/tree/v4.7.0/examples">v4.7.0</a></li>61 <li><a href="https://github.com/huggingface/transformers/tree/v4.6.1/examples">v4.6.1</a></li>62 <li><a href="https://github.com/huggingface/transformers/tree/v4.5.1/examples">v4.5.1</a></li>63 <li><a href="https://github.com/huggingface/transformers/tree/v4.4.2/examples">v4.4.2</a></li>64 <li><a href="https://github.com/huggingface/transformers/tree/v4.3.3/examples">v4.3.3</a></li>65 <li><a href="https://github.com/huggingface/transformers/tree/v4.2.2/examples">v4.2.2</a></li>66 <li><a href="https://github.com/huggingface/transformers/tree/v4.1.1/examples">v4.1.1</a></li>67 <li><a href="https://github.com/huggingface/transformers/tree/v4.0.1/examples">v4.0.1</a></li>68 <li><a href="https://github.com/huggingface/transformers/tree/v3.5.1/examples">v3.5.1</a></li>69 <li><a href="https://github.com/huggingface/transformers/tree/v3.4.0/examples">v3.4.0</a></li>70 <li><a href="https://github.com/huggingface/transformers/tree/v3.3.1/examples">v3.3.1</a></li>71 <li><a href="https://github.com/huggingface/transformers/tree/v3.2.0/examples">v3.2.0</a></li>72 <li><a href="https://github.com/huggingface/transformers/tree/v3.1.0/examples">v3.1.0</a></li>73 <li><a href="https://github.com/huggingface/transformers/tree/v3.0.2/examples">v3.0.2</a></li>74 <li><a href="https://github.com/huggingface/transformers/tree/v2.11.0/examples">v2.11.0</a></li>75 <li><a href="https://github.com/huggingface/transformers/tree/v2.10.0/examples">v2.10.0</a></li>76 <li><a href="https://github.com/huggingface/transformers/tree/v2.9.1/examples">v2.9.1</a></li>77 <li><a href="https://github.com/huggingface/transformers/tree/v2.8.0/examples">v2.8.0</a></li>78 <li><a href="https://github.com/huggingface/transformers/tree/v2.7.0/examples">v2.7.0</a></li>79 <li><a href="https://github.com/huggingface/transformers/tree/v2.6.0/examples">v2.6.0</a></li>80 <li><a href="https://github.com/huggingface/transformers/tree/v2.5.1/examples">v2.5.1</a></li>81 <li><a href="https://github.com/huggingface/transformers/tree/v2.4.0/examples">v2.4.0</a></li>82 <li><a href="https://github.com/huggingface/transformers/tree/v2.3.0/examples">v2.3.0</a></li>83 <li><a href="https://github.com/huggingface/transformers/tree/v2.2.0/examples">v2.2.0</a></li>84 <li><a href="https://github.com/huggingface/transformers/tree/v2.1.0/examples">v2.1.1</a></li>85 <li><a href="https://github.com/huggingface/transformers/tree/v2.0.0/examples">v2.0.0</a></li>86 <li><a href="https://github.com/huggingface/transformers/tree/v1.2.0/examples">v1.2.0</a></li>87 <li><a href="https://github.com/huggingface/transformers/tree/v1.1.0/examples">v1.1.0</a></li>88 <li><a href="https://github.com/huggingface/transformers/tree/v1.0.0/examples">v1.0.0</a></li>89 </ul>90</details>91 92Alternatively, you can switch your cloned ๐ค Transformers to a specific version (for instance with v3.5.1) with93```bash94git checkout tags/v3.5.195```96and run the example command as usual afterward.97 98## Running the Examples on Remote Hardware with Auto-Setup99 100[run_on_remote.py](./run_on_remote.py) is a script that launches any example on remote self-hosted hardware, 101with automatic hardware and environment setup. It uses [Runhouse](https://github.com/run-house/runhouse) to launch 102on self-hosted hardware (e.g. in your own cloud account or on-premise cluster) but there are other options 103for running remotely as well. You can easily customize the example used, command line arguments, dependencies, 104and type of compute hardware, and then run the script to automatically launch the example.105 106You can refer to 107[hardware setup](https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup)108for more information about hardware and dependency setup with Runhouse, or this109[Colab tutorial](https://colab.research.google.com/drive/1sh_aNQzJX5BKAdNeXthTNGxKz7sM9VPc) for a more in-depth 110walkthrough.111 112You can run the script with the following commands:113 114```bash115# First install runhouse:116pip install runhouse117 118# For an on-demand V100 with whichever cloud provider you have configured:119python run_on_remote.py \120 --example pytorch/text-generation/run_generation.py \121 --model_type=gpt2 \122 --model_name_or_path=gpt2 \123 --prompt "I am a language model and"124 125# For byo (bring your own) cluster:126python run_on_remote.py --host <cluster_ip> --user <ssh_user> --key_path <ssh_key_path> \127 --example <example> <args>128 129# For on-demand instances130python run_on_remote.py --instance <instance> --provider <provider> \131 --example <example> <args>132```133 134You can also adapt the script to your own needs.135 