style changes and remove spurious runc test call at the bottom
This commit is contained in:
+11
-14
@@ -92,10 +92,10 @@ jobs:
|
|||||||
id: make_build_runfast
|
id: make_build_runfast
|
||||||
run: |
|
run: |
|
||||||
make runfast
|
make runfast
|
||||||
|
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
run: pytest
|
run: pytest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false #necessary, otherwise the matrix breaks
|
fail-fast: false #necessary, otherwise the matrix breaks
|
||||||
matrix:
|
matrix:
|
||||||
arch:
|
arch:
|
||||||
- amd64
|
- amd64
|
||||||
@@ -128,7 +128,7 @@ jobs:
|
|||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
|
||||||
- name: Pip setup
|
- name: Pip setup
|
||||||
if: matrix.arch != 'amd64_arm64'
|
if: matrix.arch != 'amd64_arm64'
|
||||||
run: |
|
run: |
|
||||||
@@ -144,8 +144,8 @@ jobs:
|
|||||||
|
|
||||||
#cross-comiled, cannot be run on host
|
#cross-comiled, cannot be run on host
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
if: matrix.arch != 'amd64_arm64'
|
if: matrix.arch != 'amd64_arm64'
|
||||||
run: pytest
|
run: pytest
|
||||||
|
|
||||||
windows-latest-mingw:
|
windows-latest-mingw:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
@@ -171,15 +171,15 @@ jobs:
|
|||||||
install: mingw-w64-${{matrix.env}}-gcc make
|
install: mingw-w64-${{matrix.env}}-gcc make
|
||||||
|
|
||||||
- name: Build ${{ matrix.sys }} ${{ matrix.env }}
|
- name: Build ${{ matrix.sys }} ${{ matrix.env }}
|
||||||
id: build_mingw
|
id: build_mingw
|
||||||
run: |
|
run: |
|
||||||
make win64
|
make win64
|
||||||
|
|
||||||
- name: Set up Python 3.10
|
- name: Set up Python 3.10
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: "3.10"
|
||||||
|
|
||||||
- name: Pip setup
|
- name: Pip setup
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
@@ -187,10 +187,7 @@ jobs:
|
|||||||
if (Test-Path requirements.txt) {
|
if (Test-Path requirements.txt) {
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Test with pytest
|
- name: Test with pytest
|
||||||
shell: powershell
|
shell: powershell
|
||||||
run: pytest
|
run: pytest
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-7
@@ -30,7 +30,7 @@ def attempt_download_files():
|
|||||||
root_url = "https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K"
|
root_url = "https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K"
|
||||||
need = ["stories260K.bin", "stories260K.pt", "tok512.bin", "tok512.model"]
|
need = ["stories260K.bin", "stories260K.pt", "tok512.bin", "tok512.model"]
|
||||||
for file in need:
|
for file in need:
|
||||||
url = root_url + '/' + file #os.path.join inserts \\ on windows
|
url = root_url + '/' + file #os.path.join inserts \\ on windows
|
||||||
filename = os.path.join(test_ckpt_dir, file)
|
filename = os.path.join(test_ckpt_dir, file)
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
download_file(url, filename)
|
download_file(url, filename)
|
||||||
@@ -46,17 +46,17 @@ def test_runc():
|
|||||||
|
|
||||||
model_path = os.path.join(test_ckpt_dir, "stories260K.bin")
|
model_path = os.path.join(test_ckpt_dir, "stories260K.bin")
|
||||||
tokenizer_path = os.path.join(test_ckpt_dir, "tok512.bin")
|
tokenizer_path = os.path.join(test_ckpt_dir, "tok512.bin")
|
||||||
command = ["./run", model_path, "-z", tokenizer_path, "-t", "0.0", "-n", "200"]
|
command = ["./run", model_path, "-z", tokenizer_path, "-t", "0.0", "-n", "200"]
|
||||||
with open('err.txt', mode='wb') as fe:
|
with open('err.txt', mode='wb') as fe:
|
||||||
with open('stdout.txt', mode='wb') as fo:
|
with open('stdout.txt', mode='wb') as fo:
|
||||||
proc = subprocess.Popen(command, stdout=fo, stderr=fe) #pipe in windows terminal does funny things like replacing \n with \r\n
|
proc = subprocess.Popen(command, stdout=fo, stderr=fe) #pipe in windows terminal does funny things like replacing \n with \r\n
|
||||||
proc.wait()
|
proc.wait()
|
||||||
|
|
||||||
with open('stdout.txt', mode='r') as f:
|
with open('stdout.txt', mode='r') as f:
|
||||||
stdout = f.read()
|
stdout = f.read()
|
||||||
# strip the very last \n that is added by run.c for aesthetic reasons
|
# strip the very last \n that is added by run.c for aesthetic reasons
|
||||||
stdout = stdout[:-1].encode('ascii')
|
stdout = stdout[:-1].encode('ascii')
|
||||||
|
|
||||||
assert stdout == expected_stdout
|
assert stdout == expected_stdout
|
||||||
|
|
||||||
def test_python():
|
def test_python():
|
||||||
@@ -87,5 +87,3 @@ def test_python():
|
|||||||
text = text.encode('ascii') # turn into bytes
|
text = text.encode('ascii') # turn into bytes
|
||||||
|
|
||||||
assert text == expected_stdout
|
assert text == expected_stdout
|
||||||
|
|
||||||
test_runc()
|
|
||||||
Reference in New Issue
Block a user