repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
wav2letter | wav2letter-main/recipes/lexicon_free/utilities/compute_lower_ppl_kenlm.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Compute upper and lower limits on word perplexity for kenlm ngram models
Command : python3 compute_upper_... | 5,939 | 32.559322 | 88 | py |
wav2letter | wav2letter-main/recipes/lexicon_free/utilities/compute_upper_ppl_convlm.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Compute upper limit on word perplexity for convlm models
Command (for word) : python3 compute_upper_ppl_c... | 6,783 | 33.969072 | 88 | py |
wav2letter | wav2letter-main/recipes/lexicon_free/utilities/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import re
import numpy
EOS = ... | 2,637 | 28.640449 | 84 | py |
wav2letter | wav2letter-main/recipes/lexicon_free/utilities/compute_upper_ppl_kenlm.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Compute upper limit on word perplexity for kenlm ngram models
Command : python3 compute_upper_ppl_kenlm.p... | 3,285 | 32.876289 | 84 | py |
wav2letter | wav2letter-main/recipes/lexicon_free/utilities/convlm_utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import torch
from fairseq impo... | 4,597 | 29.052288 | 82 | py |
wav2letter | wav2letter-main/recipes/lexicon_free/utilities/compute_lower_ppl_convlm.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Compute upper and lower limits on word perplexity for convlm models
Command : python3 compute_lower_ppl_c... | 9,068 | 33.48289 | 88 | py |
wav2letter | wav2letter-main/recipes/lexicon_free/wsj/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to prepare recipe to train/eval model on Librispeech in wav2letter++ pipelines
Please install `sph2... | 9,347 | 34.953846 | 90 | py |
wav2letter | wav2letter-main/recipes/lexicon_free/librispeech/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to prepare recipe to train/eval model on Librispeech in wav2letter++ pipelines
Command : python3 p... | 7,813 | 28.048327 | 87 | py |
wav2letter | wav2letter-main/recipes/utilities/prepare_librispeech_official_lm.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Downloading and preparation of official Librispeech 4-gram language model.
Please install `kenlm` on your ... | 2,980 | 35.802469 | 87 | py |
wav2letter | wav2letter-main/recipes/utilities/prepare_librispeech_wp_and_official_lexicon.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to prepare recipe to train/eval model on Librispeech in wav2letter++ pipelines
Command : python3 p... | 7,097 | 37.367568 | 87 | py |
wav2letter | wav2letter-main/recipes/utilities/convlm_serializer/save_pytorch_model.py | from __future__ import absolute_import, division, print_function, unicode_literals
import sys
from collections import defaultdict
import torch
def convert(model_state, key, suffix=""):
string = ""
param = model_state[key]
# param name
string += ".".join(key.split(".")[1:-1]) + suffix + "." + key.spl... | 2,325 | 32.710145 | 87 | py |
wav2letter | wav2letter-main/recipes/joint_training_vox_populi/prepare_data/common_voice_to_wav2letter.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import csv
import argparse
import torch
import torchaudio
import string
from tqdm import tqdm
from pathlib import Path
from typing import Dict,... | 7,022 | 26.758893 | 91 | py |
wav2letter | wav2letter-main/recipes/joint_training_vox_populi/prepare_data/audio.py | 0 | 0 | 0 | py | |
wav2letter | wav2letter-main/recipes/joint_training_vox_populi/prepare_data/lst_utils.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from pathlib import Path
from typing import List, Optional, Set
from dataclasses import dataclass
@dataclass
class FileInfo:
id_: str
... | 1,154 | 24.666667 | 88 | py |
wav2letter | wav2letter-main/recipes/joint_training_vox_populi/prepare_data/make_lexicon.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import logging
from pathlib import Path
from typing import Dict, Optional, Set
log = logging.getLogger(__name__)
def has_va... | 4,642 | 27.838509 | 100 | py |
wav2letter | wav2letter-main/recipes/joint_training_vox_populi/prepare_data/get_tokens.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from common_voice_to_wav2letter import get_base_data_from_csv, PUNCTUATION
from typing import List, Set
import argparse
REPLACE_SET = {"–": "-... | 1,428 | 24.517857 | 74 | py |
wav2letter | wav2letter-main/recipes/self_training/librispeech/lm/prepare_wp_data.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to prepare word-piece data for lm training
Command : python3 prepare.py --data_src [...] --model_s... | 1,589 | 31.44898 | 87 | py |
wav2letter | wav2letter-main/recipes/self_training/librispeech/lm/filter_contractions.py | from __future__ import print_function
import os
import sys
from multiprocessing.pool import ThreadPool
CONTRACTIONS = "contractions.txt"
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def run_for_id(file_name):
print("Starting thread")
contractions = []
with open(CONTRACTION... | 2,248 | 27.833333 | 91 | py |
wav2letter | wav2letter-main/recipes/self_training/librispeech/lm/sentence_ify.py | import nltk
import tqdm
def load():
with open("lmtext_no_am.txt", "r") as fid:
lines = [l.strip() for l in fid]
return lines
if __name__ == "__main__":
lines = load()
tokenizer = nltk.data.load("tokenizers/punkt/english.pickle")
step = 10000
with open("lmtext_sentences_no_am.txt", "... | 555 | 24.272727 | 73 | py |
wav2letter | wav2letter-main/recipes/self_training/librispeech/lm/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sox
def fi... | 1,558 | 25.87931 | 85 | py |
wav2letter | wav2letter-main/recipes/self_training/librispeech/lm/prepare_seq2seq_dict.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to prepare dictionary for running experiments with Librispeech datasets in
wav2letter++ pipelines
... | 3,541 | 30.070175 | 89 | py |
wav2letter | wav2letter-main/recipes/self_training/librispeech/lm/generate_lm_raw_text.py | import glob
import os
def get_am_bookids():
ambooks_file = "LibriSpeech/BOOKS.TXT"
with open(ambooks_file, "r") as fid:
bookids = [l.split()[0] for l in fid]
clean_bookids = []
for bid in bookids:
try:
int(bid)
clean_bookids.append(bid)
except:
... | 1,650 | 25.629032 | 77 | py |
wav2letter | wav2letter-main/recipes/self_training/librispeech/lm/clean_lm_text.py | import re
from multiprocessing import Pool
import nltk
import tqdm
PUNCTUATION = set(list(",'\"?!#&(){}[]*+=;:.-"))
PUNCTUATION.add("")
def clean(line):
# try:
# new_line = normalise.normalise(line, verbose=False)
# except:
# print("Could not normalize:", line)
# new_line... | 1,224 | 23.5 | 65 | py |
wav2letter | wav2letter-main/recipes/self_training/pseudo_labeling/dataset_utils.py | from __future__ import absolute_import, division, print_function, unicode_literals
class Transcript(object):
def __init__(self, sid, path, duration, transcript=""):
self.sid = sid
self.path = path
self.duration = duration
self.transcript = transcript
def __hash__(self):
... | 1,708 | 27.966102 | 84 | py |
wav2letter | wav2letter-main/recipes/self_training/pseudo_labeling/generate_synthetic_data.py | from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import os
import sys
from dataset_utils import (
create_transcript_dict_from_listfile,
write_transcript_list_to_file,
)
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def pair_trans... | 7,109 | 30.048035 | 87 | py |
wav2letter | wav2letter-main/recipes/self_training/pseudo_labeling/generate_synthetic_lexicon.py | from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import operator
import os
from synthetic_lexicon_utils import (
LexiconEntry,
read_spellings_from_file,
write_spellings_to_file,
)
def generate_wp_selling(wp_list):
spellings = []
this_spelling = [... | 5,462 | 31.135294 | 88 | py |
wav2letter | wav2letter-main/recipes/self_training/pseudo_labeling/combine_synthetic_lexicons.py | from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import os
from synthetic_lexicon_utils import (
read_spellings_from_file,
write_spellings_to_file,
)
def combine_lexicons(lexicon1, lexicon2):
combined = {}
for lexicon in [lexicon1, lexicon2]:
... | 1,580 | 26.258621 | 85 | py |
wav2letter | wav2letter-main/recipes/self_training/pseudo_labeling/synthetic_lexicon_utils.py | from __future__ import absolute_import, division, print_function, unicode_literals
import itertools
class LexiconEntry(object):
"""
A particular word in the Lexicon and its candidate spellings, sorted by
"""
def __init__(self, word, sorted_spellings):
self.word = word
self.sorted_spe... | 1,913 | 29.870968 | 82 | py |
wav2letter | wav2letter-main/recipes/sota/2019/raw_lm_corpus/get_gb_books_by_id.py | import argparse
import os
import sys
from multiprocessing.pool import ThreadPool
from gutenberg.acquire import load_etext
from gutenberg.cleanup import strip_headers
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def get_one_book(book_id, outdir):
eprint("Getting book with id", book_i... | 1,059 | 24.853659 | 79 | py |
wav2letter | wav2letter-main/recipes/sota/2019/raw_lm_corpus/filter_distances.py | import argparse
import os
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def run(filename, score, distance_ratio):
eprint("Starting with filename ", filename)
with open(filename, "r") as f:
done = 0
for line in f:
done += 1
str1, s... | 1,284 | 29.595238 | 83 | py |
wav2letter | wav2letter-main/recipes/sota/2019/raw_lm_corpus/process_raw_text.py | import argparse
import os
from multiprocessing.pool import ThreadPool
from gutenberg.cleanup import strip_headers
def strip_header(name):
print(name)
with open(name, "r") as intext:
buf = intext.read().encode("utf-8")
return strip_headers(buf).strip()
def extract_one_book(book_path):
co... | 924 | 22.717949 | 73 | py |
wav2letter | wav2letter-main/recipes/sota/2019/raw_lm_corpus/get_titles.py | import argparse
import os
import xml.etree.ElementTree as ET
from multiprocessing.pool import ThreadPool
from gutenberg.query import get_metadata
CACHE_PATH = ""
def get_one_title_from_cache(book_id):
return (book_id, get_metadata("title", int(book_id)))
def get_one_title(book_id):
try:
title = (... | 1,836 | 25.623188 | 98 | py |
wav2letter | wav2letter-main/recipes/sota/2019/raw_lm_corpus/join_ids.py | import argparse
import os
import sys
def run(basefile, tablefile, separator):
# Read IDs
with open(basefile, "r") as f:
titles = [line.strip() for line in f]
# Make table
with open(tablefile, "r") as f:
table = {}
for line in f:
book_id, book_title = line.strip().s... | 1,068 | 26.410256 | 77 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_analysis/filter_segmentations.py | import sys
from collections import defaultdict
def count(MIN_SIL_LENGTH, align_file):
lines = []
with open(align_file) as fin:
lines = fin.readlines()
res = {}
res["word_counter"] = [0] * 100 # number of word in each small chunk
res["chunk_counter"] = [0] * 100 # number of small chunk ... | 2,630 | 26.989362 | 82 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_analysis/tts_forward.py | # https://github.com/mozilla/TTS/blob/master/notebooks/Benchmark.ipynb - original code which we adapted
import io
import os
import sys
import time
from collections import OrderedDict
import numpy as np
import torch
from localimport import localimport
from matplotlib import pylab as plt
from TTS.layers import *
from TT... | 3,613 | 26.378788 | 103 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_analysis/generate_shuffle_dev_other_tts.py | import os
import sys
import numpy
numpy.random.seed(42)
with open(os.path.join(sys.argv[1], "dev-other.lst"), "r") as f:
data = [line.strip() for line in f]
for n, seed_val in enumerate([0, 2, 3, 4, 5]):
numpy.random.seed(42 + seed_val)
data = numpy.random.permutation(data)
with open("tts_shuffle... | 572 | 23.913043 | 64 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_analysis/shuffle_segments.py | import os
import random
import sys
from multiprocessing import Pool
import sox
align_file = sys.argv[1]
output_dir = sys.argv[2]
lines = []
with open(align_file) as fin:
lines = fin.readlines()
N_THREADS = 40
MIN_SIL_LENGTH = 0.13
TOLERANCE = 0.04
def process(parameters):
tid, n_samples = parameters
... | 3,394 | 28.017094 | 85 | py |
wav2letter | wav2letter-main/recipes/sota/2019/rescoring/forward_lm.py | from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import os
import numpy
import torch
from fairseq.data import Dictionary
from fairseq.models.fconv_lm import FConvLanguageModel
from fairseq.models.transformer_lm import TransformerLanguageModel
def load_lm(lm_path, mo... | 5,773 | 34.207317 | 87 | py |
wav2letter | wav2letter-main/recipes/sota/2019/rescoring/rescore.py | import argparse
from collections import defaultdict
from multiprocessing import Pool
import numpy as np
TOP_K = [1]
ref_dict = {}
res_dict = defaultdict(list)
def score(x, wts):
return (
x["am_score"]
+ wts["tr"] * x["tr"]
+ wts["convlm"] * x["convlm"]
+ wts["len"] * x["wl_len"]... | 5,585 | 30.738636 | 88 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm/prepare_wp_data.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to prepare word-piece data for lm training
Command : python3 prepare.py --data_src [...] --model_s... | 1,589 | 31.44898 | 87 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/generate_uniq.py | import sys
pl_data = []
with open(sys.argv[1], "r") as f:
for line in f:
pl_data.append(line.strip())
pl_data = set(pl_data)
with open(sys.argv[1] + ".unique", "w") as f:
for elem in pl_data:
f.write(elem + "\n")
| 240 | 17.538462 | 45 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/dump_title.py | import sys
for _, line in enumerate(sys.stdin):
print(line.strip() + "\n")
| 81 | 12.666667 | 36 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/preprocessing.py | import re
import sys
time_degree = {
"min.": "minutes",
"deg.": "degrees",
"sec.": "seconds",
"hrs.": "hours",
"hr.": "hour",
}
abbr_mapping = {
"mr.": "mister",
"mr": "mister",
"dr.": "doctor",
"dr": "doctor",
"ms.": "miss",
"ms": "miss",
"mrs.": "missus",
"mrs": "... | 1,401 | 24.490909 | 66 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/dump.py | import sys
prev_line = "hello world"
for _, line in enumerate(sys.stdin):
line = line.strip()
if prev_line != "":
print(line, end=" ")
prev_line = line
else:
print("\n" + line, end=" ")
prev_line = line
| 248 | 19.75 | 36 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/generate_frequencies.py | import sys
from collections import defaultdict
if __name__ == "__main__":
words_dict = defaultdict(int)
path = sys.argv[1]
out_path = path + ".freq"
with open(path, "r") as f:
for line in f:
for word in line.strip().split():
words_dict[word] += 1
with open(out_p... | 506 | 27.166667 | 66 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/generate_kenlm_vocab.py | import sys
if __name__ == "__main__":
path = sys.argv[1]
vocab_size = int(sys.argv[2])
out_path = path + ".kenlm.{}vocab".format(sys.argv[3])
with open(path, "r") as f, open(out_path, "w") as fout:
for index, line in enumerate(f):
if index >= vocab_size:
break
... | 372 | 27.692308 | 59 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/postprocessing_title.py | import re
import string
import sys
import unicodedata
LOWER_LETTERS = set(string.ascii_lowercase)
ACCEPTED_LETTERS = set.union(LOWER_LETTERS, set("0123456789"), {"'"})
if __name__ == "__main__":
for text in sys.stdin:
# stay only ascii symbols
nfkd_form = unicodedata.normalize("NFKD", text.strip... | 2,461 | 36.30303 | 90 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/postprocessing.py | import re
import string
import sys
import unicodedata
import num2words
import roman
LOWER_LETTERS = set(string.ascii_lowercase)
NUMBERS = set("0123456789,")
ROMANS = set("IVXLCDM")
ACCEPTED_LETTERS = set.union(LOWER_LETTERS, {"'"})
PUNCTUATION = set(".,()[]!?")
abbr_mapping = {
"mr.": "mister",
"mr": "miste... | 5,348 | 33.288462 | 89 | py |
wav2letter | wav2letter-main/recipes/sota/2019/lm_corpus_and_PL_generation/skip_paragraph.py | import sys
for _, line in enumerate(sys.stdin):
line = line.strip()
if line == "<P>":
continue
else:
print(line)
| 143 | 13.4 | 36 | py |
wav2letter | wav2letter-main/recipes/data/fisher/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sox
def fi... | 4,894 | 32.074324 | 86 | py |
wav2letter | wav2letter-main/recipes/data/fisher/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to package original Fisher datasets into a form readable in
wav2letter++ pipelines
Command : pytho... | 2,563 | 28.471264 | 85 | py |
wav2letter | wav2letter-main/recipes/data/switchboard/utils.py | from __future__ import absolute_import, division, print_function, unicode_literals
import os
import re
import sox
def process_hub5_data(sample_data):
line, idx, hub5_sdir, hub5_audio_path, sph2pipe = sample_data
if (not line) or line.startswith(";;") or ("IGNORE_TIME_SEGMENT_" in line):
return None
... | 6,637 | 37.593023 | 88 | py |
wav2letter | wav2letter-main/recipes/data/switchboard/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to package Switchboard, Hub05 datasets into a form readable in
wav2letter++ pipelines
Command : py... | 6,182 | 32.786885 | 85 | py |
wav2letter | wav2letter-main/data/timit/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to package original Timit dataset into a form readable in
wav2letter++ pipelines
Please install `s... | 6,512 | 34.205405 | 90 | py |
wav2letter | wav2letter-main/data/ami/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import copy
import os
import random
from collectio... | 6,772 | 31.099526 | 88 | py |
wav2letter | wav2letter-main/data/ami/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to package original AMI dataset into a form readable in
wav2letter++ pipelines
Command : python3 prepare.py --dst [...]... | 4,255 | 34.173554 | 163 | py |
wav2letter | wav2letter-main/data/wsj/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import re
import sox... | 5,257 | 36.557143 | 87 | py |
wav2letter | wav2letter-main/data/wsj/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to package original WSJ datasets into a form readable in wav2letter++
pipelines
Please install `sph... | 12,172 | 35.776435 | 102 | py |
wav2letter | wav2letter-main/data/mls/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to package original MLS dataset into a form readable in
wav2letter++ pipelines
Command : python3 p... | 2,216 | 32.590909 | 103 | py |
wav2letter | wav2letter-main/data/utils/kaldi_to_listfile.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to package kaldi data directory into a form readable in
wav2letter++ pipelines
Command : python3 prep... | 4,296 | 29.692857 | 76 | py |
wav2letter | wav2letter-main/data/librispeech/utils.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import sox
def fi... | 1,574 | 26.155172 | 85 | py |
wav2letter | wav2letter-main/data/librispeech/prepare.py | """
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the MIT-style license found in the
LICENSE file in the root directory of this source tree.
----------
Script to package original Librispeech datasets into a form readable in
wav2letter++ pipelines
Command : ... | 6,030 | 35.77439 | 88 | py |
lanro-gym | lanro-gym-main/main.py | import gymnasium as gym
import os
import numpy as np
import lanro_gym
import argparse
import glfw
DEBUG = int("DEBUG" in os.environ and os.environ["DEBUG"])
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--interactive', action='store_true', dest='interactive', help='Start int... | 6,302 | 36.96988 | 119 | py |
lanro-gym | lanro-gym-main/setup.py | import os
from setuptools import setup, find_packages
with open("README.md", "r") as f:
long_description = f.read()
with open(os.path.join("lanro_gym", "VERSION"), "r") as f:
__version__ = f.read().strip()
setup(
name="lanro_gym",
description="Gymnasium multi-goal environments for goal-conditioned an... | 1,279 | 36.647059 | 146 | py |
lanro-gym | lanro-gym-main/lanro_gym/utils.py | from enum import Enum
import itertools
from typing import List, Set, Tuple
import numpy as np
import random
def get_prop_combinations(stream) -> Set[Tuple]:
combinations = itertools.permutations(stream, 2)
comblist = [c for c in combinations]
def filter_same_prop_type(x) -> bool:
return type(x[0]... | 3,707 | 39.304348 | 119 | py |
lanro-gym | lanro-gym-main/lanro_gym/simulation.py | import os
from typing import Iterator, List, Optional, Tuple, Dict, Any
import pybullet as p
import pybullet_data as pd
from pybullet_utils import bullet_client
from contextlib import contextmanager
from lanro_gym.env_utils import RGBCOLORS
import time
from lanro_gym.utils import environment_camera
import numpy as np
i... | 22,773 | 41.330855 | 115 | py |
lanro-gym | lanro-gym-main/lanro_gym/language_utils.py | from typing import List, Set, Tuple
import numpy as np
def create_commands(command_type: str,
property_tuple: Tuple,
action_verbs: List[str] = [],
use_base=True,
use_synonyms=False) -> List[str]:
sentences = []
primary_property, s... | 3,061 | 35.891566 | 118 | py |
lanro-gym | lanro-gym-main/lanro_gym/__init__.py | from gymnasium.envs.registration import register
for robot in ['Panda']:
for reward_type in ["sparse", "dense"]:
_r_type = "Dense" if reward_type == "dense" else ""
kwargs = {
"reward_type": reward_type,
}
register(
id=f'{robot}Reach{_r_type}-v0',
... | 5,997 | 50.264957 | 148 | py |
lanro-gym | lanro-gym-main/lanro_gym/robots/pybrobot.py | from collections import namedtuple
import os
from gymnasium import spaces
from typing import Callable, Dict, List, Optional
import numpy as np
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.env_utils import RGBCOLORS
DEBUG = int("DEBUG" in os.environ and os.environ["DEBUG"])
JointInfo = namedtuple(... | 18,934 | 48.309896 | 120 | py |
lanro-gym | lanro-gym-main/lanro_gym/robots/__init__.py | from .panda import Panda
from .pybrobot import PyBulletRobot
| 61 | 19.666667 | 35 | py |
lanro-gym | lanro-gym-main/lanro_gym/robots/panda.py | from typing import List
from lanro_gym.simulation import PyBulletSimulation
import numpy as np
from lanro_gym.robots.pybrobot import PyBulletRobot
from lanro_gym.utils import gripper_camera
class Panda(PyBulletRobot):
NEUTRAL_JOINT_VALUES: List = [0.00, 0.41, 0.00, -1.85, -0.00, 2.26, 0.79]
NEUTRAL_FINGER_VAL... | 3,127 | 45.686567 | 115 | py |
lanro-gym | lanro-gym-main/lanro_gym/env_utils/task_object_list.py | from enum import Enum
from typing import Dict, List
from lanro_gym.utils import get_prop_combinations
from lanro_gym.env_utils import RGBCOLORS, SHAPES, WEIGHTS, SIZES, TaskObject
class TaskObjectList:
def __init__(self,
sim,
color_mode: bool = False,
shape_mode... | 2,923 | 33 | 83 | py |
lanro-gym | lanro-gym-main/lanro_gym/env_utils/object_properties.py | from enum import Enum
from lanro_gym.utils import scale_rgb
class DUMMY(Enum):
OBJECT = 0, ['object']
class RGBCOLORS(Enum):
""" RGBColors enum class with all colors defined as array of floats [0, 1]"""
BLACK = scale_rgb([0, 0, 0]), ["ebony"]
BLUE = scale_rgb([78.0, 121.0, 167.0]), ["azure"]
BRO... | 1,334 | 31.560976 | 92 | py |
lanro-gym | lanro-gym-main/lanro_gym/env_utils/__init__.py | from .object_properties import RGBCOLORS, SHAPES, SIZES, DUMMY, WEIGHTS
from .task_object import TaskObject
from .task_object_list import TaskObjectList
import numpy as np
def distinguishable_by_primary(goal_obj: TaskObject, non_goal_obj: TaskObject):
if isinstance(goal_obj.primary, RGBCOLORS):
return goa... | 3,240 | 44.013889 | 115 | py |
lanro-gym | lanro-gym-main/lanro_gym/env_utils/task_object.py | from __future__ import annotations
from typing import Tuple, Union, Any
import numpy as np
from lanro_gym.env_utils.object_properties import WEIGHTS
from lanro_gym.utils import get_one_hot_list
from lanro_gym.env_utils import RGBCOLORS, SHAPES, SIZES, DUMMY
def get_default_enum_index(default_enum_cls, default_enum):
... | 6,856 | 37.960227 | 120 | py |
lanro-gym | lanro-gym-main/lanro_gym/env/base.py | import os
from typing import Any, Dict, Optional, Tuple, Union
import gymnasium as gym
from gymnasium.utils import seeding
import numpy as np
from lanro_gym.robots import PyBulletRobot
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.core import LanguageTask, Task
gym.logger.set_level(40)
DE... | 1,945 | 30.387097 | 118 | py |
lanro-gym | lanro-gym-main/lanro_gym/env/goal.py | import os
from typing import Dict, List, Tuple, Optional, Any
import gymnasium as gym
from gymnasium import spaces
import numpy as np
from lanro_gym.robots import PyBulletRobot
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.core import Task
from lanro_gym.env import BaseEnv
gym.logger.set_l... | 3,056 | 39.223684 | 107 | py |
lanro-gym | lanro-gym-main/lanro_gym/env/language.py | import os
from typing import Dict, Set, Tuple, Any, Optional
import gymnasium as gym
from gymnasium import spaces
import numpy as np
from lanro_gym.language_utils import Vocabulary, parse_instructions
from lanro_gym.robots import PyBulletRobot
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.c... | 6,061 | 40.520548 | 117 | py |
lanro-gym | lanro-gym-main/lanro_gym/env/__init__.py | from .base import BaseEnv
from .goal import GoalEnv
from .language import LanguageEnv
| 86 | 20.75 | 33 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/nllift.py | import numpy as np
from lanro_gym.robots import PyBulletRobot
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.core import LanguageTask
from lanro_gym.language_utils import create_commands
class NLLift(LanguageTask):
def __init__(self,
sim: PyBulletSimulation,
... | 4,735 | 53.436782 | 113 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/nlgrasp.py | from lanro_gym.robots import PyBulletRobot
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.nllift import NLLift
class NLGrasp(NLLift):
def __init__(self,
sim: PyBulletSimulation,
robot: PyBulletRobot,
obj_xy_range: float = 0.3,
... | 1,451 | 40.485714 | 81 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/push.py | import numpy as np
from lanro_gym.tasks.core import Task
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.scene import basic_scene
from lanro_gym.env_utils import RGBCOLORS
class Push(Task):
def __init__(
self,
sim: PyBulletSimulation,
reward_type: str = "sparse",
... | 3,437 | 35.574468 | 87 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/__init__.py | # goal-conditioned tasks
from .reach import Reach
from .push import Push
from .stack import Stack
from .slide import Slide
# language-conditioned tasks
from .nlreach import NLReach
from .nlpush import NLPush
from .nllift import NLLift
from .nlgrasp import NLGrasp
| 265 | 21.166667 | 28 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/stack.py | import numpy as np
from typing import Tuple
from lanro_gym.tasks.core import Task
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.scene import basic_scene
from lanro_gym.env_utils import RGBCOLORS
class Stack(Task):
def __init__(
self,
sim: PyBulletSimulation,
rew... | 4,320 | 41.362745 | 108 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/reach.py | import numpy as np
from typing import Callable
from lanro_gym.tasks.core import Task
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.scene import basic_scene
from lanro_gym.env_utils import RGBCOLORS
class Reach(Task):
def __init__(self,
sim: PyBulletSimulation,
... | 1,696 | 32.94 | 85 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/slide.py | import numpy as np
from lanro_gym.tasks.core import Task
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.scene import basic_scene
from lanro_gym.env_utils import RGBCOLORS
SLIDE_OBJ_SIZE: float = 0.06
class Slide(Task):
def __init__(
self,
sim: PyBulletSimulation,
... | 3,549 | 37.172043 | 99 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/nlreach.py | from lanro_gym.robots import PyBulletRobot
import numpy as np
from lanro_gym.tasks.core import LanguageTask
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.utils import goal_distance
from lanro_gym.language_utils import create_commands
class NLReach(LanguageTask):
def __init__(self,
... | 4,365 | 54.265823 | 113 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/scene.py | from lanro_gym.simulation import PyBulletSimulation
PLANE_COLOR = [0.37, 0.37, 0.37, 1]
TABLE_COLOR = [0.95, 0.95, 0.95, 1]
def basic_scene(
sim: PyBulletSimulation,
plane_z_offset: float = -0.4,
plane_x_pos: float = -0.2,
plane_length: float = 0.8,
table_length: float = 0.8,
table_width: flo... | 1,413 | 29.085106 | 75 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/nlpush.py | import numpy as np
from lanro_gym.robots import PyBulletRobot
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.core import LanguageTask
from lanro_gym.utils import goal_distance
from lanro_gym.language_utils import create_commands
class NLPush(LanguageTask):
def __init__(self,
... | 5,625 | 47.921739 | 120 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/core/task.py | from typing import Dict
import numpy as np
from lanro_gym.utils import goal_distance
class Task:
distance_threshold: float = 0.05
reward_type: str = "sparse"
last_distance: float = 0
object_size: float = 0.04
goal: np.ndarray
np_random: np.random.Generator
def get_goal(self) -> np.ndarray... | 1,331 | 29.272727 | 97 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/core/__init__.py | from .task import Task
from .language_task import LanguageTask
| 63 | 20.333333 | 39 | py |
lanro-gym | lanro-gym-main/lanro_gym/tasks/core/language_task.py | import itertools
from typing import Dict, List, Tuple
import numpy as np
from lanro_gym.robots.pybrobot import PyBulletRobot
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.tasks.scene import basic_scene
from lanro_gym.env_utils import RGBCOLORS, TaskObjectList, SHAPES, WEIGHTS, SIZES, valid_task_ob... | 16,748 | 48.553254 | 153 | py |
lanro-gym | lanro-gym-main/lanro_gym/environments/__init__.py | from .panda import PandaReachEnv, PandaPushEnv, PandaSlideEnv, PandaStackEnv
from .panda_nl import PandaNLReachEnv, PandaNLPushEnv, PandaNLGraspEnv, PandaNLLiftEnv
| 164 | 54 | 86 | py |
lanro-gym | lanro-gym-main/lanro_gym/environments/panda_nl.py | from lanro_gym.env import LanguageEnv
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.robots import Panda
from lanro_gym.tasks import NLReach, NLLift, NLGrasp, NLPush
class PandaNLReachEnv(LanguageEnv):
def __init__(self,
render=False,
num_obj=2,
... | 4,872 | 40.649573 | 97 | py |
lanro-gym | lanro-gym-main/lanro_gym/environments/panda.py | from lanro_gym.env import GoalEnv
from lanro_gym.simulation import PyBulletSimulation
from lanro_gym.robots import Panda
from lanro_gym.tasks import Reach, Push, Stack, Slide
class PandaReachEnv(GoalEnv):
def __init__(self, render=False, reward_type="sparse", action_type='end_effector'):
sim = PyBulletSi... | 1,697 | 36.733333 | 116 | py |
lanro-gym | lanro-gym-main/examples/scripted_grasp.py | """A script to demonstrate grasping."""
import gymnasium as gym
import lanro_gym
import time as time
import numpy as np
env = gym.make("PandaNLLift2Shape-v0", render=True)
total_ep = 100
start_t = time.time()
for _ in range(total_ep):
obs, info = env.reset()
goal_pos = env.sim.get_base_position(env.task.goal_... | 783 | 26.034483 | 71 | py |
lanro-gym | lanro-gym-main/examples/fps.py | """A script to measure the FPS"""
import gymnasium as gym
import lanro_gym
import time as time
env = gym.make("PandaNLPush2HIAR-v0")
# env = gym.make("PandaNLPush2PixelEgoHIAR-v0")
total_ep = 100
step_ctr = 0
start_t = time.time()
for _ in range(total_ep):
env.reset()
for _ in range(env._max_episode_steps):
... | 446 | 23.833333 | 56 | py |
lanro-gym | lanro-gym-main/examples/scripted_reach.py | """A script to demonstrate reaching."""
import gymnasium as gym
import lanro_gym
import time as time
import numpy as np
env = gym.make("PandaReach-v0", render=True)
total_ep = 100
start_t = time.time()
for _ in range(total_ep):
obs, info = env.reset()
goal_pos = obs['desired_goal']
for i in range(env._ma... | 646 | 22.962963 | 47 | py |
lanro-gym | lanro-gym-main/test/nl_utils_test.py | import numpy as np
from lanro_gym.language_utils import parse_instructions, create_commands, Vocabulary, word_in_string
from lanro_gym.env_utils import SHAPES, RGBCOLORS
def test_parse_instruction():
instruction_list = [
"Hello world",
"World helo",
"Sunny weather",
"Lorem ipsum do... | 3,593 | 32.90566 | 117 | py |
lanro-gym | lanro-gym-main/test/env_test.py | import gymnasium as gym
import numpy as np
import lanro_gym
def run_random_policy(env):
env.reset()
for _ in range(env._max_episode_steps):
obs = env.step(env.action_space.sample())[0]
assert np.all(obs['observation'] <= env.observation_space['observation'].high) == True
assert np.all(... | 2,782 | 39.926471 | 137 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.