Skip to content

Commit

Permalink
Merge pull request #28 from saharNooby/ggml-to-submodule
Browse files Browse the repository at this point in the history
Move ggml to submodule
  • Loading branch information
saharNooby committed Apr 17, 2023
2 parents 678f523 + 82e2faa commit 0a8157d
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 12,732 deletions.
55 changes: 11 additions & 44 deletions .github/workflows/build.yml
Expand Up @@ -9,41 +9,24 @@ on:
required: true
type: boolean
push:
paths: ['.github/workflows/**', '**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.c', '**/*.cpp']
paths: ['.github/workflows/**', '**/CMakeLists.txt', '**/*.h', '**/*.c', '**/*.cpp']
pull_request:
types: [opened, synchronize, edited, reopened, review_requested, ready_for_review]
paths: ['**/CMakeLists.txt', '**/Makefile', '**/*.h', '**/*.c', '**/*.cpp']
paths: ['**/CMakeLists.txt', '**/*.h', '**/*.c', '**/*.cpp']

env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}

jobs:
ubuntu-latest-make:
runs-on: ubuntu-latest

steps:
- name: Clone
id: checkout
uses: actions/checkout@v1

- name: Dependencies
id: depends
run: |
sudo apt-get update
sudo apt-get install build-essential
- name: Build
id: make_build
run: |
make
ubuntu-latest-cmake:
runs-on: ubuntu-latest

steps:
- name: Clone
id: checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Dependencies
id: depends
Expand Down Expand Up @@ -85,31 +68,15 @@ jobs:
path: |
rwkv-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip
macOS-latest-make:
runs-on: macos-latest

steps:
- name: Clone
id: checkout
uses: actions/checkout@v1

- name: Dependencies
id: depends
run: |
brew update
- name: Build
id: make_build
run: |
make
macOS-latest-cmake:
runs-on: macOS-latest

steps:
- name: Clone
id: checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Dependencies
id: depends
Expand Down Expand Up @@ -167,7 +134,9 @@ jobs:
steps:
- name: Clone
id: checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Build
id: cmake_build
Expand Down Expand Up @@ -222,9 +191,7 @@ jobs:
runs-on: ubuntu-latest

needs:
- ubuntu-latest-make
- ubuntu-latest-cmake
- macOS-latest-make
- macOS-latest-cmake
- windows-latest-cmake

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "ggml"]
path = ggml
url = https://github.com/saharNooby/ggml
11 changes: 5 additions & 6 deletions CMakeLists.txt
Expand Up @@ -222,13 +222,12 @@ endif()
# Build libraries
#

add_library(ggml OBJECT
ggml.c
ggml.h)
if (MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif()

add_subdirectory(ggml)

target_include_directories(ggml PUBLIC .)
target_compile_features(ggml PUBLIC c_std_11) # don't bump
target_link_libraries(ggml PRIVATE Threads::Threads ${RWKV_EXTRA_LIBS})
if (BUILD_SHARED_LIBS)
set_target_properties(ggml PROPERTIES POSITION_INDEPENDENT_CODE ON)
endif()
Expand Down
229 changes: 0 additions & 229 deletions Makefile

This file was deleted.

10 changes: 5 additions & 5 deletions README.md
Expand Up @@ -12,7 +12,7 @@ Loading LoRA checkpoints in [Blealtan's format](https://github.com/Blealtan/RWKV

**TODO (contributions welcome!)**:

1. Optimize AVX2 implementation of `Q4_1_O` matmul — currently, it is as slow as `FP32`
1. Optimize AVX2 implementation of `Q4_1_O` matmul — currently, it is 40% slower than `Q4_1`
2. Measure latency and perplexity of different model sizes (169M to 14B) and data types (`FP32`, `FP16`, `Q4_0`, `Q4_1`, `Q4_1_O`)
3. Test on Linux (including Colab) and MacOS
4. Make required memory calculation more robust (see [#4](https://github.com/saharNooby/rwkv.cpp/issues/4))
Expand All @@ -24,7 +24,7 @@ Loading LoRA checkpoints in [Blealtan's format](https://github.com/Blealtan/RWKV
**Requirements**: [git](https://gitforwindows.org/).

```commandline
git clone https://github.com/saharNooby/rwkv.cpp.git
git clone --recursive https://github.com/saharNooby/rwkv.cpp.git
cd rwkv.cpp
```

Expand Down Expand Up @@ -91,9 +91,9 @@ python rwkv/quantize.py ~/Downloads/rwkv.cpp-169M.bin ~/Downloads/rwkv.cpp-169M-

Formats available:

- `4`: `Q4_1_O`, best quality, very slow (as `FP32`).
- `3`: `Q4_1`, poor quality, very fast (as `FP16`).
- `2`: `Q4_0`, worst quality, breaks larger models, moderately fast (between `FP16` and `FP32`).
- `4`: `Q4_1_O`, best quality, slow (30% slower than `FP16`).
- `3`: `Q4_1`, poor quality, fast (comparable to `FP16`).
- `2`: `Q4_0`, worst quality, breaks larger models, very fast.

### 4. Run the model

Expand Down
1 change: 1 addition & 0 deletions ggml
Submodule ggml added at 4856b5

0 comments on commit 0a8157d

Please sign in to comment.