jetson-examples 0.0.4__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/PKG-INFO +3 -1
  2. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/README.md +2 -0
  3. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/jetson_examples.egg-info/PKG-INFO +3 -1
  4. jetson_examples-0.0.5/jetson_examples.egg-info/SOURCES.txt +26 -0
  5. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/jetson_examples.egg-info/top_level.txt +1 -0
  6. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/pyproject.toml +2 -2
  7. jetson_examples-0.0.5/reComputer/__init__.py +1 -0
  8. jetson_examples-0.0.5/reComputer/main.py +56 -0
  9. jetson_examples-0.0.5/reComputer/scripts/Sheared-LLaMA-2.7B-ShareGPT/run.sh +5 -0
  10. jetson_examples-0.0.5/reComputer/scripts/hello-world/readme.md +3 -0
  11. jetson_examples-0.0.5/reComputer/scripts/hello-world/run.sh +9 -0
  12. jetson_examples-0.0.5/reComputer/scripts/llava/run.sh +6 -0
  13. jetson_examples-0.0.5/reComputer/scripts/llava-v1.5-7b/run.sh +5 -0
  14. jetson_examples-0.0.5/reComputer/scripts/llava-v1.6-vicuna-7b/run.sh +6 -0
  15. jetson_examples-0.0.5/reComputer/scripts/nanodb/readme.md +10 -0
  16. jetson_examples-0.0.5/reComputer/scripts/nanoowl/run.sh +3 -0
  17. jetson_examples-0.0.5/reComputer/scripts/run.sh +73 -0
  18. jetson_examples-0.0.5/reComputer/scripts/stable-diffusion-webui/run.sh +3 -0
  19. jetson_examples-0.0.5/reComputer/scripts/text-generation-webui/run.sh +8 -0
  20. jetson_examples-0.0.5/reComputer/scripts/update.sh +27 -0
  21. jetson_examples-0.0.5/reComputer/scripts/whisper/run.sh +3 -0
  22. jetson_examples-0.0.4/jetson_examples.egg-info/SOURCES.txt +0 -14
  23. jetson_examples-0.0.4/reComputer/__init__.py +0 -1
  24. jetson_examples-0.0.4/reComputer/main.py +0 -29
  25. jetson_examples-0.0.4/reComputer/scripts/run.sh +0 -117
  26. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/LICENSE +0 -0
  27. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/jetson_examples.egg-info/dependency_links.txt +0 -0
  28. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/jetson_examples.egg-info/entry_points.txt +0 -0
  29. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/reComputer/scripts/check.sh +0 -0
  30. /jetson_examples-0.0.4/reComputer/scripts/live-llava.sh → /jetson_examples-0.0.5/reComputer/scripts/live-llava/run.sh +0 -0
  31. /jetson_examples-0.0.4/reComputer/scripts/nanodb.sh → /jetson_examples-0.0.5/reComputer/scripts/nanodb/run.sh +0 -0
  32. {jetson_examples-0.0.4 → jetson_examples-0.0.5}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jetson-examples
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Running Gen AI models and applications on NVIDIA Jetson devices with one-line command
5
5
  Author-email: luozhixin <zhixin.luo@seeed.cc>
6
6
  Project-URL: Homepage, https://github.com/Seeed-Projects/jetson-examples
@@ -61,6 +61,8 @@ Here are some examples that can be run:
61
61
 
62
62
  More Examples can be found [examples.md](./docs/examples.md)
63
63
 
64
+ Want to add a Example by yourself? Check this [develop.md](./docs/develop.md)
65
+
64
66
  ## TODO List
65
67
 
66
68
  - [ ] check disk space enough or not before run
@@ -46,6 +46,8 @@ Here are some examples that can be run:
46
46
 
47
47
  More Examples can be found [examples.md](./docs/examples.md)
48
48
 
49
+ Want to add a Example by yourself? Check this [develop.md](./docs/develop.md)
50
+
49
51
  ## TODO List
50
52
 
51
53
  - [ ] check disk space enough or not before run
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jetson-examples
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: Running Gen AI models and applications on NVIDIA Jetson devices with one-line command
5
5
  Author-email: luozhixin <zhixin.luo@seeed.cc>
6
6
  Project-URL: Homepage, https://github.com/Seeed-Projects/jetson-examples
@@ -61,6 +61,8 @@ Here are some examples that can be run:
61
61
 
62
62
  More Examples can be found [examples.md](./docs/examples.md)
63
63
 
64
+ Want to add a Example by yourself? Check this [develop.md](./docs/develop.md)
65
+
64
66
  ## TODO List
