Skip to content

Instantly share code, notes, and snippets.

View indiejoseph's full-sized avatar
🏠
Working from home

Joseph Cheng indiejoseph

🏠
Working from home
View GitHub Profile
@indiejoseph
indiejoseph / gist:b1f04b4f71b77ad7bce8b9379fc72e29
Created September 5, 2024 11:03
Register Conda environment as Ipython kernel
$ conda activate ml
(ml) $ conda install ipykernel
(ml) $ ipython kernel install --user --name=<any_name_for_kernel>
(ml) $ conda deactivate
import torchaudio
def eval(audio, text):
# convert audio to 16000 sample rate
audio = torchaudio.transforms.Resample(orig_freq=44100, new_freq=16000)(torch.tensor(audio).unsqueeze(0)).squeeze()
# process text
tokenized_seq = torch.tensor([processor.tokenizer(text, add_special_tokens=True).input_ids]).to(device)
decoder_input_ids = tokenized_seq[:, 1:]
decoder_input_ids_right_shifted = tokenized_seq[:, :-1]
# process audio
word jyutping
一剎那 no4
七竅 hiu3
七鰓鰻 soi1
丈母娘 noeng4
bam1
九層塔 taap3
乞兒 haat1
乾坤 kin4
乾闥婆 taat3
const resampling = (audioBuffer: AudioBuffer, targetSampleRate: number): Promise<AudioBuffer> => {
const offlineAudioContext = new OfflineAudioContext(1, audioBuffer.length, targetSampleRate);
const source = offlineAudioContext.createBufferSource();
source.buffer = audioBuffer;
source.connect(offlineAudioContext.destination);
source.start();
return offlineAudioContext.startRendering();
You are asked to come up with a set of 20 diverse and detailed roleplay scenarios. These scenarios will be given to a large language model and we will evaluate the large language model for completing the roleplay effectively.
Here are the requirements:
1. Ensure the roles and scenarios are diverse, covering different contexts, professions, and situations.
2. The language used for the scenarios should also be diverse. For example, include both formal and informal dialogues.
3. The type of scenarios should be diverse. Include diverse types of interactions like customer service, medical consultations, casual conversations, educational settings, etc.
4. A large language model should be able to complete the roleplay. For example, do not include scenarios that require real-time actions or physical interactions.
5. The scenarios and dialogues should be in **Cantonese**.
6. Each scenario should be detailed, providing a clear context and background. Include relevant information such as the setting, characters involv
adb -e shell date $(date +%m%d%H%M%Y.%S)

Exploring the Vision of AI Smart Watch

Here is some thoughts of mine on the vision of AI Smart Watch. I hope you enjoy it.

Introduction

Running LLM(Large language model) on a embedding device is a trendy topic in the field of AI. The AI Smart Watch is a typical example of such devices. It is also a challenging task because of the limited resources of the device. In this article, I will explore the vision and the solution of AI Smart Watch.

Vision

@indiejoseph
indiejoseph / gist:39ffdef13bef18d919d9ffa822869bb7
Last active April 9, 2024 21:21
CantoneseLLM20240320 conversation log
User:講一個關於維尼大大嘅故仔畀我聽
CantoneseLLM: 維尼大大係一個好聰明、好有創意嘅人。佢成日都會諗到啲好有趣嘅主意。
有一次,維尼大大去咗公園玩。佢見到好多細路仔喺度玩滑梯。佢突然間諗到,如果將滑梯改造成一個旋轉木馬,一定會好受小朋友歡迎。
於是,維尼大大就開始動手整旋轉木馬。佢用咗好多唔同嘅材料嚟整,包括木頭、金屬同埋塑膠。佢仲用咗好多唔同嘅顏色嚟裝飾旋轉木馬。
終於,維尼大大整好咗旋轉木馬。佢將旋轉木馬放喺公園入面,細路仔一見到旋轉木馬就即刻衝埋去玩。旋轉木馬好受小朋友歡迎,好多細路仔都排隊玩。
@indiejoseph
indiejoseph / 中文運用模擬試卷.json
Created February 26, 2024 19:45
CRE公務員綜合招聘考試 模擬考試
{
"assessment": {
"title": "中文運用模擬試卷",
"access": "public",
"type": "assessment",
"model": "assessmentSnapshot",
"description": "",
"isTimed": true,
"timerFor": "assessmentTimed",
"onTimerExpiration": "autoSubmit",
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
const timeout = (p, ms) => Promise.race([p, wait(ms).then(() => {
throw new Error("Timeout after " + ms + " ms");
})]);
export const pubsubFunction: CloudEventFunction<{
message: { data: string };
}> = async () => {
timeout(checkShellTransactions(), 3 * 60 * 1000) // 3 minutes ms
};