-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add schema for the plugin, closes #3
- Loading branch information
Showing
8 changed files
with
118 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ init_ac_plugin_option(TORTOISE) | |
####################################### | ||
# packages | ||
|
||
add_ac_local(0.1.3) | ||
add_ac_local(0.1.4) | ||
CPMAddPackage(gh:iboB/[email protected]) | ||
CPMAddPackage(gh:iboB/[email protected]) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ add_ac_local_plugin( | |
LocalTortoise.cpp | ||
LIBRARIES | ||
ac::tortoise | ||
ac::tortoise.cpp-schema | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright (c) Alpaca Core | ||
# SPDX-License-Identifier: MIT | ||
# | ||
add_executable(ac-tortoise.cpp-schema-gen) | ||
target_sources(ac-tortoise.cpp-schema-gen PRIVATE | ||
schema-gen.cpp | ||
) | ||
target_link_libraries(ac-tortoise.cpp-schema-gen PRIVATE | ||
ac::tortoise.cpp-schema | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (c) Alpaca Core | ||
// SPDX-License-Identifier: MIT | ||
// | ||
#include <ac/schema/TortoiseCpp.hpp> | ||
#include <ac/schema/GenerateLoaderSchemaDict.hpp> | ||
#include <iostream> | ||
|
||
int main() { | ||
auto d = ac::local::schema::generateLoaderSchema<acnl::ordered_json, ac::local::schema::TortoiseCppLoader>(); | ||
std::cout << d.dump(2) << std::endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Copyright (c) Alpaca Core | ||
# SPDX-License-Identifier: MIT | ||
# | ||
add_library(ac-tortoise.cpp-schema INTERFACE) | ||
add_library(ac::tortoise.cpp-schema ALIAS ac-tortoise.cpp-schema) | ||
target_link_libraries(ac-tortoise.cpp-schema INTERFACE ac::schema) | ||
target_include_directories(ac-tortoise.cpp-schema INTERFACE .) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) Alpaca Core | ||
// SPDX-License-Identifier: MIT | ||
// | ||
#pragma once | ||
#include <ac/schema/Field.hpp> | ||
#include <ac/Dict.hpp> | ||
#include <vector> | ||
#include <string> | ||
#include <tuple> | ||
|
||
namespace ac::local::schema { | ||
|
||
struct TortoiseCppInterface { | ||
static inline constexpr std::string_view id = "tortoise.cpp"; | ||
static inline constexpr std::string_view description = "ilib-ac-tortoise.cpp-specific interface"; | ||
|
||
struct OpTTS { | ||
static inline constexpr std::string_view id = "tts"; | ||
static inline constexpr std::string_view description = "Run the tortoise.cpp inference and produce audio"; | ||
|
||
struct Params { | ||
Field<std::string> text; | ||
Field<std::string> voicePath; | ||
|
||
template <typename Visitor> | ||
void visitFields(Visitor& v) { | ||
v(text, "text", "Text to generate audio from"); | ||
v(voicePath, "voicePath", "Path to the voice model"); | ||
} | ||
}; | ||
|
||
struct Return { | ||
Field<ac::Blob> result; | ||
|
||
template <typename Visitor> | ||
void visitFields(Visitor& v) { | ||
v(result, "result", "Audio of the text"); | ||
} | ||
}; | ||
}; | ||
|
||
using Ops = std::tuple<OpTTS>; | ||
}; | ||
|
||
struct TortoiseCppLoader { | ||
static inline constexpr std::string_view id = "tortoise.cpp"; | ||
static inline constexpr std::string_view description = "Inference based on our fork of https://github.com/ggerganov/tortoise.cpp"; | ||
|
||
using Params = nullptr_t; | ||
|
||
struct InstanceGeneral { | ||
static inline constexpr std::string_view id = "general"; | ||
static inline constexpr std::string_view description = "General instance"; | ||
|
||
using Params = nullptr_t; | ||
|
||
using Interfaces = std::tuple<TortoiseCppInterface>; | ||
}; | ||
|
||
using Instances = std::tuple<InstanceGeneral>; | ||
}; | ||
|
||
} // namespace ac::local::schema |