Skip to content

Commit d0d5de4

Browse files
phymbertggerganov
andauthored
gguf-split: split and merge gguf per batch of tensors (#6135)
* gguf-split: split and merge gguf files per tensor * gguf-split: build with make toolchain * gguf-split: rename `--split-tensors-size` to `--split-max-tensors`. Set general.split_count KV to all split * split : minor style + fix compile warnings * gguf-split: remove --upload not implemented --------- Co-authored-by: Georgi Gerganov <[email protected]>
1 parent b80cf3b commit d0d5de4

File tree

5 files changed

+510
-0
lines changed

5 files changed

+510
-0
lines changed

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,10 @@ gguf: examples/gguf/gguf.cpp ggml.o $(OBJS)
753753
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
754754
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
755755

756+
gguf-split: examples/gguf-split/gguf-split.cpp ggml.o llama.o $(COMMON_DEPS) $(OBJS)
757+
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
758+
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)
759+
756760
train-text-from-scratch: examples/train-text-from-scratch/train-text-from-scratch.cpp ggml.o llama.o $(COMMON_DEPS) train.o $(OBJS)
757761
$(CXX) $(CXXFLAGS) -c $< -o $(call GET_OBJ_FILE, $<)
758762
$(CXX) $(CXXFLAGS) $(filter-out %.h $<,$^) $(call GET_OBJ_FILE, $<) -o $@ $(LDFLAGS)

examples/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ else()
2121
add_subdirectory(embedding)
2222
add_subdirectory(finetune)
2323
add_subdirectory(gritlm)
24+
add_subdirectory(gguf-split)
2425
add_subdirectory(infill)
2526
add_subdirectory(llama-bench)
2627
add_subdirectory(llava)

examples/gguf-split/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set(TARGET gguf-split)
2+
add_executable(${TARGET} gguf-split.cpp)
3+
install(TARGETS ${TARGET} RUNTIME)
4+
target_link_libraries(${TARGET} PRIVATE common llama ${CMAKE_THREAD_LIBS_INIT})
5+
target_compile_features(${TARGET} PRIVATE cxx_std_11)

examples/gguf-split/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## GGUF split Example
2+
3+
CLI to split / merge GGUF files.
4+
5+
**Command line options:**
6+
7+
- `--split`: split GGUF to multiple GGUF, default operation.
8+
- `--split-max-tensors`: maximum tensors in each split: default(128)
9+
- `--merge`: merge multiple GGUF to a single GGUF.

0 commit comments

Comments
 (0)