old changes

This commit is contained in:
Dobromir Popov 2023-08-23 12:43:43 +00:00
parent 88e9353b03
commit ba9389e7b0
19 changed files with 4319 additions and 64 deletions

View File

@ -1,34 +1,34 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile
{
"name": "Node.js",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/javascript-node:0-18",
"build": { "dockerfile": "../Dockerfile" },
"postStartCommand": "npm start",
//"postStartCommand": "cd web; ls; node server.js",
// "postStartCommand": "docker buildx install",
"name": "Existing Dockerfile",
"build": {
//container name
"containerName": "artiai-dalailama.dev",
// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "3.10"
}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {
// },
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
//"forwardPorts": [ "28080:8080", "28081:8081"],
// tell vscode to forward the port 8080 to the container to random local port
"appPort": ["28080:8080", "28081:8081"],
"remoteEnv": {
"TTS_BACKEND_URL": "http://192.168.0.10:9008/asr",
//"WS_URL":"ws://192.168.0.10:28081"
"WS_URL":"wss://ws.ai.d-popov.com"
}
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "npm install ws express request",
// "forwardPorts": [],
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
//"runArgs": ["-it"]
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}

8
.env.production Normal file
View File

@ -0,0 +1,8 @@
#TTS_BACKEND_URL=http://192.168.0.10:9009/asr #cpu 9008-gpu
TTS_BACKEND_URL=http://localhost:9001/asr #gpu 9002-cpu
TTS_BACKEND_URL2=http://localhost:9002/asr
TTS_BACKEND_URL3=http://192.168.0.10:9008/asr #gpu
TTS_BACKEND_URL4=http://192.168.0.10:9009/asr #cpu 9008-gpu
WS_URL=ws://localhost:8081
SERVER_PORT_WS=8081
SERVER_PORT_HTTP=8080

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
node_modules/*
node_modules/
package-lock.json
rec/*

View File

@ -54,13 +54,20 @@
# oriiginal
FROM node:lts-alpine
FROM node:current-alpine
# current-alpine
ENV NODE_ENV=production
WORKDIR /app
# RUN npm install -g npm@9.6.2
# RUN apk update && apk add bash
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
# RUN npm install --production --silent
# && mv node_modules ../
COPY . .
EXPOSE 8080 8081
RUN chown -R node /app
# RUN npm install dalai
USER node
CMD ["npm", "start"]

View File

@ -0,0 +1,74 @@
# FROM node:18
# # Install basic development tools
# RUN apt update && apt install -y less man-db sudo
# # Ensure default `node` user has access to `sudo`
# ARG USERNAME=node
# RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
# && chmod 0440 /etc/sudoers.d/$USERNAME
# # WORKDIR /app
# # COPY package*.json ./
# # RUN npm install --production --silent
# # RUN npm install --production --silent && mv node_modules ../
# # RUN npm cache clean --force
# # RUN npm install
#############################################################################################################
# new dockerfile
# # Use the latest Node.js LTS version as the base image
# FROM node:lts
# # Copy the package.json and package-lock.json files to the working directory
# # Set the working directory to /app
# WORKDIR /app
# # RUN npm install -g npm@9.6.2
# COPY package*.json ./
# # Install all dependencies from package.json
# # RUN npm install
# EXPOSE 3000
# # RUN npx dalai alpaca install 7B
# # COPY . .
# # Set `DEVCONTAINER` environment variable to help with orientation
# ENV DEVCONTAINER=true
# FROM alpaca-7b:latest
# EXPOSE 3003
FROM node:18
RUN apt-get update
# RUN apk update && apk add bash
# RUN apk search python3
# RUN apk info -a python3
# RUN apk add build-base
# RUN apk add --no-cache python3==3.10.10-r0
WORKDIR /app
# RUN npm install -g npm@9.6.2
COPY package.json .
RUN npm install
# RUN npm install dalai
RUN npx dalai llama install 7B
RUN npx dalai alpaca install 7B
COPY . .
EXPOSE 3000
CMD [ "npx", "dalai", "serve" ]
#root@DBSpare:/mnt/apps/DEV/arti-ai/agent-node/.devcontainer# docker build -t alpaca-7b.dev .
# docker run -p 3003:3003 -it alpaca-7b.dev
# upload to docker hub
# docker tag alpaca-7b.dev:latest dobromirpopov/alpaca-7b.dev:latest
# docker push dobromirpopov/alpaca-7b.dev:latest

View File

@ -0,0 +1,18 @@
// See https://containers.dev/implementors/json_reference/ for configuration reference
{
"name": "Untitled Node.js project",
"build": {
//container name
"containerName": "agent-node.lama.dev",
"dockerfile": "Dockerfile"
},
"remoteUser": "node",
"features": {
// "ghcr.io/devcontainers/features/python:1": {
// "installTools": true,
// "version": "3.10"
// }
},
"postCreateCommand": "npx dalai serve"
// "postCreateCommand": ["npm install dalai", "npx dalai alpaca install 7B" ]
}

View File

@ -0,0 +1,7 @@
{
"name": "kevin-ai-alpaca",
"version": "1.0.0",
"dependencies": {
"dalai": "^0.2.50"
}
}

7
agent-node/package.json Normal file
View File

@ -0,0 +1,7 @@
{
"name": "kevin-ai-alpaca",
"version": "1.0.0",
"dependencies": {
"dalai": "^0.2.50"
}
}

View File

@ -0,0 +1,28 @@
# [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster
# ARG VARIANT=3-bullseye
# FROM mcr.microsoft.com/vscode/devcontainers/python:${VARIANT}
# RUN git clone https://github.com/neonbjb/tortoise-tts.git
# RUN cd tortoise-tts
# RUN python -m pip install -r ./requirements.txt
# RUN python setup.py install
# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10
# ARG NODE_VERSION="none"
# RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
# COPY requirements.txt /tmp/pip-tmp/
# RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
# && rm -rf /tmp/pip-tmp
# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
# [Optional] Uncomment this line to install global node packages.
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1
FROM tortoise-tts:latest

View File

@ -0,0 +1,54 @@
{
"name": "Python 3",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
// Update 'VARIANT' to pick a Python version: 3, 3.10, 3.9, 3.8, 3.7, 3.6
// Append -bullseye or -buster to pin to an OS version.
// Use -bullseye variants on local on arm64/Apple Silicon.
"VARIANT": "3.10-bullseye",
// Options
"NODE_VERSION": "lts/*"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"runArgs": [
"--gpus", "all"
],
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "pip3 install --user -r requirements.txt",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
}

View File

@ -0,0 +1,3 @@
This file copied into the container along with environment.yml* from the parent
folder. This file is included to prevents the Dockerfile COPY instruction from
failing if no environment.yml is found.

20
agent-py/notes.txt Normal file
View File

@ -0,0 +1,20 @@
https://github.com/geohot/tinygrad
Installation
git clone https://github.com/geohot/tinygrad.git
cd tinygrad
python3 -m pip install -e .
weights: https://github.com/shawwn/llama-dl
To download all model weights, cd into the directory you want them, then run this:
Linux: curl -o- https://raw.githubusercontent.com/shawwn/llama-dl/56f50b96072f42fb2520b1ad5a1d6ef30351f23c/llama.sh | bash
inference:
Put this in batch script:
set OPTLOCAL=1
set GPU=1
python examples/llama.py
pause

1
agent-py/tinygrad Submodule

@ -0,0 +1 @@
Subproject commit 5e8fdfa9560ae5ba7c8c3b0886f47daafa3362e2

1
agent-py/tortoise-tts Submodule

@ -0,0 +1 @@
Subproject commit c9951ac1028db4b346cc153cea39b908f8fffc1b

61
agent-py/vall-e.ipynb Normal file
View File

@ -0,0 +1,61 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (1641373281.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Cell \u001b[0;32mIn[1], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m git clone https://github.com/neonbjb/tortoise-tts.git\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

112
doc/tts notes.txt Normal file
View File

@ -0,0 +1,112 @@
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - && \
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu20.04/nvidia-docker.list | \
sudo tee /etc/apt/sources.list.d/nvidia-docker.list && \
sudo apt-get update && \
sudo apt-get install -y nvidia-docker2
"Linux Mint 21.1" is ubuntu20.04
docker run --gpus all nvidia/cuda:10.2-cudnn7-devel nvidia-smi
docker run -it --rm --gpus all ubuntu nvidia-smi
docker run -d --gpus all -p 9000:9000 -e ASR_MODEL=base onerahmet/openai-whisper-asr-webservice:latest-gpu
https://www.youtube.com/watch?v=ZvIdFs3M5ic
############
Welcome to the world of speech synthesis!
#https://github.com/coqui-ai/TTS/tree/dev#install-tts
#https://tts.readthedocs.io/en/latest/finetuning.html
tts --list_models
M: p233, 241, 264, !267, 269, 272
F: !243, 244,248,250, 259, 263, 270, 271, 273/4/6 fast, 294, 297, 300,
BG?: 287
root@7b6397b7ecbe:~# tts --list_models
Name format: type/language/dataset/model
1: tts_models/multilingual/multi-dataset/your_tts
2: tts_models/bg/cv/vits
3: tts_models/cs/cv/vits
4: tts_models/da/cv/vits
5: tts_models/et/cv/vits
6: tts_models/ga/cv/vits
7: tts_models/en/ek1/tacotron2
8: tts_models/en/ljspeech/tacotron2-DDC
9: tts_models/en/ljspeech/tacotron2-DDC_ph
10: tts_models/en/ljspeech/glow-tts
11: tts_models/en/ljspeech/speedy-speech
12: tts_models/en/ljspeech/tacotron2-DCA
13: tts_models/en/ljspeech/vits
14: tts_models/en/ljspeech/vits--neon
15: tts_models/en/ljspeech/fast_pitch
16: tts_models/en/ljspeech/overflow
17: tts_models/en/ljspeech/neural_hmm
18: tts_models/en/vctk/vits [already downloaded]
19: tts_models/en/vctk/fast_pitch
20: tts_models/en/sam/tacotron-DDC
21: tts_models/en/blizzard2013/capacitron-t2-c50
22: tts_models/en/blizzard2013/capacitron-t2-c150_v2
23: tts_models/es/mai/tacotron2-DDC
24: tts_models/es/css10/vits
25: tts_models/fr/mai/tacotron2-DDC
26: tts_models/fr/css10/vits
27: tts_models/uk/mai/glow-tts
28: tts_models/uk/mai/vits
29: tts_models/zh-CN/baker/tacotron2-DDC-GST
30: tts_models/nl/mai/tacotron2-DDC
31: tts_models/nl/css10/vits
32: tts_models/de/thorsten/tacotron2-DCA
33: tts_models/de/thorsten/vits
34: tts_models/de/thorsten/tacotron2-DDC
35: tts_models/de/css10/vits-neon
36: tts_models/ja/kokoro/tacotron2-DDC
37: tts_models/tr/common-voice/glow-tts
38: tts_models/it/mai_female/glow-tts
39: tts_models/it/mai_female/vits
40: tts_models/it/mai_male/glow-tts
41: tts_models/it/mai_male/vits
42: tts_models/ewe/openbible/vits
43: tts_models/hau/openbible/vits
44: tts_models/lin/openbible/vits
45: tts_models/tw_akuapem/openbible/vits
46: tts_models/tw_asante/openbible/vits
47: tts_models/yor/openbible/vits
48: tts_models/hu/css10/vits
49: tts_models/el/cv/vits
50: tts_models/fi/css10/vits
51: tts_models/hr/cv/vits
52: tts_models/lt/cv/vits
53: tts_models/lv/cv/vits
54: tts_models/mt/cv/vits
55: tts_models/pl/mai_female/vits
56: tts_models/pt/cv/vits
57: tts_models/ro/cv/vits
58: tts_models/sk/cv/vits
59: tts_models/sl/cv/vits
60: tts_models/sv/cv/vits
61: tts_models/ca/custom/vits
62: tts_models/fa/custom/glow-tts
Name format: type/language/dataset/model
1: vocoder_models/universal/libri-tts/wavegrad
2: vocoder_models/universal/libri-tts/fullband-melgan
3: vocoder_models/en/ek1/wavegrad
4: vocoder_models/en/ljspeech/multiband-melgan
5: vocoder_models/en/ljspeech/hifigan_v2
6: vocoder_models/en/ljspeech/univnet
7: vocoder_models/en/blizzard2013/hifigan_v2
8: vocoder_models/en/vctk/hifigan_v2
9: vocoder_models/en/sam/hifigan_v2
10: vocoder_models/nl/mai/parallel-wavegan
11: vocoder_models/de/thorsten/wavegrad
12: vocoder_models/de/thorsten/fullband-melgan
13: vocoder_models/de/thorsten/hifigan_v1
14: vocoder_models/ja/kokoro/hifigan_v1
15: vocoder_models/uk/mai/multiband-melgan
16: vocoder_models/tr/common-voice/hifigan

View File

@ -3,10 +3,16 @@ version: '3.4'
services:
kevinai:
image: kevinai
container_name: kevinai-dev
build:
context: .
dockerfile: ./Dockerfile
environment:
NODE_ENV: production
TTS_BACKEND_URL: http://192.168.0.10:9009/asr
WS_URL: ws://192.168.0.10:28081
SERVER_PORT_WS: 8081
SERVER_PORT_HTTP: 8080
ports:
- 3000:3000
- 28081:8081
- 28080:8080

3917
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,10 +7,13 @@
},
"dependencies": {
"body-parser": "^1.20.2",
// "dalai": "^0.2.50",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"git": "^0.1.5",
"node-persist": "^3.1.3",
"request": "^2.88.2",
// "webtorrent": "^2.0.14",
"ws": "^8.12.1"
}
}