Skip to content

Commit

Permalink
Fix read_json_with_comments
Browse files Browse the repository at this point in the history
  • Loading branch information
WeberJulian committed Dec 11, 2023
1 parent d47b6df commit 61b67ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 64 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/zoo_tests_tortoise.yml

This file was deleted.

9 changes: 3 additions & 6 deletions TTS/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ def read_json_with_comments(json_path):
# fallback to json
with fsspec.open(json_path, "r", encoding="utf-8") as f:
input_str = f.read()
# handle comments
input_str = re.sub(r"\\\n", "", input_str)
input_str = re.sub(r"//.*\n", "\n", input_str)
data = json.loads(input_str)
return data

# handle comments but not urls with //
input_str = re.sub(r"(\"(?:[^\"\\]|\\.)*\")|(/\*(?:.|[\\n\\r])*?\*/)|(//.*)", lambda m: m.group(1) or m.group(2) or "", input_str)
return json.loads(input_str)

def register_config(model_name: str) -> Coqpit:
"""Find the right config for the given model name.
Expand Down

0 comments on commit 61b67ef

Please sign in to comment.