-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from certik/namelist2
CI: test fastGPT with LFortran
- Loading branch information
Showing
3 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
patch -p1 < ci/lfortran_namelist.patch | ||
|
||
curl -o model.gguf -L https://huggingface.co/certik/fastGPT/resolve/main/model_fastgpt_124M_v2.gguf | ||
|
||
mkdir lf | ||
cd lf | ||
FC=lfortran CMAKE_PREFIX_PATH=$CONDA_PREFIX cmake -DFASTGPT_BLAS=OpenBLAS -DCMAKE_BUILD_TYPE=Debug .. | ||
make VERBOSE=1 | ||
ln -s ../model.gguf . | ||
time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 ./gpt2 | ||
time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 ./test_basic_input | ||
time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 ./test_more_inputs | ||
cd .. | ||
|
||
mkdir lf-fast | ||
cd lf-fast | ||
FC="lfortran --fast" CMAKE_PREFIX_PATH=$CONDA_PREFIX cmake -DFASTGPT_BLAS=OpenBLAS -DCMAKE_BUILD_TYPE=Release .. | ||
make VERBOSE=1 | ||
ln -s ../model.gguf . | ||
time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 ./gpt2 | ||
time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 ./test_basic_input | ||
time OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 ./test_more_inputs | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
commit 8bc6115d9d2a60dc6af986f0da3b6ca21177d83b | ||
Author: Ondřej Čertík <[email protected]> | ||
Date: Tue Sep 5 13:54:47 2023 -0600 | ||
|
||
Workaround a namelist, which is not supported yet | ||
|
||
diff --git a/driver.f90 b/driver.f90 | ||
index a5fe28a..ff4ae2b 100644 | ||
--- a/driver.f90 | ||
+++ b/driver.f90 | ||
@@ -17,18 +17,9 @@ character(:), allocatable, intent(out) :: input_txt | ||
integer, intent(out) :: n_tokens_to_generate | ||
character(1024) :: input_txt2 | ||
integer :: u, ios | ||
-namelist / input_fastGPT / n_tokens_to_generate | ||
allocate(character(0) :: input_txt) | ||
-input_txt = "" | ||
-open(newunit=u, file=filename, status="old") | ||
-read(u, input_fastGPT) | ||
-do | ||
- read(u, "(a)", iostat=ios) input_txt2 | ||
- if (ios /= 0) exit | ||
- if (len(input_txt) > 0) input_txt = input_txt // char(10) | ||
- input_txt = input_txt // trim(input_txt2) | ||
-end do | ||
-close(u) | ||
+n_tokens_to_generate = 20 | ||
+input_txt = "Alan Turing theorized that computers would one day become very powerful, but even he could not imagine" | ||
end subroutine | ||
|
||
! Skips `amount` bytes from the current position |