import os | |
#This function is used to retrive the latest version of a certain Embeddings | |
def getLatestEMBVersion(emb): | |
dir=os.path.join("data",emb) | |
folders = [f for f in os.listdir(dir) if os.path.isdir(os.path.join(dir, f))] | |
max_version = 0 | |
max_version_folder = None | |
for folder in folders: | |
try: | |
# Extract the version number from the folder name | |
version = int(folder[1:]) | |
if version > max_version: | |
max_version = version | |
max_version_folder = folder | |
except ValueError: | |
# Ignore folders that don't match the expected format | |
pass | |
return max_version_folder |