Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
WismutHansen committed Dec 25, 2024
0 parents commit 6a84b53
Show file tree
Hide file tree
Showing 10 changed files with 287 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Ommit the DS_Store folder automatically created by macOS
.DS_Store/
# Python cache
__pycache__/
/*/__pycache__/
/*/*/__pycache__/

3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# READ2ME

A pinokio script for <https://huggingface.co/spaces/Wismut/StyleTTS2_Studio>
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions install.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
module.exports = {
run: [
// Edit this step to customize the git repository to use
{
method: "shell.run",
params: {
message: [
"git clone https://huggingface.co/spaces/Wismut/StyleTTS2_Studio app",
]
}
},
// Delete this step if your project does not use torch
{
method: "script.start",
params: {
uri: "torch.js",
params: {
venv: "env", // Edit this to customize the venv folder path
path: "app", // Edit this to customize the path to start the shell from
// xformers: true // uncomment this line if your project requires xformers
}
}
},
// Edit this step with your custom install commands
{
method: "shell.run",
params: {
venv: "env", // Edit this to customize the venv folder path
path: "app", // Edit this to customize the path to start the shell from
message: [
"uv run app.py"
]
}
},
{
method: "fs.link",
params: {
venv: "app/env"
}
}
]
}
91 changes: 91 additions & 0 deletions pinokio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
const path = require('path')
module.exports = {
version: "0.1",
title: "StyleTTS2 Studio",
description: "Build your own voice for StyleTTS2",
icon: "icon.png",
menu: async (kernel, info) => {
let installed = info.exists("app/env")
let running = {
install: info.running("install.js"),
start: info.running("start.js"),
update: info.running("update.js"),
reset: info.running("reset.js")
}
if (running.install) {
return [{
default: true,
icon: "fa-solid fa-plug",
text: "Installing",
href: "install.js",
}]
} else if (installed) {
if (running.start) {
let local = info.local("start.js")
if (local && local.url) {
return [{
default: true,
icon: "fa-solid fa-rocket",
text: "Open Web UI",
href: local.url,
}, {
icon: 'fa-solid fa-terminal',
text: "Terminal",
href: "start.js",
}]
} else {
return [{
default: true,
icon: 'fa-solid fa-terminal',
text: "Terminal",
href: "start.js",
}]
}
} else if (running.update) {
return [{
default: true,
icon: 'fa-solid fa-terminal',
text: "Updating",
href: "update.js",
}]
} else if (running.reset) {
return [{
default: true,
icon: 'fa-solid fa-terminal',
text: "Resetting",
href: "reset.js",
}]
} else {
return [{
default: true,
icon: "fa-solid fa-power-off",
text: "Start",
href: "start.js",
}, {
icon: "fa-solid fa-dumbbell",
text: "Train",
href: "train.js",
}, {
icon: "fa-solid fa-plug",
text: "Update",
href: "update.js",
}, {
icon: "fa-solid fa-plug",
text: "Install",
href: "install.js",
}, {
icon: "fa-regular fa-circle-xmark",
text: "Reset",
href: "reset.js",
}]
}
} else {
return [{
default: true,
icon: "fa-solid fa-plug",
text: "Install",
href: "install.js",
}]
}
}
}
5 changes: 5 additions & 0 deletions pinokio_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"posts": [
"https://x.com/TommyFalkowski/status/1850254387874283838"
]
}
8 changes: 8 additions & 0 deletions reset.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
run: [{
method: "fs.rm",
params: {
path: "app"
}
}]
}
37 changes: 37 additions & 0 deletions start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
daemon: true,
run: [
{
method: "shell.run",
params: {
venv: "env", // Edit this to customize the venv folder path
env: {
"PYTORCH_ENABLE_MPS_FALLBACK": 1
}, // Edit this to customize environment variables (see documentation)
path: "app", // Edit this to customize the path to start the shell from
message: [
"uv run app.py"
],
on: [{
// The regular expression pattern to monitor.
// When this pattern occurs in the shell terminal, the shell will return,
// and the script will go onto the next step.
"event": "/http:\/\/\\S+/",

// "done": true will move to the next step while keeping the shell alive.
// "kill": true will move to the next step after killing the shell.
"done": true
}]
}
},
{
// This step sets the local variable 'url'.
// This local variable will be used in pinokio.js to display the "Open WebUI" tab when the value is set.
method: "local.set",
params: {
// the input.event is the regular expression match object from the previous step
url: "{{input.event[0]}}"
}
}
]
}
74 changes: 74 additions & 0 deletions torch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
module.exports = {
run: [
// windows nvidia
{
"when": "{{platform === 'win32' && gpu === 'nvidia'}}",
"method": "shell.run",
"params": {
"venv": "{{args && args.venv ? args.venv : null}}",
"path": "{{args && args.path ? args.path : '.'}}",
"message": "pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 {{args && args.xformers ? 'xformers' : ''}} --index-url https://download.pytorch.org/whl/cu121"
}
},
// windows amd
{
"when": "{{platform === 'win32' && gpu === 'amd'}}",
"method": "shell.run",
"params": {
"venv": "{{args && args.venv ? args.venv : null}}",
"path": "{{args && args.path ? args.path : '.'}}",
"message": "pip install torch-directml torchaudio torchvision numpy==1.26.4"
}
},
// windows cpu
{
"when": "{{platform === 'win32' && (gpu !== 'nvidia' && gpu !== 'amd')}}",
"method": "shell.run",
"params": {
"venv": "{{args && args.venv ? args.venv : null}}",
"path": "{{args && args.path ? args.path : '.'}}",
"message": "pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1"
}
},
// mac
{
"when": "{{platform === 'darwin'}}",
"method": "shell.run",
"params": {
"venv": "{{args && args.venv ? args.venv : null}}",
"path": "{{args && args.path ? args.path : '.'}}",
"message": "pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1"
}
},
// linux nvidia
{
"when": "{{platform === 'linux' && gpu === 'nvidia'}}",
"method": "shell.run",
"params": {
"venv": "{{args && args.venv ? args.venv : null}}",
"path": "{{args && args.path ? args.path : '.'}}",
"message": "pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 {{args && args.xformers ? 'xformers' : ''}} --index-url https://download.pytorch.org/whl/cu121"
}
},
// linux rocm (amd)
{
"when": "{{platform === 'linux' && gpu === 'amd'}}",
"method": "shell.run",
"params": {
"venv": "{{args && args.venv ? args.venv : null}}",
"path": "{{args && args.path ? args.path : '.'}}",
"message": "pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/rocm6.0"
}
},
// linux cpu
{
"when": "{{platform === 'linux' && (gpu !== 'amd' && gpu !=='nvidia')}}",
"method": "shell.run",
"params": {
"venv": "{{args && args.venv ? args.venv : null}}",
"path": "{{args && args.path ? args.path : '.'}}",
"message": "pip install torch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 --index-url https://download.pytorch.org/whl/cpu"
}
}
]
}
20 changes: 20 additions & 0 deletions update.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
module.exports = {
run: [{
method: "shell.run",
params: {
message: "git pull"
}
}, {
method: "shell.run",
params: {
path: "app",
message: "git pull"
}
},
{
method: "fs.link",
params: {
venv: "app/env"
}
}]
}

0 comments on commit 6a84b53

Please sign in to comment.