File size: 685 Bytes
097caae
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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