-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Extra backend] Add seperate environment for ttsbark (#1141)
**Description** This PR relates to #1117 **Notes for Reviewers** Same to the latest PR: * The code is also changed, but only the order of the import package parts. And some code comments are also added. * Add a configuration of the `conda` environment * Add a simple test case for testing if the service can be startup in current `conda` environment. It is succeed in VSCode, but the it is not out of box on terminal. So, it is hard to say the test case really useful. **[Signed commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)** - [x] Yes, I signed my commits. <!-- Thank you for contributing to LocalAI! Contributing Conventions ------------------------- The draft above helps to give a quick overview of your PR. Remember to remove this comment and to at least: 1. Include descriptive PR titles with [<component-name>] prepended. We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). 2. Build and test your changes before submitting a PR (`make build`). 3. Sign your commits 4. **Tag maintainer:** for a quicker response, tag the relevant maintainer (see below). 5. **X/Twitter handle:** we announce bigger features on X/Twitter. If your PR gets announced, and you'd like a mention, we'll gladly shout you out! By following the community's contribution conventions upfront, the review process will be accelerated and your PR merged more quickly. If no one reviews your PR within a few days, please @-mention @mudler. --> Signed-off-by: GitHub <[email protected]>
- Loading branch information
Showing
5 changed files
with
164 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.PONY: ttsbark | ||
ttsbark: | ||
@echo "Creating virtual environment..." | ||
@conda env create --name ttsbark --file ttsbark.yml | ||
@echo "Virtual environment created." |
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,16 @@ | ||
# Creating a separate environment for ttsbark project | ||
|
||
``` | ||
make ttsbark | ||
``` | ||
|
||
# Testing the gRPC server | ||
|
||
``` | ||
<The path of your python interpreter> -m unittest test_ttsbark.py | ||
``` | ||
|
||
For example | ||
``` | ||
/opt/conda/envs/bark/bin/python -m unittest extra/grpc/bark/test_ttsbark.py | ||
`````` |
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,32 @@ | ||
import unittest | ||
import subprocess | ||
import time | ||
import backend_pb2 | ||
import backend_pb2_grpc | ||
|
||
import grpc | ||
|
||
class TestBackendServicer(unittest.TestCase): | ||
""" | ||
TestBackendServicer is the class that tests the gRPC service | ||
""" | ||
def setUp(self): | ||
self.service = subprocess.Popen(["python3", "ttsbark.py", "--addr", "localhost:50051"]) | ||
|
||
def tearDown(self) -> None: | ||
self.service.terminate() | ||
self.service.wait() | ||
|
||
def test_server_startup(self): | ||
time.sleep(2) | ||
try: | ||
self.setUp() | ||
with grpc.insecure_channel("localhost:50051") as channel: | ||
stub = backend_pb2_grpc.BackendStub(channel) | ||
response = stub.Health(backend_pb2.HealthMessage()) | ||
self.assertEqual(response.message, b'OK') | ||
except Exception as err: | ||
print(err) | ||
self.fail("Server failed to start") | ||
finally: | ||
self.tearDown() |
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,96 @@ | ||
name: bark | ||
channels: | ||
- defaults | ||
dependencies: | ||
- _libgcc_mutex=0.1=main | ||
- _openmp_mutex=5.1=1_gnu | ||
- bzip2=1.0.8=h7b6447c_0 | ||
- ca-certificates=2023.08.22=h06a4308_0 | ||
- ld_impl_linux-64=2.38=h1181459_1 | ||
- libffi=3.4.4=h6a678d5_0 | ||
- libgcc-ng=11.2.0=h1234567_1 | ||
- libgomp=11.2.0=h1234567_1 | ||
- libstdcxx-ng=11.2.0=h1234567_1 | ||
- libuuid=1.41.5=h5eee18b_0 | ||
- ncurses=6.4=h6a678d5_0 | ||
- openssl=3.0.11=h7f8727e_2 | ||
- pip=23.2.1=py311h06a4308_0 | ||
- python=3.11.5=h955ad1f_0 | ||
- readline=8.2=h5eee18b_0 | ||
- setuptools=68.0.0=py311h06a4308_0 | ||
- sqlite=3.41.2=h5eee18b_0 | ||
- tk=8.6.12=h1ccaba5_0 | ||
- wheel=0.41.2=py311h06a4308_0 | ||
- xz=5.4.2=h5eee18b_0 | ||
- zlib=1.2.13=h5eee18b_0 | ||
- pip: | ||
- accelerate==0.23.0 | ||
- aiohttp==3.8.5 | ||
- aiosignal==1.3.1 | ||
- async-timeout==4.0.3 | ||
- attrs==23.1.0 | ||
- bark==0.1.5 | ||
- boto3==1.28.61 | ||
- botocore==1.31.61 | ||
- certifi==2023.7.22 | ||
- charset-normalizer==3.3.0 | ||
- datasets==2.14.5 | ||
- dill==0.3.7 | ||
- einops==0.7.0 | ||
- encodec==0.1.1 | ||
- filelock==3.12.4 | ||
- frozenlist==1.4.0 | ||
- fsspec==2023.6.0 | ||
- funcy==2.0 | ||
- grpcio==1.59.0 | ||
- huggingface-hub==0.16.4 | ||
- idna==3.4 | ||
- jinja2==3.1.2 | ||
- jmespath==1.0.1 | ||
- markupsafe==2.1.3 | ||
- mpmath==1.3.0 | ||
- multidict==6.0.4 | ||
- multiprocess==0.70.15 | ||
- networkx==3.1 | ||
- numpy==1.26.0 | ||
- nvidia-cublas-cu12==12.1.3.1 | ||
- nvidia-cuda-cupti-cu12==12.1.105 | ||
- nvidia-cuda-nvrtc-cu12==12.1.105 | ||
- nvidia-cuda-runtime-cu12==12.1.105 | ||
- nvidia-cudnn-cu12==8.9.2.26 | ||
- nvidia-cufft-cu12==11.0.2.54 | ||
- nvidia-curand-cu12==10.3.2.106 | ||
- nvidia-cusolver-cu12==11.4.5.107 | ||
- nvidia-cusparse-cu12==12.1.0.106 | ||
- nvidia-nccl-cu12==2.18.1 | ||
- nvidia-nvjitlink-cu12==12.2.140 | ||
- nvidia-nvtx-cu12==12.1.105 | ||
- packaging==23.2 | ||
- pandas==2.1.1 | ||
- peft==0.5.0 | ||
- protobuf==4.24.4 | ||
- psutil==5.9.5 | ||
- pyarrow==13.0.0 | ||
- python-dateutil==2.8.2 | ||
- pytz==2023.3.post1 | ||
- pyyaml==6.0.1 | ||
- regex==2023.10.3 | ||
- requests==2.31.0 | ||
- rouge==1.0.1 | ||
- s3transfer==0.7.0 | ||
- safetensors==0.3.3 | ||
- scipy==1.11.3 | ||
- six==1.16.0 | ||
- sympy==1.12 | ||
- tokenizers==0.14.0 | ||
- torch==2.1.0 | ||
- torchaudio==2.1.0 | ||
- tqdm==4.66.1 | ||
- transformers==4.34.0 | ||
- triton==2.1.0 | ||
- typing-extensions==4.8.0 | ||
- tzdata==2023.3 | ||
- urllib3==1.26.17 | ||
- xxhash==3.4.1 | ||
- yarl==1.9.2 | ||
prefix: /opt/conda/envs/bark |