Get-Seed #
Retrieves the ss_seed
value from the metadata of a .safetensors
file.
<#
Retrieves the 'ss_seed' value from the metadata of a .safetensors file.
The Get-Seed function takes a file path as input and uses Python to extract the 'ss_seed' value from the metadata of a .safetensors file.
It returns the 'ss_seed' value if found, otherwise it returns 'Not found'.
.EXAMPLE
$seedValue = Get-Seed .\path\to\your\file.safetensors
#>
function Get-Seed {
param (
[Parameter(Mandatory = $true, Position = 0)]
[string]$filePath
)
$filePath = $filePath -replace '\\', '\\\\'
$pythonCommand = "import safetensors, json; print(json.loads(safetensors.safe_open('" + $filePath + "', 'np').metadata().get('ss_seed', 'Not found')))"
$ssSeed = python -c $pythonCommand
return $ssSeed
}