This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| blueprint: | |
| name: 万能联动控制 (支持传感器/开关) | |
| description: > | |
| 当触发器 A 变为 "开" (on) 时,如果目标 B 当前是 "关" (off) 的,则开启 B。 | |
| 随后当 A 变为 "关" (off) 时,自动关闭 B。 | |
| 如果 A 开启时 B 已经是开启状态,则忽略本次联动。 | |
| domain: automation | |
| input: | |
| trigger_entity: | |
| name: 触发实体 A |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import onnxruntime as ort | |
| from tokenizers import Tokenizer | |
| import cv2 | |
| import tqdm | |
| model_path = "." | |
| onnx_model_path = f"{model_path}/onnx" | |
| tokenizer = Tokenizer.from_file(f"{model_path}/tokenizer.json") | |
| # np.random.seed(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| gcc -shared -fPIC rknpu2_domain_interceptor.c -o libdomain_interceptor.so -ldl -lrt | |
| LD_PRELOAD=./libdomain_interceptor.so python ./test_rknn_runner.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import re | |
| import pypinyin | |
| from functools import cmp_to_key | |
| dic = {"零":0,"一":1,"二":2,"三":3,"四":4,"五":5,"六":6,"七":7,"八":8,"九":9,"十":10,"百":100,"千":1000,"万":10000,"亿":100000000,"兆":1000000000000} | |
| def chi_num(text): | |
| if len(text) == 0: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #python3 ./run_rknn.py -i ./out --prompt "A 4K photo of an astronant riding a horse on the moon" -o ./out.png --num-inference-steps 25 --scheduler EulerAncestralDiscreteScheduler --guidance-scale 6 | |
| import argparse | |
| import json | |
| import time | |
| from diffusers import StableDiffusionPipeline | |
| from diffusers.pipelines.pipeline_utils import DiffusionPipeline | |
| from diffusers.pipelines.stable_diffusion import StableDiffusionPipelineOutput | |
| from diffusers.schedulers import ( | |
| DDIMScheduler, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| from typing import Dict, List, Tuple | |
| import os | |
| import argparse | |
| import pickle | |
| import web_stable_diffusion.trace as trace | |
| import web_stable_diffusion.utils as utils | |
| from platform import system |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <fstream> | |
| #include <sstream> | |
| #include <string> | |
| int main() { | |
| // 处理GPU | |
| std::ifstream gpu_load("/sys/class/devfreq/fb000000.gpu/load"); | |
| std::string gpu; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Author: hallo1, 2023-09-06 | |
| // Description: Simple FPS or whatever counter | |
| #pragma once | |
| #include <chrono> | |
| #include <iostream> | |
| #include <string> | |
| class FPSCounter { | |
| private: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |
| # This software may be used and distributed according to the terms of the GNU General Public License version 3. | |
| from typing import Tuple | |
| import os | |
| import sys | |
| import torch | |
| import fire | |
| import time | |
| import json |