def calculate_fid_given_paths(paths, batch_size=50, device="cuda:0", dims=2048, num_workers=1):
    """Calculates the FID of two paths"""
    for p in paths:
        if type(p) is list:
            for subp in p:
                if not os.path.exists(subp):
                    raise RuntimeError('Invalid path: %s' % subp)
        else:
            if not os.path.exists(p):
                raise RuntimeError('Invalid path: %s' % p)

    block_idx = InceptionV3.BLOCK_INDEX_BY_DIM[dims]

    model = InceptionV3([block_idx]).to(device)

    m1, s1 = compute_statistics_of_path(paths[0], model, batch_size,
                                        dims, device, num_workers)
    m2, s2 = compute_statistics_of_path(paths[1], model, batch_size,
                                        dims, device, num_workers)
    fid_value = calculate_frechet_distance(m1, s1, m2, s2)

    return fid_value
Calculates the FID of two paths
textdiffuser/eval/fid_score.py