Skip to content

Commit

Permalink
fix: fix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Oct 24, 2024
1 parent 2b28390 commit cb6ce1b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cpp/bark.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#pragma once
#include "log.h"

#include "log.h"
#include "encodec.h"
#include "ggml-backend.h"
#include "ggml.h"
Expand Down Expand Up @@ -230,7 +230,7 @@ extern "C" {
BARK_API bool bark_model_quantize(
const char *fname_inp,
const char *fname_out,
enum bark_ggml_ftype ftype);
enum bark_bark_ggml_ftype ftype);

/**
* @brief Frees the memory allocated for a bark context.
Expand Down
2 changes: 1 addition & 1 deletion cpp/encodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*
*/
#pragma once
#include "log.h"

#include "log.h"
#include "ggml-alloc.h"
#include "ggml-backend.h"
#include "ggml.h"
Expand Down
19 changes: 19 additions & 0 deletions scripts/bark.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- cpp/bark.h 2024-10-24 20:34:51.828204835 +0800
+++ cpp/bark.h 2024-10-24 22:13:49.632389060 +0800
@@ -17,6 +17,7 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#pragma once

+#include "log.h"
#include "encodec.h"
#include "ggml-backend.h"
#include "ggml.h"
@@ -229,7 +230,7 @@
BARK_API bool bark_model_quantize(
const char *fname_inp,
const char *fname_out,
- enum ggml_ftype ftype);
+ enum bark_ggml_ftype ftype);

/**
* @brief Frees the memory allocated for a bark context.
16 changes: 5 additions & 11 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,19 @@ done

patch -p0 < ./scripts/ggml-alloc.c.patch
patch -p0 < ./scripts/ggml.c.patch
patch -p0 < ./scripts/encodec.h.patch
patch -p0 < ./scripts/bark.h.patch

if [ "$(uname)" == "Darwin" ]; then
SED="sed -i ''"
else
SED="sed -i"
fi

PATCH_LOG_FILES=(
cpp/encodec.h
cpp/encodec.cpp
cpp/bark.h
cpp/bark.cpp
)

PATCH_LOG_FILES=(encodec.cpp bark.cpp)
for file in "${PATCH_LOG_FILES[@]}"; do
filename=$(basename "$file")
$SED 's/fprintf(stderr, /LOGE(/g' "cpp/$filename"
$SED 's/printf(/LOGI(/g' "cpp/$filename"
$SED '/#pragma once/a #include "log.h"' "cpp/$filename"
$SED 's/fprintf(stderr, /LOGE(/g' "cpp/$file"
$SED 's/printf(/LOGI(/g' "cpp/$file"
done

for file in "${FILES[@]}"; do
Expand Down
10 changes: 10 additions & 0 deletions scripts/encodec.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- cpp/encodec.h 2024-10-24 20:34:51.833204870 +0800
+++ cpp/encodec.h 2024-10-24 22:12:41.954029891 +0800
@@ -24,6 +24,7 @@
*/
#pragma once

+#include "log.h"
#include "ggml-alloc.h"
#include "ggml-backend.h"
#include "ggml.h"

0 comments on commit cb6ce1b

Please sign in to comment.