65
67
 
66
68
  - [ ] check disk space enough or not before run
@@ -0,0 +1,26 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ jetson_examples.egg-info/PKG-INFO
5
+ jetson_examples.egg-info/SOURCES.txt
6
+ jetson_examples.egg-info/dependency_links.txt
7
+ jetson_examples.egg-info/entry_points.txt
8
+ jetson_examples.egg-info/top_level.txt
9
+ reComputer/__init__.py
10
+ reComputer/main.py
11
+ reComputer/scripts/check.sh
12
+ reComputer/scripts/run.sh
13
+ reComputer/scripts/update.sh
14
+ reComputer/scripts/Sheared-LLaMA-2.7B-ShareGPT/run.sh
15
+ reComputer/scripts/hello-world/readme.md
16
+ reComputer/scripts/hello-world/run.sh
17
+ reComputer/scripts/live-llava/run.sh
18
+ reComputer/scripts/llava/run.sh
19
+ reComputer/scripts/llava-v1.5-7b/run.sh
20
+ reComputer/scripts/llava-v1.6-vicuna-7b/run.sh
21
+ reComputer/scripts/nanodb/readme.md
22
+ reComputer/scripts/nanodb/run.sh
23
+ reComputer/scripts/nanoowl/run.sh
24
+ reComputer/scripts/stable-diffusion-webui/run.sh
25
+ reComputer/scripts/text-generation-webui/run.sh
26
+ reComputer/scripts/whisper/run.sh
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "jetson-examples"
7
- version = "0.0.4"
7
+ version = "0.0.5"
8
8
  authors = [{ name = "luozhixin", email = "zhixin.luo@seeed.cc" }]
9
9
  description = "Running Gen AI models and applications on NVIDIA Jetson devices with one-line command"
10
10
  readme = "README.md"
@@ -39,4 +39,4 @@ namespaces = true
39
39
  where = ["."]
40
40
 
41
41
  [tool.setuptools.package-data]
