ffreemt commited on
Commit
365d2be
1 Parent(s): 2fe65b3

Update dl_model.py

Browse files
Files changed (5) hide show
  1. .gitignore +1 -0
  2. .husky/pre-commit +6 -0
  3. dl_model.py +79 -0
  4. package.json +14 -0
  5. yarn.lock +8 -0
.gitignore CHANGED
@@ -10,3 +10,4 @@ models
10
  run-nodemon.sh
11
  app-.py
12
  nodemon.json
 
 
10
  run-nodemon.sh
11
  app-.py
12
  nodemon.json
13
+ node_modules
.husky/pre-commit ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ # npm test
5
+ ruff . --fix
6
+ black .
dl_model.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Download modles."""
2
+ # pylint: disable=invalid-name, broad-exception-caught, line-too-long
3
+ from typing import Optional
4
+
5
+ import typer
6
+ from dl_hf_model import dl_hf_model
7
+ from loguru import logger
8
+
9
+ url = "https://huggingface.co/TheBloke/Upstage-Llama-2-70B-instruct-v2-GGML/blob/main/upstage-llama-2-70b-instruct-v2.ggmlv3.q3_K_S.bin"
10
+
11
+
12
+ __version__ = "0.0.1"
13
+
14
+ app = typer.Typer(
15
+ name="dl-mode",
16
+ add_completion=False,
17
+ help="donwload models from hf and save to a dir (default models)",
18
+ )
19
+
20
+
21
+ def _version_callback(value: bool) -> None:
22
+ if value:
23
+ typer.echo(f"{app.info.name} v.{__version__} -- download models for given url(s)")
24
+ raise typer.Exit()
25
+
26
+
27
+ @app.command()
28
+ def main(
29
+ urls: str = typer.Argument( # pylint: disable=unused-argument
30
+ "",
31
+ help=f"one or more urls (default {url})",
32
+ show_default=False,
33
+ ),
34
+ version: Optional[bool] = typer.Option( # pylint: disable=unused-argument
35
+ None,
36
+ "--version",
37
+ "-v",
38
+ "-V",
39
+ help="Show version info and exit.",
40
+ callback=_version_callback,
41
+ is_eager=True,
42
+ ),
43
+ model_dir: Optional[str] = typer.Option(
44
+ None,
45
+ "--mode-dir",
46
+ help="dir to save downloaded models (default models)",
47
+ ),
48
+ ):
49
+ """
50
+ Define main.
51
+
52
+ Args:
53
+ ----
54
+ version: verson and help info.
55
+ urls: model urls separated by space(s) (default url.
56
+ model_dir: location to save downlaoded models (default models).
57
+ """
58
+ logger.trace(f"{urls}")
59
+ if model_dir is None:
60
+ model_dir = "models"
61
+ if isinstance(urls, str):
62
+ urls.split()
63
+
64
+ url_list = urls[:]
65
+ if not urls:
66
+ url_list = [url]
67
+ try:
68
+ for elm in url_list:
69
+ dl_hf_model(elm)
70
+ except Exception as exc:
71
+ logger.error(exc)
72
+ raise typer.Exit()
73
+
74
+
75
+ if __name__ == "__main__":
76
+ try:
77
+ app()
78
+ except Exception as exc_:
79
+ logger.error(exc_)
package.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "llama-2-70b-guanaco-qlora-ggml",
3
+ "version": "1.0.0",
4
+ "main": "index.js",
5
+ "repository": "https://huggingface.co/spaces/mikeee/llama-2-70b-guanaco-qlora-ggml",
6
+ "author": "ffreemt <yucongo+fmt@gmail.com>",
7
+ "license": "MIT",
8
+ "devDependencies": {
9
+ "husky": "^8.0.0"
10
+ },
11
+ "scripts": {
12
+ "prepare": "husky install"
13
+ }
14
+ }
yarn.lock ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2
+ # yarn lockfile v1
3
+
4
+
5
+ husky@^8.0.0:
6
+ version "8.0.3"
7
+ resolved "https://registry.npmmirror.com/husky/-/husky-8.0.3.tgz#4936d7212e46d1dea28fef29bb3a108872cd9184"
8
+ integrity sha512-+dQSyqPh4x1hlO1swXBiNb2HzTDN1I2IGLQx1GrBuiqFJfoMrnZWwVmatvSiO+Iz8fBUnf+lekwNo4c2LlXItg==