Skip to content

Instantly share code, notes, and snippets.

View lh0x00's full-sized avatar
💭
do something, something great 📝

Hieu Lam lh0x00

💭
do something, something great 📝
View GitHub Profile
@lh0x00
lh0x00 / vmlu_eval.py
Last active April 8, 2024 16:36
74590d15a0f530a3f074ca005a286312
import pandas as pd
import numpy as np
import torch
import json
import glob
import logging
import os
import argparse
import time
@lh0x00
lh0x00 / prompt_alpaca_lora.py
Created January 6, 2024 13:31 — forked from ahoho/prompt_alpaca_lora.py
Create a huggingface pipeline with a lora-trained alpaca
from typing import Optional, Any
import torch
from transformers.utils import is_accelerate_available, is_bitsandbytes_available
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
GenerationConfig,
pipeline,
var utc;
var navigator = { appName: "" };
var _global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : global;
var exports = {};
(function (global, factory) {
factory(exports);
@lh0x00
lh0x00 / docker-compose-v1.yml
Created November 21, 2022 11:16 — forked from markheath/docker-compose-v1.yml
Elasticsearch docker compose examples
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.4.1
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
@lh0x00
lh0x00 / nonAccentVietnamese.js
Created November 19, 2022 16:42 — forked from jarvisluong/nonAccentVietnamese.js
Converting standard Vietnamese Characters to non-accent ones (Chuyển đổi ký tự tiếng Việt sang không dấu). Example: hải -> hai
// This function converts the string to lowercase, then perform the conversion
function toLowerCaseNonAccentVietnamese(str) {
str = str.toLowerCase();
// We can also use this instead of from line 11 to line 17
// str = str.replace(/\u00E0|\u00E1|\u1EA1|\u1EA3|\u00E3|\u00E2|\u1EA7|\u1EA5|\u1EAD|\u1EA9|\u1EAB|\u0103|\u1EB1|\u1EAF|\u1EB7|\u1EB3|\u1EB5/g, "a");
// str = str.replace(/\u00E8|\u00E9|\u1EB9|\u1EBB|\u1EBD|\u00EA|\u1EC1|\u1EBF|\u1EC7|\u1EC3|\u1EC5/g, "e");
// str = str.replace(/\u00EC|\u00ED|\u1ECB|\u1EC9|\u0129/g, "i");
// str = str.replace(/\u00F2|\u00F3|\u1ECD|\u1ECF|\u00F5|\u00F4|\u1ED3|\u1ED1|\u1ED9|\u1ED5|\u1ED7|\u01A1|\u1EDD|\u1EDB|\u1EE3|\u1EDF|\u1EE1/g, "o");
// str = str.replace(/\u00F9|\u00FA|\u1EE5|\u1EE7|\u0169|\u01B0|\u1EEB|\u1EE9|\u1EF1|\u1EED|\u1EEF/g, "u");
// str = str.replace(/\u1EF3|\u00FD|\u1EF5|\u1EF7|\u1EF9/g, "y");
@lh0x00
lh0x00 / Component.js
Created September 11, 2022 11:13 — forked from smontlouis/Component.js
React Native - Fixed header/footer disappearing on scroll
import React, { PropTypes, Component } from 'react'
import {
Animated,
ScrollView,
Text,
View,
} from 'react-native'
import EStyleSheet from 'react-native-extended-stylesheet'
const styles = EStyleSheet.create({
/*! @sentry/browser 6.16.1 (6919d17) | https://github.com/getsentry/sentry-javascript */
var Sentry = function(t) {
var n = function(t, r) {
return (n = Object.setPrototypeOf || {
__proto__: []
}
instanceof Array && function(t, n) {
t.__proto__ = n
} || function(t, n) {
for (var r in n) n.hasOwnProperty(r) && (t[r] = n[r])
@lh0x00
lh0x00 / index.html
Last active August 8, 2021 04:53 — forked from kapral18/index.html
promises vs async / await vs generator
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Native AsyncAwait vs babel regenerator vs promises</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@lh0x00
lh0x00 / index.html
Created August 8, 2021 04:51 — forked from kapral18/index.html
Native AsyncAwait vs babel regenerator vs promises (http://jsbench.github.io/#bb78a677c5850d0830ff7d818d5ac4cd) #jsbench #jsperf
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Native AsyncAwait vs babel regenerator vs promises</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
function get_max_value(
k: number,
n: number,
weights: number[],
values: number[],
): number {
let max_value = 0
const ratios = {} as { [i: number]: number }
for (let i = 0; i < n; i++) {