42
- "reComputer.scripts" = ["*.sh"]
42
+ "reComputer.scripts" = ["**/*"]
@@ -0,0 +1 @@
1
+ __version__ = "0.0.5"
@@ -0,0 +1,56 @@
1
+ import os
2
+ import subprocess
3
+ import sys
4
+
5
+
6
+ def script(name):
7
+ script_path = os.path.join(os.path.dirname(__file__), "scripts", name)
8
+ return script_path
9
+
10
+
11
+ def list_all_examples(folder_path):
12
+ directory_names = []
13
+ for item in os.listdir(folder_path):
14
+ item_path = os.path.join(folder_path, item)
15
+ if os.path.isdir(item_path):
16
+ directory_names.append(item)
17
+ return directory_names
18
+
19
+
20
+ def run_script():
21
+
22
+ if len(sys.argv) == 3:
23
+ if sys.argv[1] == "run":
24
+ example_name = sys.argv[2]
25
+ # TODO: maybe use python instead of shell is better
26
+ subprocess.run(["bash", script("run.sh"), example_name])
27
+ else:
28
+ print("Only Support `run` for now. try `reComputer run llava` .")
29
+ elif len(sys.argv) == 2:
30
+ if sys.argv[1] == "check":
31
+ subprocess.run(["bash", script("check.sh")])
32
+ elif sys.argv[1] == "update":
33
+ subprocess.run(["bash", script("update.sh")])
34
+ elif sys.argv[1] == "list":
35
+ example_folder = os.path.join(os.path.dirname(__file__), "scripts")
36
+ directories = list_all_examples(example_folder)
37
+ print("example list:")
38
+ index = 1
39
+ for directory in directories:
40
+ print("{:03d}".format(index), "|", directory)
41
+ index += 1
42
+ print("-end-")
43
+ else:
44
+ print("reComputer help:")
45
+ print("---")
46
+ print("`reComputer check` | check system.")
47
+ print("`reComputer update` | update jetson-ai-lab.")
48
+ print("`reComputer list` | list all examples.")
49
+ print("`reComputer run xxx` | run an example.")
50
+ print("---")
51
+ else:
52
+ print("Error Usage! try `reComputer help`.")
53
+
54
+
55
+ if __name__ == "__main__":
56
+ pass
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ ./run.sh $(./autotag local_llm) \
4
+ python3 -m local_llm.chat --api=mlc \
5
+ --model princeton-nlp/Sheared-LLaMA-2.7B-ShareGPT
@@ -0,0 +1,3 @@
1
+ # hello-world
2
+
3
+ - print `hello-world` to show how to add your project into this package
@@ -0,0 +1,9 @@
1
+ #!/bin/bash
2
+ ./run.sh $(./autotag llava) \
3
+ python3 -m nano_llm.agents.video_query --api=mlc \
4
+ --model Efficient-Large-Model/VILA-2.7b \
5
+ --max-context-len 768 \
6
+ --max-new-tokens 32 \
7
+ --video-input /dev/video0 \
8
+ --video-output webrtc://@:8554/output \
9
+ --nanodb /data/nanodb/coco/2017
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ ./run.sh $(./autotag llava) \
4
+ python3 -m llava.serve.cli \
5
+ --model-path liuhaotian/llava-v1.5-7b \
6
+ --image-file /data/images/hoover.jpg
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ ./run.sh $(./autotag llava) \
3
+ python3 -m llava.serve.cli \
4
+ --model-path liuhaotian/llava-v1.5-7b \
5
+ --image-file /data/images/hoover.jpg
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+ ./run.sh $(./autotag local_llm) \
3
+ python3 -m local_llm --api=mlc \
4
+ --model liuhaotian/llava-v1.6-vicuna-7b \
5
+ --max-context-len 768 \
6
+ --max-new-tokens 128
@@ -0,0 +1,10 @@
1
+ # NanoDB
2
+
3
+ ## ref
4
+
5
+ - <https://www.jetson-ai-lab.com/tutorial_nanodb.html>
6
+
7
+ ## access
8
+
9
+ - using in machine, try `http://127.0.0.1:7860` in browser.
10
+ - using in other pc, make sure you know jetson's IP and try `http://<<Jetson's IP>>:7860` in browser.
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ ./run.sh $(./autotag nanoowl) bash -c "ls /dev/video* && cd examples/tree_demo && python3 tree_demo.py ../../data/owl_image_encoder_patch32.engine"
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+
3
+ check_is_jetson_or_not() {
4
+ model_file="/proc/device-tree/model"
5
+
6
+ if [ -f "/proc/device-tree/model" ]; then
7
+ model=$(tr -d '\0' < /proc/device-tree/model | tr '[:upper:]' '[:lower:]')
8
+ if [[ $model =~ jetson|orin|nv|agx ]]; then
9
+ echo "INFO: machine[$model] confirmed..."
10
+ else
11
+ echo "WARNING: machine[$model] maybe not support..."
12
+ exit 1
13
+ fi
14
+ else
15
+ echo "ERROR: machine[$model] not support this..."
16
+ exit 1
17
+ fi
18
+ }
19
+ check_is_jetson_or_not
20
+
21
+ check_disk_space() {
22
+ directory="$1" # a directory
23
+ required_space_gb="$2" # how many GB we need
24
+
25
+ # get disk of directory
26
+ device=$(df -P "$directory" | awk 'NR==2 {print $1}')
27
+ echo $device
28
+
29
+ # get free space in KB
30
+ free_space=$(df -P "$device" | awk 'NR==2 {print $4}')
31
+ echo $free_space
32
+
33
+ # change unit to GB
34
+ free_space_gb=$(echo "scale=2; $free_space / 1024 / 1024" | bc)
35
+ echo $free_space_gb
36
+
37
+ # check and fast-fail
38
+ if (( $(echo "$free_space_gb >= $required_space_gb" | bc -l) )); then
39
+ echo "disk space ($1) enough, keep going."
40
+ else
41
+ echo "disk space ($1) not enough!! we need $2 GB!!"
42
+ exit 1
43
+ fi
44
+ }
45
+
46
+ echo "run example:$1"
47
+ BASE_PATH=/home/$USER/reComputer
48
+
49
+ echo "----example init----"
50
+ mkdir -p $BASE_PATH/
51
+ JETSON_REPO_PATH="$BASE_PATH/jetson-containers"
52
+ BASE_JETSON_LAB_GIT="https://github.com/dusty-nv/jetson-containers/tree/d1573a3e8d7ba3fef36ebb23a7391e60eaf64db7"
53
+ if [ -d $JETSON_REPO_PATH ]; then
54
+ echo "jetson-ai-lab existed."
55
+ else
56
+ echo "jetson-ai-lab does not installed. start init..."
57
+ cd $BASE_PATH/
58
+ git clone --depth=1 $BASE_JETSON_LAB_GIT
59
+ cd $JETSON_REPO_PATH
60
+ sudo apt update; sudo apt install -y python3-pip
61
+ pip3 install -r requirements.txt
62
+ fi
63
+
64
+ echo "----example start----"
65
+ cd $JETSON_REPO_PATH
66
+ script_dir=$(dirname "$0")
67
+ start_script=$script_dir/$1/run.sh
68
+ if [ -f $start_script ]; then
69
+ bash $start_script
70
+ else
71
+ echo "ERROR: Example[$1] Not Found."
72
+ fi
73
+ echo "----example done----"
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ ./run.sh $(./autotag stable-diffusion-webui)
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+
3
+ # download llm model
4
+ ./run.sh --workdir=/opt/text-generation-webui $(./autotag text-generation-webui) /bin/bash -c \
5
+ 'python3 download-model.py --output=/data/models/text-generation-webui TheBloke/Llama-2-7b-Chat-GPTQ'
6
+
7
+ # run text-generation-webui
8
+ ./run.sh $(./autotag text-generation-webui)
@@ -0,0 +1,27 @@
1
+ #!/bin/bash
2
+ echo "--update jetson-containers repo--"
3
+ BASE_PATH=/home/$USER/reComputer
4
+ mkdir -p $BASE_PATH/
5
+
6
+ JETSON_REPO_PATH="$BASE_PATH/jetson-containers"
7
+ BASE_JETSON_LAB_GIT="https://github.com/dusty-nv/jetson-containers/tree/d1573a3e8d7ba3fef36ebb23a7391e60eaf64db7"
8
+
9
+ if [ -d $JETSON_REPO_PATH ]; then
10
+ echo "jetson-ai-lab existed."
11
+ # 5 publish to Test PyPI
12
+ read -p "follow the newest version maybe bring bugs, are you sure about the update? (y/n): " choice
13
+ if [[ $choice == "y" || $choice == "Y" ]]; then
14
+ cd $JETSON_REPO_PATH
15
+ git pull
16
+ pip3 install -r requirements.txt
17
+ else
18
+ echo "skip update."
19
+ fi
20
+ else
21
+ echo "jetson-ai-lab does not installed. start init..."
22
+ cd $BASE_PATH/
23
+ git clone --depth=1 $BASE_JETSON_LAB_GIT
24
+ cd $JETSON_REPO_PATH
25
+ sudo apt update; sudo apt install -y python3-pip
26
+ pip3 install -r requirements.txt
27
+ fi
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ ./run.sh $(./autotag whisper)
@@ -1,14 +0,0 @@
1
- LICENSE
2
- README.md
3
- pyproject.toml
4
- jetson_examples.egg-info/PKG-INFO
5
- jetson_examples.egg-info/SOURCES.txt
6
- jetson_examples.egg-info/dependency_links.txt
7
- jetson_examples.egg-info/entry_points.txt
8
- jetson_examples.egg-info/top_level.txt
9
- reComputer/__init__.py
10
- reComputer/main.py
11
- reComputer/scripts/check.sh
12
- reComputer/scripts/live-llava.sh
13
- reComputer/scripts/nanodb.sh
14
- reComputer/scripts/run.sh
@@ -1 +0,0 @@
1
- __version__ = "0.0.4"
@@ -1,29 +0,0 @@
1
- import os
2
- import subprocess
3
- import sys
4
-
5
-
6
- def script(name):
7
- script_path = os.path.join(os.path.dirname(__file__), "scripts", name)
8
- return script_path
9
-
10
-
11
- def run_script():
12
- # TODO: maybe use python instead of shell is better
13
- if len(sys.argv) == 3:
14
- if sys.argv[1] == "run":
15
- example_name = sys.argv[2]
16
- subprocess.run(["bash", script("run.sh"), example_name])
17
- else:
18
- print("Only Support `run` for now. try `reComputer run llava` .")
19
- elif len(sys.argv) == 2:
20
- if sys.argv[1] == "check":
21
- subprocess.run(["bash", script("check.sh")])
22
- else:
23
- print("Only Support `check` for now. try `reComputer check` .")
24
- else:
25
- print("Error Usage! try `reComputer run xxx` .")
26
-
27
-
28
- if __name__ == "__main__":
29
- pass
@@ -1,117 +0,0 @@
1
- #!/bin/bash
2
-
3
- check_is_jetson_or_not() {
4
- model_file="/proc/device-tree/model"
5
-
6
- if [ -f "/proc/device-tree/model" ]; then
7
- model=$(tr -d '\0' < /proc/device-tree/model | tr '[:upper:]' '[:lower:]')
8
- if [[ $model =~ jetson|orin|nv|agx ]]; then
9
- echo "INFO: machine[$model] confirmed..."
10
- else
11
- echo "WARNING: machine[$model] maybe not support..."
12
- exit 1
13
- fi
14
- else
15
- echo "ERROR: machine[$model] not support this..."
16
- exit 1
17
- fi
18
- }
19
- check_is_jetson_or_not
20
-
21
- check_disk_space() {
22
- directory="$1" # a directory
23
- required_space_gb="$2" # how many GB we need
24
-
25
- # get disk of directory
26
- device=$(df -P "$directory" | awk 'NR==2 {print $1}')
27
- echo $device
28
-
29
- # get free space in KB
30
- free_space=$(df -P "$device" | awk 'NR==2 {print $4}')
31
- echo $free_space
32
-
33
- # change unit to GB
34
- free_space_gb=$(echo "scale=2; $free_space / 1024 / 1024" | bc)
35
- echo $free_space_gb
36
-
37
- # check and fast-fail
38
- if (( $(echo "$free_space_gb >= $required_space_gb" | bc -l) )); then
39
- echo "disk space ($1) enough, keep going."
40
- else
41
- echo "disk space ($1) not enough!! we need $2 GB!!"
42
- exit 1
43
- fi
44
- }
45
-
46
- echo "run example:$1"
47
- BASE_PATH=/home/$USER/reComputer
48
- echo "----example init----"
49
- mkdir -p $BASE_PATH/
50
- JETSON_REPO_PATH="$BASE_PATH/jetson-containers"
51
- if [ -d $JETSON_REPO_PATH ]; then
52
- echo "jetson-ai-lab existed."
53
- else
54
- echo "jetson-ai-lab does not installed. start init..."
55
- cd $BASE_PATH/
56
- git clone --depth=1 https://github.com/dusty-nv/jetson-containers
57
- cd $JETSON_REPO_PATH
58
- sudo apt update; sudo apt install -y python3-pip
59
- pip3 install -r requirements.txt
60
- fi
61
- echo "----example start----"
62
- cd $JETSON_REPO_PATH
63
- case "$1" in
64
- "llava")
65
- ./run.sh $(./autotag llava) \
66
- python3 -m llava.serve.cli \
67
- --model-path liuhaotian/llava-v1.5-7b \
68
- --image-file /data/images/hoover.jpg
69
- ;;
70
- "llava-v1.5-7b")
71
- ./run.sh $(./autotag llava) \
72
- python3 -m llava.serve.cli \
73
- --model-path liuhaotian/llava-v1.5-7b \
74
- --image-file /data/images/hoover.jpg
75
- ;;
76
- "llava-v1.6-vicuna-7b")
77
- ./run.sh $(./autotag local_llm) \
78
- python3 -m local_llm --api=mlc \
79
- --model liuhaotian/llava-v1.6-vicuna-7b \
80
- --max-context-len 768 \
81
- --max-new-tokens 128
82
- ;;
83
- "Sheared-LLaMA-2.7B-ShareGPT")
84
- ./run.sh $(./autotag local_llm) \
85
- python3 -m local_llm.chat --api=mlc \
86
- --model princeton-nlp/Sheared-LLaMA-2.7B-ShareGPT
87
- ;;
88
- "text-generation-webui")
89
- # download llm model
90
- ./run.sh --workdir=/opt/text-generation-webui $(./autotag text-generation-webui) /bin/bash -c \
91
- 'python3 download-model.py --output=/data/models/text-generation-webui TheBloke/Llama-2-7b-Chat-GPTQ'
92
- # run text-generation-webui
93
- ./run.sh $(./autotag text-generation-webui)
94
- ;;
95
- "stable-diffusion-webui")
96
- ./run.sh $(./autotag stable-diffusion-webui)
97
- ;;
98
- "nanoowl")
99
- ./run.sh $(./autotag nanoowl) bash -c "ls /dev/video* && cd examples/tree_demo && python3 tree_demo.py ../../data/owl_image_encoder_patch32.engine"
100
- ;;
101
- "whisper")
102
- ./run.sh $(./autotag whisper)
103
- ;;
104
- "nanodb")
105
- script_dir=$(dirname "$0")
106
- bash $script_dir/nanodb.sh
107
- ;;
108
- "live-llava")
109
- script_dir=$(dirname "$0")
110
- bash $script_dir/live-llava.sh
111
- ;;
112
- *)
113
- echo "Unknown example"
114
- # handle unknown
115
- ;;
116
- esac
117
- echo "----example done----"
File without changes