Skip to content

Instantly share code, notes, and snippets.

View longern's full-sized avatar

Siyu Long longern

View GitHub Profile
@longern
longern / index.html
Last active November 19, 2024 03:26
Outliar - An easy-to-play social deduction tabletop game, playable with poker. https://outliar.longern.com
<!-- https://outliar.longern.com -->
<!-- An easy-to-play social deduction tabletop game. -->
<!-- Playable with poker. -->
<!-- 3 minutes | 4+ players -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta

The training task for Transformers, formulated as $f([c_1c_2...c_{n-1}]) \rightarrow c_n$, is stateless and does not involve hidden states like those found in Recurrent Neural Networks (RNNs). To elaborate, Transformers represent a significant shift in approach to sequence modeling tasks, which were traditionally dominated by models that maintain hidden states, such as RNNs and their variants like Long Short-Term Memory (LSTM) and Gated Recurrent Units (GRU).

Unlike RNNs that process input sequences step by step and maintain hidden states to carry information across steps, Transformers rely on self-attention mechanisms. These mechanisms allow each element in a sequence to dynamically attend to any other elements, thereby capturing dependencies regardless of their positions in the sequence. This feature enables the Transformer model to parallelize training more effectively than RNNs, as it eliminates the need for sequential processing dictated by hidden states.

The absence of hidden states in Transformers re

The emergence of Attention Mechanisms has revolutionized the field of deep learning, especially within the realms of Natural Language Processing (NLP) and Computer Vision. These mechanisms allow models to focus on specific parts of the input data that are more relevant to solving the task at hand, mimicking the attentive processes observed in human cognition. However, the scalability of traditional attention mechanisms, especially in contexts with large input sequences or feature dimensions, remains a challenge due to the quadratic complexity associated with computing pairwise relevance scores.

In light of these challenges, we introduces a novel attention mechanism, termed as KNN (K-Nearest Neighbors) Attention, that leverages the principles of efficient nearest neighbor search to enhance the scalability and efficiency of attention computations. Unlike the traditional attention mechanisms that compute scores across all pairs of input units, KNN Attention focuses on identifying and utilizing a limited num

import base64
import json
import urllib.request
def new_response(body=None, status=200, headers=None):
return {
'statusCode': status,
'headers': headers,
'body': body,
}

2023 年 1 月浙江省高考技术选考真题

考生须知:

  1. 考生答题前,务必将自已的姓名、准考证号用黑色字迹的签字笔或钢笔填写在答题纸上。
  2. 选择题的答案须用 2B 铅笔将答题纸上对应题目的答案标号涂黑,如要改动须将原填涂处用橡皮擦净。
  3. 非选择题的答案须用黑色字迹的签字笔或钢笔写在答题纸上相应区域内,作图时可先使用 2B 铅笔,确定后须用黑色字迹的签字笔或钢笔描黑,答案写在本试题卷上无效。

第一部分 信息技术(共 50 分)

一、选择题(本大题共 12 小题,每小题 2 分,共 24 分。每小题列出的四个备选项中只有一个是符合题目要求的,不选、多选、错选均不得分)

@longern
longern / ipfs_worker.js
Created June 10, 2022 05:41
IPFS Cloudflare worker proxy
addEventListener('fetch', function (event) {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
// Only GET requests work with this proxy.
if (request.method !== 'GET')
return new Response(`Method ${request.method} not allowed.`, {
status: 405,
headers: { Allow: 'GET' },