Skip to content

Instantly share code, notes, and snippets.

View oliverholworthy's full-sized avatar

Oliver Holworthy oliverholworthy

View GitHub Profile
@oliverholworthy
oliverholworthy / dataframe_merge.py
Last active June 29, 2023 15:33
cuDF dataframe merge
import cudf
def merge():
left = cudf.DataFrame(
{
"string_id": [
3,
3,
6,
import numpy as np
import tensorflow as tf
def test_random_embeddings():
query_embeddings = tf.random.uniform((16, 48)).numpy()
item_embeddings = tf.random.uniform((100, 48)).numpy()
with tf.device("/gpu:0"):
preds_gpu = tf.matmul(tf.constant(query_embeddings), tf.transpose(tf.constant(item_embeddings)))
@oliverholworthy
oliverholworthy / check_release_prs.py
Created March 10, 2023 12:48
Check Release Descriptions - Linked Pull Requests
#!/usr/bin/env python3
#
# Copyright (c) 2022, NVIDIA CORPORATION.
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@oliverholworthy
oliverholworthy / xgboost_dask_device_quantile_dmatrix.py
Last active August 30, 2022 09:54
XGBoost Example - Eval Metrics Discrepancy using DaskDeviceQuantileDMatrix
import dask_cudf
import cudf
from dask_cuda import LocalCUDACluster
from dask.distributed import Client
import xgboost
import sklearn.datasets
cluster = LocalCUDACluster()
client = Client(cluster)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<script>
window.klipse_settings = {
selector: '.language-klipse'
};
</script>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="https://storage.googleapis.com/app.klipse.tech/css/codemirror.css">
<script>
window.klipse_settings = {
selector: '.language-klipse'
};
</script>
@oliverholworthy
oliverholworthy / gist:10421159
Created April 10, 2014 20:40
Distinct terms in a multiplication table
;; Project Euler
;;
;; Problem 466
;; https://projecteuler.net/problem=466
;; Find P(64,10e16)
(defn distinct-mult [a b]
(loop [sol #{}
n 0
x (range 1 (inc b))
@oliverholworthy
oliverholworthy / bzg-fringe-hook
Created January 25, 2014 18:47
Hook for bzg-big-fringe-mode
;; Disable big fringe mode when more than one window open
;; http://bzg.fr/emacs-strip-tease.html
(add-hook 'window-configuration-change-hook
(lambda ()
(if (> (count-windows) 1)
(bzg-big-fringe-mode 0)
(bzg-big-fringe-mode 1))))