LD_PRELOAD, another patch for facexlib

This commit is contained in:
gbtb 2022-10-17 23:57:36 +10:00
parent d8e41d6511
commit e10a7f28df
2 changed files with 25 additions and 0 deletions

View File

@ -140,6 +140,10 @@
invokeai-amd = nixpkgs_.mkShell {
name = "invokeai-amd";
propagatedBuildInputs = requirements nixpkgs_;
shellHook = ''
export NIXPKGS_ALLOW_UNFREE=1
export LD_LIBRARY_PATH=$(nix-build -E 'let nixpkgs = import <nixpkgs> {}; in nixpkgs.lapack.override { lapackProvider = nixpkgs.mkl; }')/lib:$(nix-build -E 'let nixpkgs = import <nixpkgs> {}; in nixpkgs.blas.override { blasProvider = nixpkgs.mkl; }')/lib
'';
};
default = invokeai-amd;
});

View File

@ -18,3 +18,24 @@ index f5d34ea..9e3b247 100644
# TODO: clean pretrained model
load_net = torch.load(model_path, map_location=lambda storage, loc: storage)
diff --git a/facexlib/parsing/__init__.py b/facexlib/parsing/__init__.py
index 9be36a3..eb4da3f 100644
--- a/facexlib/parsing/__init__.py
+++ b/facexlib/parsing/__init__.py
@@ -3,6 +3,7 @@ import torch
from facexlib.utils import load_file_from_url
from .bisenet import BiSeNet
from .parsenet import ParseNet
+import os
def init_parsing_model(model_name='bisenet', half=False, device='cuda', model_rootpath=None):
@@ -16,7 +17,7 @@ def init_parsing_model(model_name='bisenet', half=False, device='cuda', model_ro
raise NotImplementedError(f'{model_name} is not implemented.')
model_path = load_file_from_url(
- url=model_url, model_dir='facexlib/weights', progress=True, file_name=None, save_dir=model_rootpath)
+ url=model_url, model_dir=f'{os.getcwd()}/src/facexlib/weights', progress=True, file_name=None, save_dir=model_rootpath)
load_net = torch.load(model_path, map_location=lambda storage, loc: storage)
model.load_state_dict(load_net, strict=True)
model.eval()