How to Identify and Compare Civitai and Tensor.Art LoRA Metadata for Krea 2 Models
1. Introduction
LoRA (Low-Rank Adaptation) is a technique used to adapt an AI model to specific visual styles, subjects, or concepts without retraining the entire base model.
LoRA files are commonly distributed in the .safetensors format, which can contain model weights and optional embedded metadata.
Civitai and Tensor.Art are platforms where users can publish and download AI models and LoRAs. When working with Krea 2 models, inspecting the metadata can help you understand the information stored inside a LoRA file and compare files obtained from different sources.
Important: Metadata alone cannot conclusively prove whether a LoRA originated from Civitai or Tensor.Art. Platform-specific requirements must be verified against the relevant documentation.
2. Requirements
Install the Python safetensors library:
pip install safetensorsPrepare the two LoRA files you want to inspect. For example:
lora_civitai.safetensors
lora_tensorart.safetensors
These are example filenames. Replace them with your actual file paths.
3. Python Script to Extract LoRA Metadata
Use the following script to read the embedded metadata from both files:
from safetensors import safe_open
import json
def read_lora_metadata(file_path):
try:
with safe_open(
file_path,
framework="pt",
device="cpu"
) as f:
metadata = f.metadata() or {}
print(f"\nFile: {file_path}")
print("=" * 60)
if metadata:
print(json.dumps(
metadata,
indent=2,
ensure_ascii=False
))
else:
print("No embedded metadata found.")
return metadata
except Exception as e:
print(f"Failed to read {file_path}: {e}")
return {}
civitai_metadata = read_lora_metadata(
"lora_civitai.safetensors"
)
tensorart_metadata = read_lora_metadata(
"lora_tensorart.safetensors"
)This script extracts and displays the metadata from each file in JSON format. It does not modify the files or automatically identify their publishing platforms.
4. Metadata Fields to Examine
Depending on the training software and export process, a LoRA file may contain fields such as:
Metadata keyPossible purposess_base_model_versionRecords the base model or version used during trainingss_network_moduleIdentifies the network moduless_network_dimRecords the LoRA network dimension or rankss_network_alphaRecords the LoRA alpha valuess_stepsRecords the number of training stepsss_epochRecords training epoch informationmodelspec.architectureDescribes the architecture using the ModelSpec conventionmodelspec.sai_model_specIdentifies the ModelSpec versionss_training_commentStores optional training notes
These are examples of general metadata fields, not confirmed mandatory fields for Krea 2, Civitai, or Tensor.Art.