Skip to content

Instantly share code, notes, and snippets.

View dm4's full-sized avatar
4️⃣

dm4 dm4

4️⃣
View GitHub Profile
@dm4
dm4 / tool.py
Last active March 21, 2024 14:42
試用 OpenAI 的 Function Calling API https://blog.dm4.tw/2024/03/21/try-gpt-function-calling.html
#!/usr/bin/env python3
import json
import logging
from openai import OpenAI
logging.basicConfig(format="[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s")
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
@dm4
dm4 / cuda.md
Last active October 17, 2023 08:24
Run WasmEdge WASI-NN plugin on AWS EC2 Instance

Setup CUDA on AWS EC2 Instance

This tutorial is based on this AWS tutorial. In this tutorial, we will install Nvidia driver on AWS EC2 instance and compile and run llama.cpp on it.

Create an AWS EC2 instance

Here we use g5.4xlarge instance with Ubuntu 22.04 AMI, which use Nvidia A10G GPU.

Install Nvidia driver

@dm4
dm4 / README.md
Last active August 1, 2023 14:28
Run llama2.c with WasmEdge

Run llama2.c with WasmEdge

Prepare wasi-sdk

export WASI_VERSION=20
export WASI_VERSION_FULL=${WASI_VERSION}.0
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VERSION}/wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
tar xvf wasi-sdk-${WASI_VERSION_FULL}-linux.tar.gz
export WASI_SDK_PATH=`pwd`/wasi-sdk-${WASI_VERSION_FULL}

Keybase proof

I hereby claim:

  • I am dm4 on github.
  • I am dm4 (https://keybase.io/dm4) on keybase.
  • I have a public key ASCCM72rJO6voH23nEOFx6x1I4ktFslobnr1J34reQ7eUwo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am dm4 on github.
* I am dm4 (https://keybase.io/dm4) on keybase.
* I have a public key whose fingerprint is CD91 D480 881A A445 46BA 8A25 2846 33CF 9C3D CF17
To claim this, I am signing this object:
{
"100": "1f4af",
"1234": "1f522",
"interrobang": "2049",
"tm": "2122",
"information_source": "2139",
"left_right_arrow": "2194",
"arrow_up_down": "2195",
"arrow_upper_left": "2196",
"arrow_upper_right": "2197",

Keybase proof

I hereby claim:

  • I am dm4 on github.
  • I am dm4 (https://keybase.io/dm4) on keybase.
  • I have a public key whose fingerprint is 9B7E E5DB ED83 D7F0 50AA 892E FE94 EC2C DFD5 C53E

To claim this, I am signing this object:

@dm4
dm4 / Arch_install.md
Last active August 29, 2015 14:10 — forked from xatier/Arch_install.md
@dm4
dm4 / python_resources.md
Last active August 29, 2015 14:10 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@dm4
dm4 / javascript_resources.md
Last active August 29, 2015 14:10 — forked from jookyboi/javascript_resources.md
Here are a set of libraries, plugins and guides which may be useful to your Javascript coding.

Libraries

  • jQuery - The de-facto library for the modern age. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers.
  • Backbone - Backbone.js gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface.
  • AngularJS - Conventions based MVC framework for HTML5 apps.
  • Underscore - Underscore is a utility-belt library for JavaScript that provides a lot of the functional programming support that you would expect in Prototype.js (or Ruby), but without extending any of the built-in JavaScript objects.
  • lawnchair - Key/value store adapter for indexdb, localStorage