This file contains 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
from mlx_lm import load, generate | |
model, tokenizer = load( | |
"microsoft/Phi-3.5-mini-instruct", | |
tokenizer_config={"eos_token": "<|end|>", "trust_remote_code": True}, | |
) | |
messages = [ | |
{"role": "user", "content": "Hello, how are you?"}, | |
] |
This file contains 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
#!/bin/bash | |
CYAN="$(tput bold; tput setaf 6)" | |
RESET="$(tput sgr0)" | |
clear | |
if command -v python3 > /dev/null 2>&1; then | |
if [ $(python3 -c "print('ye')") = "ye" ]; then | |
clear |
This file contains 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 android.bluetooth.BluetoothAdapter | |
import android.bluetooth.BluetoothDevice | |
import android.bluetooth.BluetoothSocket | |
import android.util.Log | |
import com.google.common.primitives.Bytes | |
import kotlinx.coroutines.* | |
import java.io.IOException | |
import java.io.InputStream | |
import java.io.OutputStream | |
import java.util.* |
This file contains 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
// Convert application-json content to DTO with validation and rasing error message | |
suspend inline fun <reified T : Any> ApplicationCall.bindJson(): T { | |
val dto = this.receive<T>() | |
val violations = validator.validate(dto); | |
if (violations.size > 0) { | |
// Throw error messages when found violdations | |
val details = violations.map { | |
val propertyName = it.propertyPath.toString() | |
val errorMessage = it.message |
This file contains 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
name | zh_name | title | nicknames | upper_name | |
---|---|---|---|---|---|
olaf | 奥拉夫 | 狂战士 | {} | Olaf | |
galio | 加里奥 | 正义巨像 | {} | Galio | |
twistedfate | 崔斯特 | 卡牌大师 | {} | TwistedFate | |
leblanc | 乐芙兰 | 诡术妖姬 | {} | Leblanc | |
kayle | 凯尔 | 正义天使 | {} | Kayle | |
alistar | 阿利斯塔 | 牛头酋长 | {} | Alistar | |
nunu | 努努和威朗普 | 雪原双子 | {} | Nunu | |
ashe | 艾希 | 寒冰射手 | {} | Ashe | |
jax | 贾克斯 | 武器大师 | {} | Jax |
This file contains 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
{ | |
"黑暗之女": "安妮", | |
"狂战士": "奥拉夫", | |
"正义巨像": "加里奥", | |
"卡牌大师": "崔斯特", | |
"德邦总管": "赵信", | |
"无畏战车": "厄加特", | |
"诡术妖姬": "乐芙兰", | |
"猩红收割者": "弗拉基米尔", | |
"末日使者": "费德提克", |
This file contains 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 tensorflow as tf | |
trained_checkpoint_prefix = 'checkpoints/dev' | |
export_dir = os.path.join('models', '0') # IMPORTANT: each model folder must be named '0', '1', ... Otherwise it will fail! | |
loaded_graph = tf.Graph() | |
with tf.Session(graph=loaded_graph) as sess: | |
# Restore from checkpoint | |
loader = tf.train.import_meta_graph(trained_checkpoint_prefix + '.meta') |
This file contains 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
# 给正整数N,分解成1和3的组合,比如N=4,分解为1111,13,31(递归) | |
N = 5 | |
res = [] | |
def helper(left, arr=[]): | |
if left == 0: | |
res.append(arr) | |
return | |
if left < 0: |