Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dcc:itsol:whisper:scripts [2024/08/12 10:15] – fixed spacing in the "Specialized scripts" section giulio | dcc:itsol:whisper:scripts [2025/09/10 13:40] (current) – Minor text changes alba | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== Building the scripts ===== | ===== Building the scripts ===== | ||
- | We will **run Whisper using a script** in order to facilitate the use of the tool. Follow the steps here to set up the script and run it, read the next section of the guide to learn more about the content of the script file itself. | + | We will **run Whisper using a script** in order to facilitate the use of the tool. Follow the steps here to set up the script and run it. Read the next section of the guide to learn more about the content of the script file itself. |
In order to run the script, you will first have to create it. Open your text editor of choice and copy the highlighted code below into the new file. Save the file with the name: | In order to run the script, you will first have to create it. Open your text editor of choice and copy the highlighted code below into the new file. Save the file with the name: | ||
+ | |||
+ | **Note:** The PyTorch module needed to install Whisper has changed due to an update in the dependencies of Whisper. The module displayed in the screenshots is the previous version. Please make sure to **use the version of the module you find in the text**. | ||
Line 11: | Line 13: | ||
---- | ---- | ||
+ | < | ||
+ | #!/bin/bash | ||
+ | #SBATCH --time=08: | ||
+ | #SBATCH --gpus-per-node=1 | ||
+ | #SBATCH --mem=16000 | ||
- | ''# | + | module load PyTorch/2.1.2-foss-2023a-CUDA-12.1.1 |
- | + | source $HOME/ | |
- | ''# | + | whisper $HOME/ |
- | + | </ | |
- | ''# | + | |
- | + | ||
- | ''# | + | |
- | + | ||
- | \\ | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | '' | + | |
---- | ---- | ||
Line 35: | Line 30: | ||
The example below uses the '' | The example below uses the '' | ||
- | * Type or copy '' | + | * Type or copy '' |
- | * Press the " | + | * Press the " |
- | * Click on the terminal with the mouse wheel to paste the content of the script into the file. If you see the message in the figure displayed, click " | + | * Copy the content of the script from the top of this section, then click on the terminal with the mouse wheel to paste the content of the script into the file you just opened. |
* Double-check that the content of the script is correct. If it is, it should look exactly like in the picture below. | * Double-check that the content of the script is correct. If it is, it should look exactly like in the picture below. | ||
- | * **Note**: The colors displayed are also important, because | + | * **Note**: The colors displayed are also important, because |
- | * Finally, to save the file and exit from '' | + | * Finally, to save the file and exit from '' |
- | * If you want to make sure that the script has been saved, type '' | + | * If you want to make sure that the script has been saved, type '' |
==== Content of the batch script ==== | ==== Content of the batch script ==== | ||
Line 62: | Line 57: | ||
* ''# | * ''# | ||
- | This line tells the cluster that the script is asking for 1 GPU to be allocated to this job. For Whisper, 1 GPU is more than enough to run the transcription, please | + | This line tells the cluster that the script is asking for 1 GPU to be allocated to this job. For Whisper, 1 GPU is more than enough to run the transcription. Please |
* ''# | * ''# | ||
- | This line specifies the amount of Memory/ | + | This line specifies the amount of Memory/ |
\\ | \\ | ||
Line 72: | Line 67: | ||
The next two lines make sure that the virtual environment and the dependencies that Whisper needs to run are correctly loaded: | The next two lines make sure that the virtual environment and the dependencies that Whisper needs to run are correctly loaded: | ||
- | * '' | + | * '' |
- | This line loads the program packages that Whisper needs to run. Please be sure to not modify it, otherwise the script is not going to load the correct dependencies. | + | This line loads the program packages that Whisper needs to run. Please be sure not to modify it; otherwise, the script is not going to load the correct dependencies. |
* '' | * '' | ||
Line 98: | Line 93: | ||
=== Forced English === | === Forced English === | ||
- | This script forces Whisper to transcribe the audio into English. Use this script if the automatic language detection results in the wrong language (i.e. a strong English accent being recognized as Welsh, instead of English). The same concept works for other supported languages, for example Dutch. To change which language is forced, simply substitute the string '' | + | This script forces Whisper to transcribe the audio into English. Use this script if the automatic language detection results in the wrong language (i.e., a strong English accent being recognized as Welsh, instead of English). The same concept works for other supported languages, for example, Dutch. To change which language is forced, simply substitute the string '' |
- | When you save the script, you can call it '' | + | When you save the script, you can call it '' |
++++ Click to display the script | | ++++ Click to display the script | | ||
+ | < | ||
+ | #!/bin/bash | ||
+ | #SBATCH --time=08: | ||
+ | #SBATCH --gpus-per-node=1 | ||
+ | #SBATCH --mem=16000 | ||
- | ''# | + | module load PyTorch/2.1.2-foss-2023a-CUDA-12.1.1 |
- | + | source $HOME/ | |
- | ''# | + | whisper $HOME/ |
- | + | </ | |
- | ''# | + | |
- | + | ||
- | ''# | + | |
- | + | ||
- | \\ | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | '' | + | |
++++ | ++++ | ||
\\ | \\ | ||
=== Translate instead of transcribe === | === Translate instead of transcribe === | ||
- | Whisper is also capable of translating any X language into English. To let the program know that you wish to see a translation instead of a transcription, | + | Whisper is also capable of translating any X language into English. To let the program know that you wish to see a translation instead of a transcription, |
- | **Note**: Regardless of whether you run the transcription or the translation first, the file names of the output files will be the exact same. In order for the second operation (translation or transcription) | + | When you save the script, you can call it '' |
+ | |||
+ | **Note**: Regardless of whether you run the transcription or the translation first, the file names of the output files will be the exact same. For the second operation (translation or transcription) not to overwrite the first, you need to rename the output files before you run the second operation. In this way, the output of your first operation will remain untouched by the second operation. | ||
++++ Click to display the script | | ++++ Click to display the script | | ||
+ | < | ||
+ | #!/bin/bash | ||
+ | #SBATCH --time=08: | ||
+ | #SBATCH --gpus-per-node=1 | ||
+ | #SBATCH --mem=16000 | ||
- | ''# | + | module load PyTorch/2.1.2-foss-2023a-CUDA-12.1.1 |
- | + | source $HOME/ | |
- | ''# | + | whisper $HOME/ |
- | + | </ | |
- | ''# | + | |
- | + | ||
- | ''# | + | |
- | + | ||
- | \\ | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | '' | + | |
- | + | ||
- | '' | + | |
++++ | ++++ | ||