add get_closet_checkpoint_match
This commit is contained in:
parent
190fda38cb
commit
642b7e333e
1 changed files with 15 additions and 0 deletions
|
@ -61,6 +61,21 @@ def list_models():
|
||||||
title, model_name = modeltitle(filename, h)
|
title, model_name = modeltitle(filename, h)
|
||||||
checkpoints_list[title] = CheckpointInfo(filename, title, h, model_name)
|
checkpoints_list[title] = CheckpointInfo(filename, title, h, model_name)
|
||||||
|
|
||||||
|
def get_closet_checkpoint_match(searchString):
|
||||||
|
checkpointValues = checkpoints_list.values()
|
||||||
|
|
||||||
|
applicable = [info for info in checkpointValues if searchString.upper() == ''.join(info.title.rpartition('.ckpt')[0]).upper()]
|
||||||
|
|
||||||
|
if len(applicable) == 0:
|
||||||
|
applicable = [info for info in checkpointValues if searchString.upper() == ''.join(info.title.rpartition('.ckpt')[:2]).upper()]
|
||||||
|
|
||||||
|
if len(applicable) == 0:
|
||||||
|
applicable = [info for info in checkpointValues if searchString in info.title]
|
||||||
|
|
||||||
|
if len(applicable)>0:
|
||||||
|
return applicable[0]
|
||||||
|
|
||||||
|
return None
|
||||||
|
|
||||||
def model_hash(filename):
|
def model_hash(filename):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue