Skip to content

Instantly share code, notes, and snippets.

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

zuozuo dcalsky

🏠
Working from home
  • The University of Hong Kong
  • Hong Kong
View GitHub Profile
@zhanwenchen
zhanwenchen / export_tf_model.py
Last active August 31, 2021 22:51
Minimal code to load a trained TensorFlow model from a checkpoint and export it with SavedModelBuilder
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')
@AlexV525
AlexV525 / create_images.dart
Last active November 17, 2023 10:28
How do we create images through RepaintBoundary or Widget? (Null safety version)
///
/// [Author] Alex (https://github.com/AlexV525)
/// [Date] 07/30/21 5:29 PM
///
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
@rogeriochaves
rogeriochaves / main.py
Created July 10, 2023 05:34
MULTI_PROMPT_ROUTER_TEMPLATE improved
"""You help triaging user requests. Given a raw text input, output either DOCS or DEFAULT, according to those definitions:
DOCS: if user is asking a seemingly technical question, programming questions or company-specific questions
DEFAULT: if user is just chit-chatting or basic knowledge questions
====================
Input: hello there
Output: DEFAULT
@kouroshHakha
kouroshHakha / create_test_dataset.py
Created December 11, 2023 05:06
JSON Mode and Function-calling on Open LLMs Blogpost
import datasets
import re
import json
import tqdm
ds = datasets.load_dataset("glaiveai/glaive-function-calling-v2", split="train")
out_ds_size = 100
class UserAssistantNotFoundError(Exception):