Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jstzwj committed Jul 8, 2024
1 parent 0c3935f commit 0d56d4a
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:
- name: Test Olah
run: |
cd ${{ github.workspace }}
python -m unittest discover olah/tests
python -m unittest discover tests
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run-name: Olah GitHub Actions to release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "v*"

jobs:
build:
Expand Down Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Test Olah
run: |
cd ${{ github.workspace }}
python -m unittest discover olah/tests
python -m unittest discover tests
- name: Build Olah
run: |
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ $env:HF_ENDPOINT = "http://localhost:8090"
```

Starting from now on, all download operations in the HuggingFace library will be proxied through this mirror site.
```bash
pip install -U huggingface_hub
```

```python
from huggingface_hub import snapshot_download

Expand All @@ -64,9 +68,6 @@ snapshot_download(repo_id='Qwen/Qwen-7B', repo_type='model',
```

Or you can download models and datasets by using huggingface cli.
```bash
pip install -U huggingface_hub
```

Download GPT2:
```bash
Expand Down
7 changes: 4 additions & 3 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ $env:HF_ENDPOINT = "http://localhost:8090"
```

从现在开始,HuggingFace库中的所有下载操作都将通过此镜像站点代理进行。
```bash
pip install -U huggingface_hub
```

```python
from huggingface_hub import snapshot_download

Expand All @@ -62,9 +66,6 @@ snapshot_download(repo_id='Qwen/Qwen-7B', repo_type='model',
```

或者你也可以使用huggingface cli直接下载模型和数据集.
```bash
pip install -U huggingface_hub
```

下载GPT2:
```bash
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies = [
]

[project.optional-dependencies]
dev = ["black==23.3.0", "pylint==2.8.2"]
dev = ["black==23.3.0", "pylint==2.8.2", "pytest==8.2.2"]

[project.urls]
"Homepage" = "https://github.com/vtuber-plan/olah"
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
fastapi
httpx
pydantic==1.10.8
toml==0.10.2
toml==0.10.2
huggingface_hub==0.23.3
15 changes: 15 additions & 0 deletions tests/simple_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
import subprocess
import time

from huggingface_hub import snapshot_download

def test_simple():
process = subprocess.Popen(['python', '-m', 'olah.server'])

os.environ['HF_ENDPOINT'] = 'http://localhost:8090'
snapshot_download(repo_id='Nerfgun3/bad_prompt', repo_type='dataset',
local_dir='./dataset_dir', max_workers=8)

# 终止子进程
process.terminate()

0 comments on commit 0d56d4a

Please sign in to comment.