1
0
mirror of https://github.com/fumiama/RVC-Models-Downloader.git synced 2025-04-22 04:02:22 +09:00

Compare commits

..

No commits in common. "main" and "v0.2.5" have entirely different histories.
main ... v0.2.5

7 changed files with 45 additions and 55 deletions

View File

@ -15,8 +15,6 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@master uses: actions/setup-go@master
with:
go-version: 1.22
- name: Run GoReleaser - name: Run GoReleaser
uses: goreleaser/goreleaser-action@master uses: goreleaser/goreleaser-action@master

View File

@ -2,16 +2,16 @@ BaseURL: https://huggingface.co/2Noise/ChatTTS/resolve/main
Targets: Targets:
- Folder: asset - Folder: asset
Copy: Copy:
- asset/Decoder.safetensors - asset/DVAE.pt
- asset/DVAE.safetensors - asset/Decoder.pt
- asset/Embed.safetensors - asset/GPT.pt
- asset/Vocos.safetensors - asset/Vocos.pt
- Folder: asset/gpt - asset/spk_stat.pt
- asset/tokenizer.pt
- Folder: config
Copy: Copy:
- asset/gpt/config.json - config/decoder.yaml
- asset/gpt/model.safetensors - config/dvae.yaml
- Folder: asset/tokenizer - config/gpt.yaml
Copy: - config/path.yaml
- asset/tokenizer/special_tokens_map.json - config/vocos.yaml
- asset/tokenizer/tokenizer_config.json
- asset/tokenizer/tokenizer.json

View File

@ -1,28 +1,28 @@
Servers: {} Servers: {}
Fallbacks: Fallbacks:
cdn-lfs.huggingface.co: cdn-lfs.huggingface.co:
- 13.249.146.70 - 3.163.218.77
- 13.249.146.79 - 3.163.218.75
- 13.249.146.118 - 3.163.218.60
- 13.249.146.81 - 3.163.218.88
- 2600:9000:2112:1200:11:f807:5180:93a1 - 2600:9000:26a9:6e00:11:f807:5180:93a1
- 2600:9000:2112:5600:11:f807:5180:93a1 - 2600:9000:26a9:8400:11:f807:5180:93a1
- 2600:9000:2112:bc00:11:f807:5180:93a1 - 2600:9000:26a9:e400:11:f807:5180:93a1
- 2600:9000:2112:c200:11:f807:5180:93a1 - 2600:9000:26a9:6400:11:f807:5180:93a1
- 2600:9000:2112:da00:11:f807:5180:93a1 - 2600:9000:26a9:f400:11:f807:5180:93a1
- 2600:9000:2112:7600:11:f807:5180:93a1 - 2600:9000:26a9:ec00:11:f807:5180:93a1
- 2600:9000:2112:6600:11:f807:5180:93a1 - 2600:9000:26a9:6600:11:f807:5180:93a1
- 2600:9000:2112:be00:11:f807:5180:93a1 - 2600:9000:26a9:fa00:11:f807:5180:93a1
huggingface.co: huggingface.co:
- 18.65.159.75 - 18.65.159.75
- 18.65.159.63 - 18.65.159.63
- 18.65.159.2 - 18.65.159.2
- 18.65.159.20 - 18.65.159.20
- 2600:9000:2218:2400:17:b174:6d00:93a1 - 2600:9000:2218:9200:17:b174:6d00:93a1
- 2600:9000:2218:5c00:17:b174:6d00:93a1 - 2600:9000:2218:e00:17:b174:6d00:93a1
- 2600:9000:2218:de00:17:b174:6d00:93a1 - 2600:9000:2218:4800:17:b174:6d00:93a1
- 2600:9000:2218:3600:17:b174:6d00:93a1 - 2600:9000:2218:6c00:17:b174:6d00:93a1
- 2600:9000:2218:3000:17:b174:6d00:93a1 - 2600:9000:2218:b200:17:b174:6d00:93a1
- 2600:9000:2218:3200:17:b174:6d00:93a1 - 2600:9000:2218:6800:17:b174:6d00:93a1
- 2600:9000:2218:2600:17:b174:6d00:93a1 - 2600:9000:2218:c800:17:b174:6d00:93a1
- 2600:9000:2218:a200:17:b174:6d00:93a1 - 2600:9000:2218:2e00:17:b174:6d00:93a1

