Skip to content

Instantly share code, notes, and snippets.

View paulhendricks's full-sized avatar

Paul Hendricks paulhendricks

View GitHub Profile
# Load BERT and the preprocessing model from TF Hub.
preprocess = hub.load('https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/1')
encoder = hub.load('https://tfhub.dev/tensorflow/bert_en_uncased_L-12_H-768_A-12/3')
# Use BERT on a batch of raw text inputs.
input = preprocess(['Batch of inputs', 'TF Hub makes BERT easy!', 'More text.'])
pooled_output = encoder(input)["pooled_output"]
print(pooled_output)
tf.Tensor(
# Copyright 2019 The Feast Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
name: nvtabular_dev_11.0
channels:
- rapidsai
- nvidia
- rapidsai-nightly
- fastai
- pytorch
- conda-forge
- defaults
dependencies:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
docker pull nvcr.io/nvidia/rapidsai/rapidsai:0.16-cuda11.0-runtime-ubuntu18.04
docker tag nvcr.io/nvidia/rapidsai/rapidsai:0.16-cuda11.0-runtime-ubuntu18.04 rapidsai
docker run \
--runtime=nvidia \
--rm -it \
-p 8888:8888 -p 8787:8787 -p 8786:8786 \
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import matplotlib.pyplot as plt
import numpy as np
# settings
n_iterations = 100000
# great sword
initiative = np.random.randint(1, 21, size=(n_iterations,)) + 2
damage = np.random.randint(1, 7, size=(2, n_iterations)).sum(axis=0) + 2
spam = ['apple', 'banana', 'tofu', 'cats']
result = ', '.join(spam[:-1]) + ', and ' + spam[-1]
print(result)
"""
Iterates through all possible word combinations and checks if they are in the
English dictionary; if so, calculates the value for that play. Finally, prints
all solutions in descending order of value.
Setup: pip install pyenchant
Usage: python words_with_friends.py --letters "a,r,f,i,b,a,o" --values "1,1,4,4,1,4,1,1"
"""
import argparse
import enchant

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft