Skip to content

Commit 6e8f0ac

Browse files
committed
tries to point submodule at fork, adds command line args
1 parent 18abb6f commit 6e8f0ac

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.gitmodules

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
[submodule "ggml"]
22
path = ggml
33
url = [email protected]:ggerganov/ggml.git
4+
[submodule "ggml/"]
5+
url = https://github.com/balisujohn/ggml.git

ggml

Submodule ggml updated from 2aae01f to 5e92393

main.cpp

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4710,7 +4710,7 @@ std::vector<float> load_f32_vector(const std::string& filename, size_t nBytes) {
47104710
}
47114711

47124712

4713-
std::pair<std::vector<std::vector<float>>, std::vector<std::vector<int>>> autoregressive(std::vector<gpt_vocab::id> tokens)
4713+
std::pair<std::vector<std::vector<float>>, std::vector<std::vector<int>>> autoregressive(std::vector<gpt_vocab::id> tokens, std::string voice_path)
47144714
{
47154715

47164716

@@ -4870,7 +4870,7 @@ std::pair<std::vector<std::vector<float>>, std::vector<std::vector<int>>> autore
48704870
struct ggml_tensor *auto_conditioning_tensor = ggml_graph_get_tensor(gf, "auto_conditioning");
48714871

48724872

4873-
std::vector<float> auto_conditioning_vector = load_f32_vector("../models/mol.bin", 4096);
4873+
std::vector<float> auto_conditioning_vector = load_f32_vector(voice_path, 4096);
48744874

48754875
ggml_backend_tensor_set(auto_conditioning_tensor, auto_conditioning_vector.data(), 0, 1024*ggml_element_size(auto_conditioning_tensor));
48764876

@@ -5889,7 +5889,7 @@ void test_autoregressive(){
58895889

58905890
std::vector<gpt_vocab::id> tokens = ::parse_tokens_from_string("255,15,55,49,9,9,9,2,134,16,51,31,2,19,46,18,176,13,0,0", ','); //"Based... Dr. Freeman?"
58915891

5892-
std::pair<std::vector<std::vector<float>>, std::vector<std::vector<int>>> autoregressive_result = autoregressive(tokens);
5892+
std::pair<std::vector<std::vector<float>>, std::vector<std::vector<int>>> autoregressive_result = autoregressive(tokens, "../models/mol.bin");
58935893

58945894
std::vector<std::vector<float>> trimmed_latents = autoregressive_result.first;
58955895
std::vector<std::vector<int>> sequences = autoregressive_result.second;
@@ -5960,6 +5960,29 @@ int main(int argc, char ** argv) {
59605960

59615961

59625962

5963+
std::string defaultMessage = "this is a test message.";
5964+
std::string defaultVoicePath = "../models/mol.bin";
5965+
std::string defaultOutputPath = "./output.wav";
5966+
std::string message = defaultMessage;
5967+
std::string voicePath = defaultVoicePath;
5968+
std::string outputPath = defaultOutputPath;
5969+
5970+
// Parse command line arguments
5971+
for (int i = 1; i < argc - 1; ++i) {
5972+
if (std::string(argv[i]) == "--voice") {
5973+
voicePath = argv[i + 1];
5974+
} else if (std::string(argv[i]) == "--message") {
5975+
message = argv[i + 1];
5976+
} else if (std::string(argv[i]) == "--output") {
5977+
outputPath = argv[i + 1];
5978+
}
5979+
}
5980+
5981+
// Use the updated values
5982+
std::cout << "Message: " << message << std::endl;
5983+
std::cout << "Voice Path: " << voicePath << std::endl;
5984+
5985+
59635986

59645987
gpt_vocab vocab;
59655988
gpt_vocab_init("../models/tokenizer.json", vocab);
@@ -5972,7 +5995,7 @@ int main(int argc, char ** argv) {
59725995

59735996
//std::string message = "this[SPACE]is[SPACE]a[SPACE]test[SPACE]message";
59745997
//std::string message = "tortoise, full process complete.";
5975-
std::string message = "minimum viable product incoming.";
5998+
//std::string message = "minimum viable product incoming.";
59765999

59776000

59786001
replaceAll(message, " " ,"[SPACE]");
@@ -5996,7 +6019,7 @@ int main(int argc, char ** argv) {
59966019
//std::vector<gpt_vocab::id> tokens = ::parse_tokens_from_string("255,15,55,49,9,9,9,2,134,16,51,31,2,19,46,18,176,13,0,0", ','); //"Based... Dr. Freeman?"
59976020

59986021

5999-
std::pair<std::vector<std::vector<float>>, std::vector<std::vector<int>>> autoregressive_result = autoregressive(tokens);
6022+
std::pair<std::vector<std::vector<float>>, std::vector<std::vector<int>>> autoregressive_result = autoregressive(tokens,voicePath);
60006023

60016024
std::vector<std::vector<float>> trimmed_latents = autoregressive_result.first;
60026025
std::vector<std::vector<int>> sequences = autoregressive_result.second;
@@ -6100,7 +6123,7 @@ int main(int argc, char ** argv) {
61006123
extract_tensor_to_vector( vocoder_gf->nodes[vocoder_gf->n_nodes -1] , audio);
61016124

61026125

6103-
writeWav("based?.wav", audio , 24000);
6126+
writeWav(outputPath.c_str(), audio , 24000);
61046127

61056128

61066129

0 commit comments

Comments
 (0)