summaryrefslogtreecommitdiff
path: root/examples/train-text-from-scratch/convert-train-checkpoint-to-gguf.py
diff options
context:
space:
mode:
authorKerfuffle <44031344+KerfuffleV2@users.noreply.github.com>2023-08-31 16:49:24 -0600
committerGitHub <noreply@github.com>2023-08-31 16:49:24 -0600
commitaeefac4ff760acea5afe66fbfe8d7eca1937b79c (patch)
tree785cbf67f86773165b1d31471233a5539c6d67a1 /examples/train-text-from-scratch/convert-train-checkpoint-to-gguf.py
parente8422de39e4aa2f7e50574124b060a80607e654a (diff)
scripts: Use local gguf package when running from repo (#2927)
* scripts: Use local gguf when running from repo
Diffstat (limited to 'examples/train-text-from-scratch/convert-train-checkpoint-to-gguf.py')
-rw-r--r--examples/train-text-from-scratch/convert-train-checkpoint-to-gguf.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/train-text-from-scratch/convert-train-checkpoint-to-gguf.py b/examples/train-text-from-scratch/convert-train-checkpoint-to-gguf.py
index 01b3ee92..a527d615 100644
--- a/examples/train-text-from-scratch/convert-train-checkpoint-to-gguf.py
+++ b/examples/train-text-from-scratch/convert-train-checkpoint-to-gguf.py
@@ -2,13 +2,16 @@
# train-text-from-scratch checkpoint --> gguf conversion
import argparse
-import gguf
import os
import struct
import sys
import numpy as np
from pathlib import Path
+if 'NO_LOCAL_GGUF' not in os.environ:
+ sys.path.insert(1, str(Path(__file__).parent / '..' / '..' / 'gguf-py' / 'gguf'))
+import gguf
+
# gguf constants
LLM_KV_OPTIMIZER_TYPE = "optimizer.type"
LLM_KV_OPTIMIZER_TYPE_ADAM = "adam"