init
Browse files- download_text.py → download_s2t_metadata.py +5 -3
- main_s2t.sh +32 -29
download_text.py → download_s2t_metadata.py
RENAMED
|
@@ -11,8 +11,10 @@ from typing import Optional
|
|
| 11 |
|
| 12 |
import pandas as pd
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
| 16 |
filename = os.path.basename(url)
|
| 17 |
subprocess.run(["wget", url, "-O", filename])
|
| 18 |
df = pd.read_csv(filename, sep='\t', header=None, dtype=str)
|
|
@@ -25,7 +27,7 @@ start = 0
|
|
| 25 |
end = batch_size
|
| 26 |
index = 1
|
| 27 |
while start != end:
|
| 28 |
-
df.iloc[start:end].to_csv(f"seamless.dataset.metadata.public.
|
| 29 |
index += 1
|
| 30 |
start = end
|
| 31 |
end += batch_size
|
|
|
|
| 11 |
|
| 12 |
import pandas as pd
|
| 13 |
|
| 14 |
+
direction_speech = os.getenv("DIRECTION_SPEECH", "enA")
|
| 15 |
+
direction_text = os.getenv("DIRECTION_TEXT", "jpn")
|
| 16 |
+
chunk_size = int(os.getenv("CHUNK_SIZE", 10))
|
| 17 |
+
url = f"https://dl.fbaipublicfiles.com/seamless/data/seamless.dataset.metadata.public.{direction_speech}-{direction_text}.withduration.tsv.gz"
|
| 18 |
filename = os.path.basename(url)
|
| 19 |
subprocess.run(["wget", url, "-O", filename])
|
| 20 |
df = pd.read_csv(filename, sep='\t', header=None, dtype=str)
|
|
|
|
| 27 |
end = batch_size
|
| 28 |
index = 1
|
| 29 |
while start != end:
|
| 30 |
+
df.iloc[start:end].to_csv(f"seamless.dataset.metadata.public.{direction_speech}-{direction_text}.withduration.reordered.batch_{index}.tsv", sep="\t", index=False, header=False)
|
| 31 |
index += 1
|
| 32 |
start = end
|
| 33 |
end += batch_size
|
main_s2t.sh
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
######################
|
| 2 |
# enA-jpn: 1_468_292 #
|
| 3 |
######################
|
|
@@ -21,36 +44,16 @@ do
|
|
| 21 |
python download_audio.py
|
| 22 |
done
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
alias wet_lines="${PWD}/build/bin/wet_lines"
|
| 34 |
-
cd ../
|
| 35 |
-
wget https://dl.fbaipublicfiles.com/seamless/data/seamless.dataset.metadata.public.enA-jpn.withduration.tsv.gz
|
| 36 |
-
cp ../download_text.py ./
|
| 37 |
-
python download_text.py
|
| 38 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_1.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_1.tsv
|
| 39 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_2.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_2.tsv
|
| 40 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_3.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_3.tsv
|
| 41 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_4.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_4.tsv
|
| 42 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_5.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_5.tsv
|
| 43 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_6.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_6.tsv
|
| 44 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_7.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_7.tsv
|
| 45 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_8.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_8.tsv
|
| 46 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_9.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_9.tsv
|
| 47 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_10.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_10.tsv
|
| 48 |
-
cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_11.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_11.tsv
|
| 49 |
-
cp ../format_text.py ./
|
| 50 |
python format_text.py
|
| 51 |
-
mv text.enA-jpn.json ../
|
| 52 |
-
cd ../
|
| 53 |
-
|
| 54 |
|
| 55 |
########
|
| 56 |
# NLLB #
|
|
|
|
| 1 |
+
####################
|
| 2 |
+
# Install Wet Tool #
|
| 3 |
+
####################
|
| 4 |
+
# libraries for runpod
|
| 5 |
+
sudo apt-get install libcurl4-openssl-dev
|
| 6 |
+
sudo apt-get install libbz2-dev
|
| 7 |
+
sudo apt-get install liblzma-dev
|
| 8 |
+
sudo add-apt-repository ppa:boost-latest/ppa -y
|
| 9 |
+
sudo apt-get update
|
| 10 |
+
sudo apt-get purge boost* -y
|
| 11 |
+
sudo apt-get install libboost-all-dev -y
|
| 12 |
+
# clone and build the library
|
| 13 |
+
git clone https://github.com/kpu/preprocess
|
| 14 |
+
cd preprocess
|
| 15 |
+
git checkout wet
|
| 16 |
+
git submodule update --init --recursive
|
| 17 |
+
mkdir build
|
| 18 |
+
cd build
|
| 19 |
+
cmake ..
|
| 20 |
+
make -j4
|
| 21 |
+
alias wet_lines="${PWD}/bin/wet_lines"
|
| 22 |
+
cd ../../
|
| 23 |
+
|
| 24 |
######################
|
| 25 |
# enA-jpn: 1_468_292 #
|
| 26 |
######################
|
|
|
|
| 44 |
python download_audio.py
|
| 45 |
done
|
| 46 |
|
| 47 |
+
# text
|
| 48 |
+
export DIRECTION_SPEECH="enA"
|
| 49 |
+
export DIRECTION_TEXT="jpn"
|
| 50 |
+
export CHUNK_SIZE=10
|
| 51 |
+
python download_s2t_metadata.py
|
| 52 |
+
for i in $(seq 1 ${CHUNK_SIZE});
|
| 53 |
+
do
|
| 54 |
+
cat seamless.dataset.metadata.public.${DIRECTION_SPEECH}-${DIRECTION_TEXT}.withduration.reordered.batch_${i}.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee metadata.${DIRECTION_SPEECH}-${DIRECTION_TEXT}.batch_1.tsv &
|
| 55 |
+
done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
python format_text.py
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
########
|
| 59 |
# NLLB #
|