Closed athu16 closed 1 year ago
Thanks for reporting. Will check whether the models are in our current link. Maybe the URL we use to fetch the models does not support these, which obviously shouldn't be.
I noticed the same, though it might be you used a different download source, have the safetensors version or something else.
The URL used to check if the md5s match also provides you with the download links. Did you try to download model from those links to check if it matches?
If it still doesn't match, I found out you can manually insert them in the extensions config.json and it will not check further and simply accept what you configured.
I wrote a small powershell to automatically match the models:
$HORDE_CONFIG_PATH = "${PSScriptRoot}/extensions/sd-webui-stable-horde-worker/config.json"
$hordeConfig = Get-Content $HORDE_CONFIG_PATH -Raw -Encoding UTF8 | ConvertFrom-Json
$models = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/main/db.json").Content | ConvertFrom-Json
Set-Location "${PSScriptRoot}/models/Stable-diffusion"
foreach ($model in $models.PSObject.Properties) {
$model_name = $model.Name
if ($hordeConfig.current_models.$model_name) {
continue
}
$model = $model.Value
foreach ($download in $model.config.download) {
if (-not $download.file_url) {
continue
}
$fileName = (($download.file_url.Split('/') | Select-Object -Last 1).Split('.') | Select-Object -First 1) -ireplace "safetensors", ""
$model_name_file = ($model_name -replace ' ', '').ToLowerInvariant()
$includes = @("*${fileName}*", "*${model_name}*", "*${model_name_file}*", "${download.file_name}")
$matches = Get-ChildItem . -Include $includes -Recurse -File | Where-Object { ($_.Extension -eq ".ckpt") -or ($_.Extension -eq ".safetensors") }
$matchedModel = $null
if ($matches.Count -eq 1) {
$matchedModel = $matches
}
elseif ($matches.Count -gt 0) {
$matchedModel = $matches | Sort-Object -Property "CreationTime", "Name" -Descending | Select-Object -First 1
}
if ($matchedModel) {
if ($matchedModel.Count -gt 1) {
Write-Host $matchedModel
}
$modelPath = [string]::Join('\', @((Resolve-Path -Relative $matchedModel.FullName).Split("/\") | Select-Object -Skip 1))
$hordeConfig.current_models | Add-Member -MemberType NoteProperty -Name $model_name -Value $modelPath
}
}
}
[IO.File]::WriteAllLines($HORDE_CONFIG_PATH, (ConvertTo-Json -InputObject $hordeConfig -Depth 10))
Save this as any .ps1 file in your automatic1111 root folder and run it. Afterwards manually check the config.json to see if the model names and actual matched models line up. This only works if you didn't rename the files.
Note that you need to restart a1111 afterwards.
Well your script really does the job. But I intentionally implemented the checksum check to make stable horde a little safer for model abuse. Guess I can't do much about that haha
@athu16 it would be amazing if you could report back to me whether downloading a model from the provided like of @prodigy1 and using this model still gives the same error. π
I think it would be good if we implemented the auto-download feature in our extension (and I tried to do this before), but it is tough to deal with network errors or file systems, it would be nice if there were python libraries that provide simple APIs for downloading files locally without considering network stuffs.
Update: Thanks for your help everyone! The problem was at my end, I downloaded the appropriate model from this list and it works fine now (mostly). (I had to download the v2 in CKPT format, which is the only combination I didn't try earlier)
Now I have a different problem. The script occasionally still says that the model is not supported by stable horde, even if the checksum is correct (verified with the json shared above). Restarting the UI seems to fix the issue temporarily, but sometimes it still says the model is unsupported. (Note that I didn't modify the checkpoints in any way, even the calculated MD5 checksum is the same as what's written in the reference json file).
@athu16 Can you provide me the log in the console? For bug fixing, try to delete models in the config file inside or the extension folder and try again.
How is hosting the inpainting model supposed to work? Figured I'd host only that since there's a huge queue backlog for that model.
I have it named sd-v1-5-inpainting.ckpt which matches the file as it's named on hugging face. Does it need to be in some specific local hugging face directory too? I just have it sitting with the rest of my other models. It gives me the same "Model not found on StableHorde"
Also I see in that db.json that there's not even a hash listed so I can compare to make sure it's exactly the same.
@tpsjr7 according to https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/main/db.json there is no inpainting ckpt. Im not sure if this repo supports that yet. @MaikoTan What do you think?
"stable_diffusion_inpainting": {
"name": "stable_diffusion_inpainting",
"baseline": "stable diffusion 1",
"type": "diffusers",
"description": "Generalist model specialized for modifying areas of existing images",
"version": "1.5",
"style": "inpainting",
"hf_path": "runwayml/stable-diffusion-inpainting",
"hf_auth": false,
"available": false
},
"safety_checker": {
"name": "safety_checker",
"type": "safety_checker",
"description": "Safety checker",
"config": {
"files": [
{
"path": "models/safety_checker/pytorch_model.bin",
"md5sum": "dbbcb50d4df4572a720b104fae1e8187"
},
{
"path": "models/safety_checker/config.json"
},
{
"path": "models/safety_checker/preprocessor_config.json"
}
],
"download": [
{
"file_name": "pytorch_model.bin",
"file_path": "models/safety_checker",
"file_url": "https://huggingface.co/CompVis/stable-diffusion-safety-checker/resolve/main/pytorch_model.bin"
},
{
"file_name": "config.json",
"file_path": "models/safety_checker",
"file_url": "https://huggingface.co/CompVis/stable-diffusion-safety-checker/resolve/main/config.json"
},
{
"file_name": "preprocessor_config.json",
"file_path": "models/safety_checker",
"file_url": "https://huggingface.co/CompVis/stable-diffusion-safety-checker/resolve/main/preprocessor_config.json"
}
]
"available": false
...
So is it this model not available on the Stable Horde anymore, that's why the model cannot be found?
It says false
on every model for some reason. Dont think thats an indicator. I acually thought about downloading the models myself and calculating the hashes, then hosting a custom json
for public usage.
It says
false
on every model for some reason. Dont think thats an indicator. I acually thought about downloading the models myself and calculating the hashes, then hosting a customjson
for public usage.
That means we should keep updating the reference json file that keep reflecting the Stable Horde side. So if there is a way to do the model hashing correctly based on the existing db.json
, we should try to avoid hosting the json ourselves.
If we really need to host the json file, I think we could create a new repository in this organization for this use.
True. So what repro do we use now?
I hit this an tried just about every model the horde client extension lists as available until I hit robodiffusion which just worked. And then deliberate_v2 ckpt. I mostly use safetensors which might be part of the problem but IMHO safetensor support should be a big priority to get working in stable horde.
Ideally the worker extension would have a way to just download a model from supported list. Even if the download is hosted on civitai, huggy face, etc. <-- feature request
@axemaster we would need to host and maintain our own json for safetensors. We currently rely on a json from someone else. But I totally understand, primarily I use safetensors as well.
@theUpsider I have created a new repository here, for putting names and links of models.
Yes, yes, yes, safetensors are good, we should host them.
@theUpsider I have created a new repository here, for putting names and links of models.
Watching
Im still trying to find time for that. If anyone wants to calculate hashes and collect links, go ahead haha
I might do that as I found a lot of mine that I downloaded from civitai are not supported. Not sure what the best way of going about doing that would be. EDIT: I also see a lot of the ones on the network are the ckpt and not the safe tensors. Any plans to move to the safe tensor versions of this so we don't have two of the same model running on the network?
I might do that as I found a lot of mine that I downloaded from civitai are not supported. Not sure what the best way of going about doing that would be. EDIT: I also see a lot of the ones on the network are the ckpt and not the safe tensors. Any plans to move to the safe tensor versions of this so we don't have two of the same model running on the network?
Unfortunately with he link currently implemented, there is no way to to check for safetensors.
Can someone explain to me in simple terms how to get these models working in automatic1111? I have lots of the models being used but the hashes aren't matching despite them being OG files from civitai. Should I be trying ckpt or safetensors? Can't I just put the models in a folder and have it find them? I don't understand why I'm having so much trouble. I don't want to start another issue over the same topic but I need some help.
Can someone explain to me in simple terms how to get these models working in automatic1111? I have lots of the models being used but the hashes aren't matching despite them being OG files from civitai. Should I be trying ckpt or safetensors? Can't I just put the models in a folder and have it find them? I don't understand why I'm having so much trouble. I don't want to start another issue over the same topic but I need some help.
I found a solution to this. It's a PowerShell script that you run when you get new models. I work at night and I am away from my PC. I'll get you that script in a few hours when I am back home.
The script is in this very issue, you can find it here: https://github.com/sdwebui-w-horde/sd-webui-stable-horde-worker/issues/77#issuecomment-1458124022
Stable Horde seems to prefer ckpt files, which is not the best, but that is how it is. The PowerShell tries to match the models by name. So make sure you didn't rename anything. Also double check later in the configuration json if everything is ok.
I noticed the same, though it might be you used a different download source, have the safetensors version or something else.
The URL used to check if the md5s match also provides you with the download links. Did you try to download model from those links to check if it matches?
If it still doesn't match, I found out you can manually insert them in the extensions config.json and it will not check further and simply accept what you configured.
I wrote a small powershell to automatically match the models:
$HORDE_CONFIG_PATH = "${PSScriptRoot}/extensions/sd-webui-stable-horde-worker/config.json" $hordeConfig = Get-Content $HORDE_CONFIG_PATH -Raw -Encoding UTF8 | ConvertFrom-Json $models = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/main/db.json").Content | ConvertFrom-Json Set-Location "${PSScriptRoot}/models/Stable-diffusion" foreach ($model in $models.PSObject.Properties) { $model_name = $model.Name if ($hordeConfig.current_models.$model_name) { continue } $model = $model.Value foreach ($download in $model.config.download) { if (-not $download.file_url) { continue } $fileName = (($download.file_url.Split('/') | Select-Object -Last 1).Split('.') | Select-Object -First 1) -ireplace "safetensors", "" $model_name_file = ($model_name -replace ' ', '').ToLowerInvariant() $includes = @("*${fileName}*", "*${model_name}*", "*${model_name_file}*", "${download.file_name}") $matches = Get-ChildItem . -Include $includes -Recurse -File | Where-Object { ($_.Extension -eq ".ckpt") -or ($_.Extension -eq ".safetensors") } $matchedModel = $null if ($matches.Count -eq 1) { $matchedModel = $matches } elseif ($matches.Count -gt 0) { $matchedModel = $matches | Sort-Object -Property "CreationTime", "Name" -Descending | Select-Object -First 1 } if ($matchedModel) { if ($matchedModel.Count -gt 1) { Write-Host $matchedModel } $modelPath = [string]::Join('\', @((Resolve-Path -Relative $matchedModel.FullName).Split("/\") | Select-Object -Skip 1)) $hordeConfig.current_models | Add-Member -MemberType NoteProperty -Name $model_name -Value $modelPath } } } [IO.File]::WriteAllLines($HORDE_CONFIG_PATH, (ConvertTo-Json -InputObject $hordeConfig -Depth 10))
Save this as any .ps1 file in your automatic1111 root folder and run it. Afterwards manually check the config.json to see if the model names and actual matched models line up. This only works if you didn't rename the files.
Note that you need to restart a1111 afterwards.
@prodigy1
Hey thank you so much for trying to help me. I ran that script yesterday before you commented. When I looked at the file with the hashes it had only hashed my loras and not my models. There is also no explanation in this thread of how the script is supposed to work or what it does.
I'm gonna go read that other thread and hope for the best.
Oh gosh I already read that too.
I tend to read as much as I can before I post. I don't want to look like more of an idiot than I already am.
So I ran the script and it didn't change my config. And it doesn't show any hashes for my models in "hashes.json" - only my loras.
I copied the script and saved it as a ps1 file and it worked, it just didn't do anything I can see is useful.
The script loads the stable diffusion horde config from "${PSScriptRoot}/extensions/sd-webui-stable-horde-worker/config.json". Then it loads the models available in the horde from "https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/main/db.json". Then it iterates over your models in "${PSScriptRoot}/models/Stable-diffusion". If it finds a model that matches a model from the db.json previously downloaded into memory, it adds the model to the "config.json" file in your sd-webui-stable-horde-worker extension folder in the "current_models" key of the json.
If it uses your loras, then you put them in the wrong folder. Also this extension does not have a "hashes.json". What file are you referring to? Are you sure you are using automatic1111 stable diffusion web ui with the stable horde extension?
The PowerShell script needs to be placed in the root of your a1111 web ui installation folder.
It is possible that the script needs adjustment as it was written a few months ago.
@prodigy1
Ok.
Thank you so much for explaining what the script does.
I looked at the config.json in the stablehorde extensions folder and the only model there is the 1.5 base model, but I literally have 175 models in my model folder for stable-diffusion.
When I ran the script I thought two new files were created in my root folder, but it looks like it was just one: Hashes.json. I guess I could be wrong about it being created anew. It contains a list of all of my loras and their hashes. In the list it includes the file/folder path, which is my lora folder. Which brings me to
I didn't put anything in the wrong folder.
I've been using 1111 since last August. I just installed the SH extension day before yesterday. I have run my cards on the horde before, but I set it up myself on two PCs with little trouble.
I ran the script from my root folder.
I have surely communicated some unnecessary things. I obviously had no idea what the script does. I don't know how to read code.
I REALLY appreciate your help.
I find it weird that if the script ran and worked that it wouldn't output some sort of results file. I also find it disappointing that I ran the code and nothing has happened to that config.json in the SH extension folder.
Anything else you'd like for me to do?
The script does not touch any file apart from your sd horde worker extensions "config.json". Any "hashes.json" file that might exist does not come from the script.
If you want to see what it does, try this adjusted script. It is more verbose and tells you what it does.
Make sure to open a powershell window first, navigate to your a1111 installation folder, and then call the script via .\SCRIPTFILENAME.ps1
. Alternatively right click the .ps1 and choose edit. You might have the powershell ISE installed.
$HORDE_CONFIG_PATH = "${PSScriptRoot}/extensions/sd-webui-stable-horde-worker/config.json"
$hordeConfig = Get-Content $HORDE_CONFIG_PATH -Raw -Encoding UTF8 | ConvertFrom-Json
$models = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/main/db.json").Content | ConvertFrom-Json
Set-Location "${PSScriptRoot}/models/Stable-diffusion"
foreach ($model in $models.PSObject.Properties) {
$model_name = $model.Name
if ($hordeConfig.current_models.$model_name) {
continue
}
$model = $model.Value
foreach ($download in $model.config.download) {
if (-not $download.file_url) {
continue
}
$fileName = (($download.file_url.Split('/') | Select-Object -Last 1).Split('.') | Select-Object -First 1) -ireplace "safetensors", ""
$model_name_file = ($model_name -replace ' ', '').ToLowerInvariant()
$includes = @("*${fileName}*", "*${model_name}*", "*${model_name_file}*", "${download.file_name}")
$matches = Get-ChildItem . -Include $includes -Recurse -File | Where-Object { ($_.Extension -eq ".ckpt") -or ($_.Extension -eq ".safetensors") }
$matchedModel = $null
if ($matches.Count -eq 1) {
$matchedModel = $matches
}
elseif ($matches.Count -gt 0) {
$matchedModel = $matches | Sort-Object -Property "CreationTime", "Name" -Descending | Select-Object -First 1
Write-Host "Found multiple possible matches for '${model_name}'. Using the first one found of:"
Write-Host $matches | Select-Object -Property "Name"
}
if ($matchedModel) {
if ($matchedModel.Count -gt 1) {
Write-Host $matchedModel
}
$modelPath = [string]::Join('\', @((Resolve-Path -Relative $matchedModel.FullName).Split("/\") | Select-Object -Skip 1))
Write-Host "Adding '${model_name}' with path '${modelPath}'."
$hordeConfig.current_models | Add-Member -MemberType NoteProperty -Name $model_name -Value $modelPath
}
}
}
Write-Host "New model configuration:"
$hordeConfig.current_models | ConvertTo-Json -Depth 2
Write-Host "Writing config file..."
[IO.File]::WriteAllLines($HORDE_CONFIG_PATH, (ConvertTo-Json -InputObject $hordeConfig -Depth 10))
@prodigy1
I ran this but it finished so quickly I couldn't glean any info. Where is it looking for models? I'm so confused. My config.jason hasn't changed at all. I've downloaded 4 models just to see if the safetensors vs. ckpt made any difference. I have lots of popular models that are up to date - I've checked them against the lists from the horde. Every time I run an MD5 hash on one of the files it has a different hash than is listed here: https://github.com/Haidra-Org/AI-Horde-image-model-reference/blob/main/db.json. Furthermore that page doesn't list versions or full names.
I'm determined to run the horde on my cards while I'm sleeping and I don't want it to be just 1.5, because it kinda sucks. I know people are using it but I want to employ other models as well.
As mentioned previously, it is looking for models in the "models/Stable-diffusion" folder beneath your a1111 installation.
You need to open a PowerShell window first in order to see the output. Hit your Windows Key, type "PowerShell" and open the one that says "Windows PowerShell". Then type cd "C:\Path\To\Your\A1111"
. Then type .\your-script-name.ps1
.
It seems you do not have a lot of experience with either the command shell or coding in general. Therefore it is hard to explain everything via these comments. Please read about command line terminals and powershell in general first.
I can't help you any further through this, please learn more about the topics on your own now. I'm sorry but this isn't a computer users' help channel.
I know where I keep my models and where SD looks for them. As I mention I have about 175 individual models, not including loras and lycoris models. I have about 80 custom blends and custom trained models as well. I've run linux as my main on at least one of my machines for years. I use the command line regularly. I have very rarely used Powershell as I've never needed it.
I said it "finsihed so quickly I couldn't glean any info because the powershell window closed immediately after it failed.
I've run the script twice and it didn't do anything for me. Accept that please... not sure why you aren't reading what I'm writing and then getting haughty - your script did not work for me and I was JUST MAKING SURE before I said so.
So there, take your attitude and shove it somewhere other than at me.
I'm not an idiot and I've done everything you suggested, and I've UNDERSTOOD WHAT I WAS DOING THE ENTIRE TIME.
Your attitude is not very cool.
Peace.
Furthermore, the only solution I've found is to try adding my models one-by-one using the webui and watching the console to see if the hashes match and removing them if they don't. One by one.
And now that I've done that with most of the base models/merges, I'm downloading new versions directly from the URLs at Artbot.
That should be the end of my problem, no thanks to @prodigy1
I mean really the condescending tone started when you assumed I hadn't even read the thread then proceeded to tell me about YOUR awesome script that didn't work for me.
Wow that seems to have deeply disturbed you, I'm sorry I couldn't help you any further. I'm happy you found a solution that works for you.
as I understand the extension does not work, https://raw.githubusercontent.com/db0/AI-Horde-image-model-reference/main/db.json is empty, and any model "but it's not supported by StableHorde" By the way, if you switch from md5sum to sha256 calculation, you don't even need to download anything from civitai, the checksum is listed on the model page. script don't work I found actual horde models SD https://github.com/Haidra-Org/AI-Horde-image-model-reference/blob/stable_diffusion_inpainting/stable_diffusion.json or https://github.com/Haidra-Org/AI-Horde-image-model-reference/blob/stable_diffusion_inpainting/db.json try replace in script but don't work
PS D:\sd\stable-diffusion-webui> .\1.ps1
ConvertFrom-Json : ΠΠ΅Π΄ΠΎΠΏΡΡΡΠΈΠΌΡΠΉ ΠΏΡΠΈΠΌΠΈΡΠΈΠ² JSON: .
D:\sd\stable-diffusion-webui\1.ps1:4 Π·Π½Π°ΠΊ:150
+ ... blob/stable_diffusion_inpainting/db.json").Content | ConvertFrom-Json
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [ConvertFrom-Json], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand
New model configuration:
{
}
Writing config file...
Been a while since I last used the extension so might be some changes that I am not aware off. But seems to be the issue listed here: https://github.com/sdwebui-w-horde/sd-webui-stable-horde-worker/pull/105
Every model I try to load in the web interface gives me the error as example: md5sum for Deliberate.ckpt is 65621076b884a0debcae553aa142e935 but it's not supported by StableHorde
Steps taken: Install A1111 and run it - confirmed working Install the stable horde extension and restart
Now I tried 2 different way to get the correct model.
Try 1. Downloading the correct one from the file here: https://github.com/Haidra-Org/AI-Horde-image-model-reference/blob/main/stable_diffusion.json Which lead me to https://huggingface.co/Airic/mirrors/resolve/main/Deliberate.ckpt
Complains about not supported.
Try 2. Installed the original horde worker bridge from: https://github.com/Haidra-Org/AI-Horde-Worker Let it download the deliberate model and let the worker run a while (which works perfectly fine) Copied the ckpt file to my models folder and ran A1111 again with the same result that the model is not supported.
Ok I asked the devs of Horde about a list of supported models. Preferably including safetensors. We cant be the only repo struggling with that issue.
So guys. It seems we have to simply stick to the https://raw.githubusercontent.com/Haidra-Org/AI-Horde-image-model-reference/main/stable_diffusion.json and revisit the API of the horde.
Is there existing issue for this?
Does this happen on the latest commit?
What happened?
No matter what model I try to use, the script calculates the md5sum, and says that it's not supported by StableHorde. I've tried 1.5 (ckpt), deliberate_v1 (ckpt, safetensors) and deliberate_v2 (safetensors).
Steps to reproduce
No response
What did you expect to happen?
I believe the "not supported by Stable Horde" message shouldn't be there, as the model is clearly being used by the horde, according to https://aqualxx.github.io/stable-ui/dashboard
Stable Diffusion WebUI Commit SHA
0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
What operating system are you seeing the problem on?
Windows 11 / 10 / 8
What browsers are you seeing the problem on?
Firefox, Chrome
Additional information
No response