Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions DeepFilterNet/df/scripts/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,6 @@ def export(


def main(args):
try:
import monkeytype # noqa: F401
except ImportError:
print("Failed to import monkeytype. Please install it via")
print("$ pip install MonkeyType")
exit(1)

print(args)
model, df_state, _, epoch = init_df(
args.model_base_dir,
Expand Down
12 changes: 7 additions & 5 deletions DeepFilterNet/df/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ def get_git_root():
git_local_dir = os.path.dirname(os.path.abspath(__file__))
args = ["git", "-C", git_local_dir, "rev-parse", "--show-toplevel"]
return subprocess.check_output(args).strip().decode()
except subprocess.CalledProcessError:
except (subprocess.CalledProcessError, OSError):
# CalledProcessError: not inside a repository.
# OSError (FileNotFoundError): git is not installed at all.
return None


Expand All @@ -154,8 +156,8 @@ def get_commit_hash():
return None
args = ["git", "-C", git_dir, "rev-parse", "--short", "--verify", "HEAD"]
return subprocess.check_output(args).strip().decode()
except subprocess.CalledProcessError:
# probably not in git repo
except (subprocess.CalledProcessError, OSError):
# not in a git repo, or git is not installed
return None


Expand All @@ -168,8 +170,8 @@ def get_branch_name():
git_dir = os.path.dirname(os.path.abspath(__file__))
args = ["git", "-C", git_dir, "rev-parse", "--abbrev-ref", "HEAD"]
branch = subprocess.check_output(args).strip().decode()
except subprocess.CalledProcessError:
# probably not in git repo
except (subprocess.CalledProcessError, OSError):
# not in a git repo, or git is not installed
branch = None
return branch

Expand Down