VAE Similarity Analyser (C2C):
The VAESimilarityAnalyserMEC node is designed to provide a detailed analysis of the similarity between two Variational Autoencoders (VAEs) or any models that expose a state dictionary. This node calculates the cosine similarity on a tensor-by-tensor basis, offering insights into how closely related two models are in terms of their learned parameters. By focusing on the cosine similarity, it provides a robust measure of alignment between the models' weights, which can be particularly useful for diagnosing model performance, understanding model drift, or comparing different versions of a model. The node is purely diagnostic and does not alter the input models, ensuring that your original models remain unchanged. This makes it an invaluable tool for AI artists and developers who wish to understand the internal workings and similarities of their models without the risk of unintended modifications.
VAE Similarity Analyser (C2C) Input Parameters:
vae_a
This parameter represents the first VAE model that you want to compare. It is essential for the analysis as it serves as one of the two models whose state dictionaries will be evaluated for similarity. The parameter does not have a default value and must be provided for the node to function.
vae_b
This parameter is the second VAE model to be compared against the first. Like vae_a, it is crucial for the analysis, as the node will compute the cosine similarity between the state dictionaries of vae_a and vae_b. This parameter also does not have a default value and must be specified.
include_per_tensor
This optional boolean parameter determines whether the analysis should include detailed per-tensor cosine similarity entries in the JSON report. By default, this is set to False, meaning that the report will focus on per-block similarities unless specified otherwise. Setting this to True will provide a more verbose output, which can be useful for in-depth analysis but may also result in a more extensive report.
VAE Similarity Analyser (C2C) Output Parameters:
report_json
This output provides a comprehensive JSON report detailing the similarity analysis. It includes per-block cosine similarities, any missing keys, and optionally, per-tensor details if include_per_tensor was set to True. This report is valuable for understanding the specific areas of similarity and divergence between the two models.
global_cosine
This output is a float representing the global cosine similarity across all common tensors between the two models. It provides a single metric that summarizes the overall similarity, making it easy to quickly assess how closely the models align.
most_divergent_blocks
This output is a JSON list of the ten most divergent blocks, sorted by their cosine similarity in ascending order. This allows you to identify which parts of the models differ the most, which can be crucial for targeted model improvements or understanding specific areas of model drift.
VAE Similarity Analyser (C2C) Usage Tips:
- To get a quick overview of model similarity, use the default settings without enabling
include_per_tensor. This will provide a concise report focusing on block-level similarities. - If you need a detailed analysis, especially when diagnosing specific issues or understanding subtle differences, enable
include_per_tensorto get a more granular view of the similarities.
VAE Similarity Analyser (C2C) Common Errors and Solutions:
VAE input is None.
- Explanation: This error occurs when one or both of the VAE inputs (
vae_aorvae_b) are not provided or are set toNone. - Solution: Ensure that both
vae_aandvae_bare correctly specified and are valid VAE models or state dictionaries before running the analysis.
Cannot extract state_dict from <type>
- Explanation: This error indicates that the node was unable to extract a state dictionary from the provided model object, possibly because the object does not have a
state_dictmethod or attribute. - Solution: Verify that the input models are compatible and have a
state_dictmethod. If using custom models, ensure they are properly implemented to expose their state dictionaries.
