GithubHelp home page GithubHelp logo

axodox / axodox-machinelearning Goto Github PK

View Code? Open in Web Editor NEW
589.0 13.0 33.0 10.95 MB

This repository contains a pure C++ ONNX implementation of multiple offline AI models, such as StableDiffusion (1.5 and XL), ControlNet, Midas, HED and OpenPose.

License: MIT License

C++ 96.62% C 1.80% PowerShell 1.59%
cpp image-generation mit-license native nuget onnx stable-diffusion directml controlnet holistically-nested-edge-detection

axodox-machinelearning's People

Contributors

axodox avatar lmagder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

axodox-machinelearning's Issues

NuGet fails with fresh Unreal Engine 5.2 Project

Hello!
Very excited for this project!

Attempting to add Axodox.Common via NuGet to an Unreal Engine 5 project fails with the following error:

Severity Code Description Project File Line Suppression State
Error The expression "[System.IO.Directory]::GetFiles(P:\Unreal\TestProject\packages\Axodox.Common.1.0.14\build\native....\lib\desktop\x64\Development_Editor, *.lib)" cannot be evaluated. Could not find a part of the path 'P:\Unreal\TestProject\packages\Axodox.Common.1.0.14\lib\desktop\x64\Development_Editor'. P:\Unreal\TestProject\packages\Axodox.Common.1.0.14\build\native\Axodox.Common.targets

This is after setting the C++ standard to C++20 in visual studio as well as:

public class TestProject: ModuleRules
{
	public TestProject(ReadOnlyTargetRules Target) : base(Target)
	{
		CppStandard = CppStandardVersion.Cpp20
                ...

Can't build project, looks like there's at least one unlisted dependency

Hi,
I made sure I have all the dependencies listed in the readme, but I still can't build the project. It looks like there's at least one more dependency that I need to install, but I have no idea what it might be. Build output (see attached file for entire output):

Build started...
1>------ Build started: Project: Axodox.MachineLearning.Desktop, Configuration: Debug x64 ------
1>pch.cpp
1>C:\github2\axodox-machinelearning\packages\Axodox.Common.1.0.12\include\Graphics\Devices\GraphicsTypes.h(7,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\github2\axodox-machinelearning\packages\Axodox.Common.1.0.12\include\Graphics\Devices\GraphicsTypes.h(7,25): error C2146: syntax error: missing ';' before identifier 'IDXGIFactoryT'
1>C:\github2\axodox-machinelearning\packages\Axodox.Common.1.0.12\include\Graphics\Devices\GraphicsTypes.h(8,38): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\github2\axodox-machinelearning\packages\Axodox.Common.1.0.12\include\Graphics\Devices\GraphicsTypes.h(8,25): error C2146: syntax error: missing ';' before identifier 'IDXGIAdapterT'
// more errors follow ...

Looks like for whatever reason, the symbols in GraphicsTypes.h (IDXGIFactory4, IDXGIAdapter3, ID3D11Device5, etc) are undefined.
BuildErrors.txt

Should StableDiffusionTest.cpp generate an image?

It compiles fine, but does not generate anything (not sure if it is meant to).
I also wonder where I have to put the model files exactly for that (libfolder)...
What I would like to do: Run stable diffusion with Open Frameworks (maybe as an addon - there is already one for .onnx files).
For that I do not need Axodox::Graphics, because I would copy the pixels of the resulting tensor to an openGL texture...

Is it possible to use library without WinRt?

Recently I tried to use library in my console application. It is important to note that application is not UWP based. Unfortunately I encountered error - Exception thrown at 0x00007FFD7857CF19 (KernelBase.dll) in Console.exe: WinRT originate error - 0x80073D54 : 'The process has no package identity.'. It seems like that WinRt restricts model of application. Is there any way to exclude usage of Winrt? or another way to combine WinRt library with non uwp application?

LoRA support

Is there any way to use LoRA models with the library? Should be they converted like main models?

Failed to set to the execution context

Hi axodox,

I want to run the test, but all of the test results show "Failed to set to the execution context."

I have run update_dependencies.ps1 and build_nuget.ps1.

Did I miss something?

Thanks!

[Feature Request] Support v-prediction

Some SD finetunes (and the official Stable Diffusion 2) use v-prediction because they observe that it's better
Currently, v-prediction models will export with Olive and run fine with the ONNX diffusers pipeline, but not here. This is "a castle" on one I exported
a castle - euler unmod

I tried modifying DpmPlusPlus2MScheduler::ApplyStep by modifying the predictedOriginalSample based off one of the diffusers implementations

        auto predictedOriginalSample = output.BinaryOperation<float>(input, [currentSigma](float a, float b) {
            float sigmaSquared = currentSigma * currentSigma;
            return (a * (-currentSigma / sqrt(sigmaSquared + 1))) + (b / sqrt(sigmaSquared + 1));
            });

I could only make the result semi-coherent

In DPMPlusPlus2MScheduler, the formula from HF's euler discrete works

        auto predictedOriginalSample = output.BinaryOperation<float>(input, [currentSigma](float model_output, float sample){
            float sigmaSquaredPlusOne = currentSigma * currentSigma + 1;
            return (model_output * (-currentSigma / std::sqrt(sigmaSquaredPlusOne))) + (sample / sigmaSquaredPlusOne);
            });

a castle - dpm fix

If you could finish this (haven't figured out EulerAncestralScheduler) (I have everything here), it would greatly improve compatibility. I uploaded the model in case it's useful.

How to set the enviroment variable to use the library

Hello,

I'd like to ask for clarification on how to set up the following instructions specifically.

Once you have built the library, you override your existing nuget package install by setting the AxodoxMachineLearning-Location environment variable to point to your local build.

For example C:\dev\axodox-machinelearning\Axodox.MachineLearning.Universal for an UWP app and C:\dev\axodox-machinelearning\Axodox.MachineLearning.Desktop for a desktop app.

Then add the project pointed by the path to the solution of your own project. This allows to add all projects into the same solution and make changes on the library and your app seamlessly without copying files repeatedly.

I'm not very familiar with these, so I apologize for any inconvenience. Thank you for your assistance.

custom_op_cliptok.onnx

where do I find this model? Seems like it's hardcoded into TextTokenizer::TextTokenizer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.