mirror of
https://github.com/cocktailpeanut/dalai
synced 2024-11-20 23:07:32 +01:00
download alpaca from huggingface + installer fix
installer fix => don't stop when rename fails, it's ok. just try renaming but if it doesn't exist it should just ignore because it means there's no file to rename
This commit is contained in:
parent
0404c339a8
commit
d8fcafe644
21
alpaca.js
21
alpaca.js
@ -75,27 +75,34 @@ class Alpaca {
|
||||
console.log("mkdir", e)
|
||||
})
|
||||
console.log("downloading torrent")
|
||||
let url
|
||||
switch (model) {
|
||||
case "7B":
|
||||
await this.root.torrent.add('magnet:?xt=urn:btih:5aaceaec63b03e51a98f04fd5c42320b2a033010&dn=ggml-alpaca-7b-q4.bin&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce', dir)
|
||||
console.log("renaming")
|
||||
await fs.promises.rename(
|
||||
path.resolve(dir, "ggml-alpaca-7b-q4.bin"),
|
||||
path.resolve(dir, "ggml-model-q4_0.bin")
|
||||
)
|
||||
//await this.root.torrent.add('magnet:?xt=urn:btih:5aaceaec63b03e51a98f04fd5c42320b2a033010&dn=ggml-alpaca-7b-q4.bin&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce', dir)
|
||||
//console.log("renaming")
|
||||
//await fs.promises.rename(
|
||||
// path.resolve(dir, "ggml-alpaca-7b-q4.bin"),
|
||||
// path.resolve(dir, "ggml-model-q4_0.bin")
|
||||
//)
|
||||
url = "https://huggingface.co/Pi3141/alpaca-7B-ggml/resolve/main/ggml-model-q4_0.bin"
|
||||
await this.root.down(url, path.resolve(dir, "ggml-model-q4_0.bin"))
|
||||
break;
|
||||
|
||||
case "13B":
|
||||
/*
|
||||
await this.root.torrent.add('magnet:?xt=urn:btih:053b3d54d2e77ff020ebddf51dad681f2a651071&dn=ggml-alpaca-13b-q4.bin&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fopentracker.i2p.rocks%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2810%2Fannounce', dir)
|
||||
console.log("renaming")
|
||||
await fs.promises.rename(
|
||||
path.resolve(dir, "ggml-alpaca-13b-q4.bin"),
|
||||
path.resolve(dir, "ggml-model-q4_0.bin")
|
||||
)
|
||||
*/
|
||||
url = "https://huggingface.co/Pi3141/alpaca-13B-ggml/resolve/main/ggml-model-q4_0.bin"
|
||||
await this.root.down(url, path.resolve(dir, "ggml-model-q4_0.bin"))
|
||||
break;
|
||||
|
||||
case "30B":
|
||||
const url = "https://huggingface.co/Pi3141/alpaca-30B-ggml/resolve/main/ggml-model-q4_0.bin"
|
||||
url = "https://huggingface.co/Pi3141/alpaca-30B-ggml/resolve/main/ggml-model-q4_0.bin"
|
||||
await this.root.down(url, path.resolve(dir, "ggml-model-q4_0.bin"))
|
||||
break;
|
||||
|
||||
|
8
index.js
8
index.js
@ -337,15 +337,15 @@ class Dalai {
|
||||
let models_path = path.resolve(engine.home, "models")
|
||||
let temp_path = path.resolve(this.home, "tmp")
|
||||
let temp_models_path = path.resolve(temp_path, "models")
|
||||
await fs.promises.mkdir(temp_path, { recursive: true }).catch((e) => { })
|
||||
await fs.promises.mkdir(temp_path, { recursive: true }).catch((e) => { console.log("1", e) })
|
||||
// 1. move the models folder to ../tmp
|
||||
await fs.promises.rename(models_path, temp_models_path)
|
||||
await fs.promises.rename(models_path, temp_models_path).catch((e) => { console.log("2", e) })
|
||||
// 2. wipe out the folder
|
||||
await fs.promises.rm(engine.home, { recursive: true }).catch((e) => { console.log(e) })
|
||||
await fs.promises.rm(engine.home, { recursive: true }).catch((e) => { console.log("3", e) })
|
||||
// 3. install engine
|
||||
await this.add(core)
|
||||
// 4. move back the files inside /tmp
|
||||
await fs.promises.rename(temp_models_path, models_path)
|
||||
await fs.promises.rename(temp_models_path, models_path).catch((e) => { console.log("4", e) })
|
||||
|
||||
// next add the models
|
||||
let res = await this.cores[core].add(...models)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dalai",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"author": "cocktailpeanut",
|
||||
|
Loading…
Reference in New Issue
Block a user