Merge pull request #3826 from ANTONIOPSD/patch-1
Natural sorting for dropdown checkpoint list
This commit is contained in:
commit
cf8da8e1b0
1 changed files with 5 additions and 2 deletions
|
@ -3,6 +3,7 @@ import os.path
|
||||||
import sys
|
import sys
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import torch
|
import torch
|
||||||
|
import re
|
||||||
from omegaconf import OmegaConf
|
from omegaconf import OmegaConf
|
||||||
|
|
||||||
from ldm.util import instantiate_from_config
|
from ldm.util import instantiate_from_config
|
||||||
|
@ -36,7 +37,9 @@ def setup_model():
|
||||||
|
|
||||||
|
|
||||||
def checkpoint_tiles():
|
def checkpoint_tiles():
|
||||||
return sorted([x.title for x in checkpoints_list.values()])
|
convert = lambda name: int(name) if name.isdigit() else name.lower()
|
||||||
|
alphanumeric_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
|
||||||
|
return sorted([x.title for x in checkpoints_list.values()], key = alphanumeric_key)
|
||||||
|
|
||||||
|
|
||||||
def list_models():
|
def list_models():
|
||||||
|
|
Loading…
Reference in a new issue