Skip to content

Instantly share code, notes, and snippets.

Marcel R. riga

Block or report user

Report or block riga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@riga
riga / lbn_usage.py
Last active Dec 2, 2019
Minimal LBN example using TF 2.0 (https://github.com/riga/LBN)
View lbn_usage.py
# coding: utf-8
"""
This example demonstrates the usage of the LBN different approaches:
- TF eager mode
- TF AutoGraph
- Keras model / layer
"""
import numpy as np
@riga
riga / test_tf20.sh
Created Nov 27, 2019
cmsdist and cmssw setup for tf2.0
View test_tf20.sh
action() {
local base="$( /bin/pwd )"
git clone https://github.com/cms-sw/pkgtools.git
git clone --single-branch --branch tf-2.0 https://github.com/riga/cmsdist.git
./pkgtools/cmsBuild -i tf-2.0 -c cmsdist/ --repository cms.week0 --arch slc7_amd64_gcc820 -j 10 build cmssw-tool-conf --no-cleanup
export SCRAM_ARCH="slc7_amd64_gcc820"
export CMSSW_VERSION="CMSSW_11_0_0_pre12"
@riga
riga / patch_graph.py
Created Nov 27, 2019
Patch a TensorFlow graph
View patch_graph.py
# coding: utf-8
import os
import tensorflow as tf
def read_constant_graph(graph_path, create_session=True, as_text=False):
graph = tf.Graph()
with graph.as_default():
@riga
riga / read_pdf.py
Last active Oct 30, 2019
Read PDF values from MiniAOD
View read_pdf.py
# coding: utf-8
import os
def fwlite_loop(path, handle_data=None, start=0, end=-1, object_type="Event"):
"""
Opens one or more ROOT files defined by *path* and yields the FWLite event. When *handle_data*
is not *None*, it is supposed to be a dictionary ``key -> {"type": ..., "label": ...}``. In that
@riga
riga / test_tf20_cmssw.sh
Created Oct 21, 2019
Test the TensorFlow 2.0 installation in CMSSW.
View test_tf20_cmssw.sh
#!/usr/bin/env bash
action() {
export SCRAM_ARCH="slc7_amd64_gcc820"
export CMSSW_VERSION="CMSSW_11_0_0_pre9"
if [ ! -d "$CMSSW_VERSION" ]; then
scramv1 project CMSSW "$CMSSW_VERSION"
cd "$CMSSW_VERSION/src"
@riga
riga / setup_docker.sh
Created Jun 16, 2019
Setup docker on CERN OpenStack.
View setup_docker.sh
#!/usr/bin/env bash
# install docker
yum remove -y docker docker-client docker-client-latest docker-common docker-latest \
docker-latest-logrotate docker-logrotate docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-ce-cli containerd.io
systemctl start docker
@riga
riga / test_deepjet.py
Last active Oct 7, 2019
CMSSW TensorFlow 1.13.1 evaluation test for the DeepFlavor tagger
View test_deepjet.py
# coding: utf-8
"""
Test evaluation script for the DeepJet tagger.
Input dimensions and names from
https://github.com/cms-sw/cmssw/blob/02d4198c0b6615287fd88e9a8ff650aea994412e/RecoBTag/TensorFlow/plugins/DeepFlavourTFJetTagsProducer.cc
"""
import os
@riga
riga / hipchat_thecodinglove_integration.py
Last active Aug 29, 2015
HipChat Integration parsing the TheCodingLove.com feed
View hipchat_thecodinglove_integration.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
HipChat integration that parses the thecodinglove.com feed and sends
new posts to a HipChat room.
Dependencies:
requests, https://pypi.python.org/pypi/requests
feedparser, https://pypi.python.org/pypi/feedparser
@riga
riga / gist:e776812d53b748cdf51a
Last active Aug 29, 2015 — forked from arngarden/gist:6087798
Simple pylearn2 XOR setup with training and prediction
View gist:e776812d53b748cdf51a
import theano
from pylearn2.models import mlp
from pylearn2.training_algorithms import sgd
from pylearn2.termination_criteria import EpochCounter
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
import numpy as np
from random import randint
class XOR(DenseDesignMatrix):
You can’t perform that action at this time.