From 972282d834f1aeb04c2ef61474ac75d6fed3a902 Mon Sep 17 00:00:00 2001 From: zh-plus Date: Mon, 9 Dec 2024 19:04:49 +0800 Subject: [PATCH] Fix CI issues. (#61) --- .github/workflows/ci.yml | 9 +++++++-- README.md | 23 +++++++++++++---------- openlrc/chatbot.py | 4 ++-- poetry.lock | 2 +- pyproject.toml | 2 ++ 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1878e24..d7689f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ "3.9", "3.10", "3.11", "3.12" ] + python-version: [ "3.10", "3.11", "3.12" ] os: [ windows-latest, ubuntu-latest ] defaults: @@ -47,13 +47,18 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 + with: + version: 1.8.4 - name: Install dependencies run: | poetry lock --no-update poetry install poetry run pip uninstall -y faster-whisper - poetry run pip install "faster-whisper @ https://github.com/SYSTRAN/faster-whisper/archive/d57c5b40b06e59ec44240d93485a95799548af50.tar.gz" + poetry run pip install "faster-whisper @ https://github.com/SYSTRAN/faster-whisper/archive/8327d8cc647266ed66f6cd878cf97eccface7351.tar.gz" + - name: Install extra dependencies + run: | poetry run pip install --force-reinstall torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 + poetry run pip install -U typing-extensions - name: Install ffmpeg uses: FedericoCarboni/setup-ffmpeg@v2 diff --git a/README.md b/README.md index cadbd82..1101eaf 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ e.g. [OpenAI-GPT](https://github.com/openai/openai-python), [Anthropic-Claude](h a [specific commit](https://github.com/SYSTRAN/faster-whisper/commit/d57c5b40b06e59ec44240d93485a95799548af50) of faster-whisper, which is not published on PyPI. Install it from source: ```shell - pip install "faster-whisper @ https://github.com/SYSTRAN/faster-whisper/archive/d57c5b40b06e59ec44240d93485a95799548af50.tar.gz" + pip install "faster-whisper @ https://github.com/SYSTRAN/faster-whisper/archive/8327d8cc647266ed66f6cd878cf97eccface7351.tar.gz" ``` ## Installation ⚙️ @@ -72,15 +72,10 @@ e.g. [OpenAI-GPT](https://github.com/openai/openai-python), [Anthropic-Claude](h `ANTHROPIC_API_KEY`. - Add your [Google API Key](https://aistudio.google.com/app/apikey) to environment variable `GOOGLE_API_KEY`. -3. Install latest [fast-whisper](https://github.com/guillaumekln/faster-whisper) from source: - ```shell - pip install "faster-whisper @ https://github.com/SYSTRAN/faster-whisper/archive/8327d8cc647266ed66f6cd878cf97eccface7351.tar.gz" - ``` - -4. Install [ffmpeg](https://ffmpeg.org/download.html) and add `bin` directory +3. Install [ffmpeg](https://ffmpeg.org/download.html) and add `bin` directory to your `PATH`. -5. This project can be installed from PyPI: +4. This project can be installed from PyPI: ```shell pip install openlrc @@ -92,11 +87,21 @@ e.g. [OpenAI-GPT](https://github.com/openai/openai-python), [Anthropic-Claude](h pip install git+https://github.com/zh-plus/openlrc ``` +5. Install latest [fast-whisper](https://github.com/guillaumekln/faster-whisper) from source: + ```shell + pip install "faster-whisper @ https://github.com/SYSTRAN/faster-whisper/archive/8327d8cc647266ed66f6cd878cf97eccface7351.tar.gz" + ``` + 6. Install [PyTorch](https://pytorch.org/get-started/locally/): ```shell pip install --force-reinstall torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124 ``` +7. Fix the `typing-extensions` issue: + ```shell + pip install typing-extensions -U + ``` + ## Usage 🐍 [//]: # (### GUI) @@ -292,10 +297,8 @@ To maintain context between translation segments, the process is sequential for [![Star History Chart](https://api.star-history.com/svg?repos=zh-plus/Open-Lyrics&type=Date)](https://star-history.com/#zh-plus/Open-Lyrics&Date) - ## Citation - ``` @book{openlrc2024zh, title = {zh-plus/openlrc}, diff --git a/openlrc/chatbot.py b/openlrc/chatbot.py index d7a6ca4..4155fbd 100644 --- a/openlrc/chatbot.py +++ b/openlrc/chatbot.py @@ -187,7 +187,7 @@ def __init__(self, model_name='gpt-4o-mini', temperature=1, top_p=1, retry=8, ma self.async_client = AsyncGPTClient( api_key=os.environ['OPENAI_API_KEY'], - http_client=httpx.AsyncClient(proxies=proxy), + http_client=httpx.AsyncClient(proxy=proxy), base_url=base_url_config['openai'] if base_url_config and base_url_config['openai'] else None ) @@ -267,7 +267,7 @@ def __init__(self, model_name='claude-3-5-sonnet-20241022', temperature=1, top_p self.async_client = AsyncAnthropic( api_key=os.environ['ANTHROPIC_API_KEY'], http_client=httpx.AsyncClient( - proxies=proxy + proxy=proxy ), base_url=base_url_config['anthropic'] if base_url_config and base_url_config['anthropic'] else None ) diff --git a/poetry.lock b/poetry.lock index e0883e5..e2e3140 100644 --- a/poetry.lock +++ b/poetry.lock @@ -4396,4 +4396,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.0" python-versions = ">=3.9, <4.0" -content-hash = "5953c3896a72dd85ac40d4450230792e62645dda0be193f67ddbd1f3071c53e9" +content-hash = "d1102c6f94f1aa5248f98efe1ce08ced87b08a88e85661324c6f719554dadf70" diff --git a/pyproject.toml b/pyproject.toml index 71e0f42..55d2ee8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,8 @@ ctranslate2 = "^4.5.0" google-generativeai = "0.8.3" json_repair = "0.25.2" matplotlib = "^3.9.2" +typing-extensions = "^4.12.2" +onnxruntime = "^1.20.0" #torch = ">=2.0.0, !=2.0.1" #torchaudio = "^2.0.0"