2
go.mod
View File

@ -3,7 +3,7 @@ module rvcmd
go 1.22.1 go 1.22.1
require ( require (
github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979 github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8
github.com/gizak/termui/v3 v3.1.0 github.com/gizak/termui/v3 v3.1.0
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3 github.com/sirupsen/logrus v1.9.3

4
go.sum
View File

@ -5,8 +5,8 @@ github.com/RomiChan/syncx v0.0.0-20240418144900-b7402ffdebc7/go.mod h1:vD7Ra3Q9o
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979 h1:1xSO4SvPfiw5TVeaS5ASFcl82rXH3jG8Obab0+JOC/8= github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8 h1:mVOgOhlrF0ra8/BkwVA71ev/1HkzAgDn8gWU2UNbDU8=
github.com/fumiama/terasu v0.0.0-20240710095334-67a8daa3a979/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI= github.com/fumiama/terasu v0.0.0-20240502091919-c887e26289a8/go.mod h1:UVx8YP1jKKL1Cj+uy+OnQRM2Ih6U36Mqy9GSf7jabsI=
github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc= github.com/gizak/termui/v3 v3.1.0 h1:ZZmVDgwHl7gR7elfKf1xc4IudXZ5qqfDh4wExk4Iajc=
github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY= github.com/gizak/termui/v3 v3.1.0/go.mod h1:bXQEBkJpzxUAKf0+xq9MSWAvWZlE7c+aidmyFlkYTrY=
github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o= github.com/mattn/go-runewidth v0.0.2 h1:UnlwIPBGaTZfPQ6T1IGzPI0EkYAQmT9fAEJ/poFC63o=

View File

@ -33,7 +33,6 @@ func main() {
wait := flag.Uint("w", 4, "connection waiting seconds") wait := flag.Uint("w", 4, "connection waiting seconds")
ua := flag.String("ua", defua, "customize user agent") ua := flag.String("ua", defua, "customize user agent")
h := flag.Bool("h", false, "display this help") h := flag.Bool("h", false, "display this help")
home := flag.String("H", ".", "download under this path")
flag.BoolVar(&notui, "notui", false, "use plain text instead of TUI") flag.BoolVar(&notui, "notui", false, "use plain text instead of TUI")
flag.Parse() flag.Parse()
args := flag.Args() args := flag.Args()
@ -45,11 +44,6 @@ func main() {
fmt.Println(cmdlst.String()) fmt.Println(cmdlst.String())
return return
} }
err := os.MkdirAll(*home, 0755)
if err != nil {
logrus.Errorln("mkdirs of path", *home, "err:", err)
return
}
if notui { if notui {
logrus.Infoln("RVC Models Downloader start at", time.Now().Local().Format(time.DateTime+" (MST)")) logrus.Infoln("RVC Models Downloader start at", time.Now().Local().Format(time.DateTime+" (MST)"))
logrus.Infof("operating system: %s, architecture: %s", runtime.GOOS, runtime.GOARCH) logrus.Infof("operating system: %s, architecture: %s", runtime.GOOS, runtime.GOARCH)
@ -95,7 +89,7 @@ func main() {
} }
ch := make(chan struct{}) ch := make(chan struct{})
go func() { go func() {
err := usercfg.download(args[0], "", *home, *ua, time.Second*time.Duration(*wait), *cust, !*ntrs, *force) err := usercfg.download(args[0], "", *ua, time.Second*time.Duration(*wait), *cust, !*ntrs, *force)
ch <- struct{}{} ch <- struct{}{}
if err != nil { if err != nil {
errorln(err) errorln(err)

20
net.go
View File

@ -5,27 +5,26 @@ import (
"io" "io"
"net/http" "net/http"
"os" "os"
"path"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"time" "time"
trshttp "github.com/fumiama/terasu/http" "github.com/fumiama/terasu/http2"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (c *config) download(p, prefix, home, ua string, waits time.Duration, usecust, usetrs, force bool) error { func (c *config) download(path, prefix, ua string, waits time.Duration, usecust, usetrs, force bool) error {
for i, t := range c.Targets { for i, t := range c.Targets {
if t.Refer != "" { if t.Refer != "" {
refp := p[:strings.LastIndex(p, "/")+1] + t.Refer refp := path[:strings.LastIndex(path, "/")+1] + t.Refer
infof("#%s%d refer to target '%s'.", prefix, i+1, refp) infof("#%s%d refer to target '%s'.", prefix, i+1, refp)
refcfg, err := readconfig(refp, usecust) refcfg, err := readconfig(refp, usecust)
if err != nil { if err != nil {
return err return err
} }
err = refcfg.download(refp, prefix+strconv.Itoa(i+1)+".", home, ua, waits, usecust, usetrs, force) err = refcfg.download(refp, prefix+strconv.Itoa(i+1)+".", ua, waits, usecust, usetrs, force)
if err != nil { if err != nil {
return err return err
} }
@ -39,12 +38,11 @@ func (c *config) download(p, prefix, home, ua string, waits time.Duration, usecu
warnf("#%s%d target required Arch: %s but you are %s, skip.", prefix, i+1, t.Arch, runtime.GOARCH) warnf("#%s%d target required Arch: %s but you are %s, skip.", prefix, i+1, t.Arch, runtime.GOARCH)
continue continue
} }
homefolder := path.Join(home, t.Folder) err := os.MkdirAll(t.Folder, 0755)
err := os.MkdirAll(homefolder, 0755)
if err != nil { if err != nil {
return errors.Wrap(err, fmt.Sprintf("#%s%d make target folder '%s'", prefix, i+1, homefolder)) return errors.Wrap(err, fmt.Sprintf("#%s%d make target folder '%s'", prefix, i+1, t.Folder))
} }
infof("#%s%d open target folder '%s'.", prefix, i+1, homefolder) infof("#%s%d open target folder '%s'.", prefix, i+1, t.Folder)
if len(t.Copy) == 0 { if len(t.Copy) == 0 {
warnf("#%s%d empty copy target.", prefix, i+1) warnf("#%s%d empty copy target.", prefix, i+1)
continue continue
@ -59,7 +57,7 @@ func (c *config) download(p, prefix, home, ua string, waits time.Duration, usecu
if sleep > time.Millisecond { if sleep > time.Millisecond {
time.Sleep(sleep) time.Sleep(sleep)
} }
fname := path.Join(homefolder, cp[strings.LastIndex(cp, "/")+1:]) fname := t.Folder + "/" + cp[strings.LastIndex(cp, "/")+1:]
if !force { if !force {
if _, err := os.Stat(fname); err == nil || os.IsExist(err) { if _, err := os.Stat(fname); err == nil || os.IsExist(err) {
warnf("#%s%d skip exist file %s", prefix, i+1, fname) warnf("#%s%d skip exist file %s", prefix, i+1, fname)
@ -77,7 +75,7 @@ func (c *config) download(p, prefix, home, ua string, waits time.Duration, usecu
} }
var resp *http.Response var resp *http.Response
if usetrs { if usetrs {
resp, err = trshttp.DefaultClient.Do(req) resp, err = http2.DefaultClient.Do(req)
} else { } else {
resp, err = http.DefaultClient.Do(req) resp, err = http.DefaultClient.Do(req)
} }