Particle1904 / DatasetHelpers

Dataset Helper program to automatically select, re scale and tag Datasets (composed of image and text) for Machine Learning training.
MIT License
170 stars 9 forks source link

Issue with Joytag (file missing) #14

Closed CognitiveDiffusion closed 8 months ago

CognitiveDiffusion commented 8 months ago

Thanks a lot for the update!

I wanted to try Joytagger right away, but I get the following error:

Exception Details
=================
Date and Time: 2024-02-18 11:27:17
Source: System.Private.CoreLib
Message: Could not find a part of the path 'C:\Users\REDACTED\Downloads\normalized_csharp.txt'.
Help Link: 
HResult: -2147024893

Stack Trace
============
   at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.File.WriteAllLines(String path, IEnumerable`1 contents, Encoding encoding)
   at SmartData.Lib.Services.ImageProcessorService.ProcessImageForJoyTagPredictionAsync(String inputPath) in I:\dev\DatasetHelpers\SmartData.Lib\Services\ImageProcessorService.cs:line 383
   at SmartData.Lib.Services.JoyTagAutoTaggerService.GetPredictionAsync(String inputImagePath) in I:\dev\DatasetHelpers\SmartData.Lib\Services\JoyTagAutoTaggerService.cs:line 28
   at SmartData.Lib.Services.JoyTagAutoTaggerService.GetOrderedByScoreListOfTagsAsync(String imagePath, Boolean weightedCaptions) in I:\dev\DatasetHelpers\SmartData.Lib\Services\JoyTagAutoTaggerService.cs:line 38
   at SmartData.Lib.Services.BaseAutoTaggerService`2.PostProcessTags(String outputPath, Boolean weightedCaptions, String file) in I:\dev\DatasetHelpers\SmartData.Lib\Services\BaseAutoTaggerService.cs:line 200
   at SmartData.Lib.Services.BaseAutoTaggerService`2.GenerateTags(String inputPath, String outputPath, Boolean weightedCaptions) in I:\dev\DatasetHelpers\SmartData.Lib\Services\BaseAutoTaggerService.cs:line 103
   at DatasetProcessor.ViewModels.GenerateTagsViewModel.MakePredictionsAsync() in I:\dev\DatasetHelpers\DatasetProcessor\ViewModels\GenerateTagsViewModel.cs:line 137

Target Site
============
Declaring Type: Microsoft.Win32.SafeHandles.SafeFileHandle
Method Name: CreateFile

Additional Information
======================
Particle1904 commented 8 months ago

wait, did you build or downloaded the release?

Particle1904 commented 8 months ago

ohhhhhhh nvm

Particle1904 commented 8 months ago

Its a debug line that I forgot to remove

Particle1904 commented 8 months ago

I've uploaded a Hotfix version, can you try it out and reply back here? Thanks!

https://github.com/Particle1904/DatasetHelpers/releases/tag/v2.1.0

CognitiveDiffusion commented 8 months ago

It worked now. Thanks.

CognitiveDiffusion commented 8 months ago

My first test run with Joytagger didn't look better than the old taggers though (and the community is stepping away from pure danbooru tagging).

Did you consider integrating more modern Taggers like CogVLM?

Particle1904 commented 8 months ago

Its definitively better than WD 1.4 but it is still limited.

I have considered other types of taggers and captioners but I don't have the knowledge to implement inference for them. Unfortunately its not as simple as loading the file and running a single line of code like in Python; I have to implement everything the model needs from pre-processing to post-processing, lets not even get started on tokenization; I cannot wrap my head around how to implement tokenization. It took me 3 hours to figure out that I need to pass the outputs of JoyTag through a Sigmoid function which is something that the WD 1.4 model already does by itself. I have to process the image in a format that the model will understand, and every single one of the 3 models currently supported needs a different format and I imagine this is also true for other types of models. The main problem for me is Tokenization, currently there's a single library I've found for C# that does tokenization for BERT models and that about it.

CognitiveDiffusion commented 8 months ago

Thank you for that indepth explanation. It's much appreciated.

Particle1904 commented 8 months ago

You welcome, I'll probably try again in the future cus I'm personally interested in having better tools.