Skip to content

Commit 50cab30

Browse files
committed
Added rwkv support, separated model types into arch folder, added ext funcs for rwkv into ggml, pushing now to sync with upstream master
1 parent 39640f9 commit 50cab30

35 files changed

+5913
-58
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ models/*
2626
/main
2727
/main-gptneox
2828
/main-oasst
29+
/main-rwkv
2930
/quantize
3031
/quantize-gptneox
32+
/quantize-rwkv
3133
/quantize-stats
3234
/update-llama
3335
/update-gptneox
36+
/update-rwkv
3437
/result
3538
/perplexity
3639
/embedding

Makefile

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Define the default target now so that it is always the first target
2-
default: main main-gptneox main-oasst quantize quantize-gptneox quantize-stats update-llama update-gptneox perplexity embedding vdot
2+
default: main main-gptneox main-oasst main-rwkv quantize quantize-gptneox quantize-rwkv quantize-stats update-llama update-gptneox update-rwkv perplexity embedding vdot
33

44
ifndef UNAME_S
55
UNAME_S := $(shell uname -s)
@@ -187,20 +187,26 @@ ggml.o: ggml.c ggml.h ggml-cuda.h
187187
llama.o: llama.cpp ggml.h ggml-cuda.h llama.h llama-util.h
188188
$(CXX) $(CXXFLAGS) -c $< -o $@
189189

190-
gptneox.o: gptneox/gptneox.cpp ggml.h gptneox/gptneox.h gptneox/gptneox-util.h
190+
gptneox.o: arch/gptneox/gptneox.cpp ggml.h arch/gptneox/gptneox.h arch/gptneox/gptneox-util.h
191+
$(CXX) $(CXXFLAGS) -c $< -o $@
192+
193+
rwkv.o: arch/rwkv/rwkv.cpp ggml.h arch/rwkv/rwkv.h arch/arch-util.h
191194
$(CXX) $(CXXFLAGS) -c $< -o $@
192195

193196
common.o: examples/common.cpp examples/common.h
194197
$(CXX) $(CXXFLAGS) -c $< -o $@
195198

196-
common-gptneox.o: gptneox/common-gptneox.cpp gptneox/common-gptneox.h
199+
common-gptneox.o: arch/gptneox/common-gptneox.cpp arch/gptneox/common-gptneox.h
200+
$(CXX) $(CXXFLAGS) -c $< -o $@
201+
202+
common-rwkv.o: arch/rwkv/common-rwkv.cpp arch/rwkv/common-rwkv.h
197203
$(CXX) $(CXXFLAGS) -c $< -o $@
198204

199205
libllama.so: llama.o ggml.o $(OBJS)
200206
$(CXX) $(CXXFLAGS) -shared -fPIC -o $@ $^ $(LDFLAGS)
201207

202208
clean:
203-
rm -vf *.o main main-oasst main-gptneox quantize quantize-gptneox quantize-stats update-llama update-gptneox perplexity embedding benchmark-matmult save-load-state build-info.h
209+
rm -vf *.o main main-oasst main-gptneox main-rwkv quantize quantize-gptneox quantize-rwkv quantize-stats update-llama update-gptneox update-rwkv perplexity embedding benchmark-matmult save-load-state build-info.h
204210

205211
#
206212
# Examples
@@ -212,13 +218,19 @@ main: examples/main/main.cpp build-info.h ggml.o llama.o common.o $(OBJS)
212218
@echo '==== Run ./main -h for help. ===='
213219
@echo
214220

215-
main-gptneox: gptneox/main-gptneox.cpp build-info.h ggml.o gptneox.o common-gptneox.o $(OBJS)
221+
main-gptneox: arch/gptneox/main-gptneox.cpp build-info.h ggml.o gptneox.o common-gptneox.o $(OBJS)
216222
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
217223
@echo
218224
@echo '==== Run ./main -h for help. ===='
219225
@echo
220226

221-
main-oasst: gptneox/main-oasst.cpp build-info.h ggml.o gptneox.o common-gptneox.o $(OBJS)
227+
main-oasst: arch/gptneox/main-oasst.cpp build-info.h ggml.o gptneox.o common-gptneox.o $(OBJS)
228+
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
229+
@echo
230+
@echo '==== Run ./main -h for help. ===='
231+
@echo
232+
233+
main-rwkv: arch/rwkv/main-rwkv.cpp build-info.h ggml.o rwkv.o common-rwkv.o $(OBJS)
222234
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
223235
@echo
224236
@echo '==== Run ./main -h for help. ===='
@@ -227,7 +239,10 @@ main-oasst: gptneox/main-oasst.cpp build-info.h ggml.o gptneox.o common-gptneox.
227239
quantize: examples/quantize/quantize.cpp build-info.h ggml.o llama.o $(OBJS)
228240
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
229241

230-
quantize-gptneox: gptneox/quantize-gptneox.cpp build-info.h ggml.o gptneox.o $(OBJS)
242+
quantize-gptneox: arch/gptneox/quantize-gptneox.cpp build-info.h ggml.o gptneox.o $(OBJS)
243+
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
244+
245+
quantize-rwkv: arch/rwkv/quantize-rwkv.cpp build-info.h ggml.o rwkv.o $(OBJS)
231246
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
232247

233248
quantize-stats: examples/quantize-stats/quantize-stats.cpp build-info.h ggml.o llama.o $(OBJS)
@@ -236,7 +251,10 @@ quantize-stats: examples/quantize-stats/quantize-stats.cpp build-info.h ggml.o l
236251
update-llama: update-llama.cpp build-info.h ggml.o llama.o $(OBJS)
237252
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
238253

239-
update-gptneox: gptneox/update-gptneox.cpp build-info.h ggml.o gptneox.o $(OBJS)
254+
update-gptneox: arch/gptneox/update-gptneox.cpp build-info.h ggml.o gptneox.o $(OBJS)
255+
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
256+
257+
update-rwkv: arch/rwkv/update-rwkv.cpp build-info.h ggml.o rwkv.o $(OBJS)
240258
$(CXX) $(CXXFLAGS) $(filter-out %.h,$^) -o $@ $(LDFLAGS)
241259

242260
perplexity: examples/perplexity/perplexity.cpp build-info.h ggml.o llama.o common.o $(OBJS)

0 commit comments

Comments
 (0)