Skip to content

Instantly share code, notes, and snippets.

class GraphWeightsNetwork(nn.Module):
def __init__ (self, continuous_dim, cat_dim, output_dim=1, hidden_dim=32, conv_depth=1):
super(GraphMETNetwork, self).__init__()
self.embed_charge = nn.Embedding(3, hidden_dim//4)
self.embed_pdgid = nn.Embedding(7, hidden_dim//4)
self.embed_pv = nn.Embedding(8, hidden_dim//4)
self.embed_continuous = nn.Sequential(nn.Linear(continuous_dim,hidden_dim//2),
nn.ELU(),
32.866 test_corrected_jets_factory test_jetmet_tools.py:347
└─ 32.866 build coffea/jetmet_tools/CorrectedJetsFactory.py:275
├─ 32.376 __setitem__ awkward1/highlevel.py:966
│ └─ 32.176 with_field awkward1/operations/structure.py:438
│ ├─ 25.561 broadcast_and_apply awkward1/_util.py:492
│ │ ├─ 21.474 apply awkward1/_util.py:549
│ │ │ ├─ 8.790 apply awkward1/_util.py:549
│ │ │ │ ├─ 4.407 getfunction awkward1/operations/structure.py:500
│ │ │ │ │ └─ 4.406 of awkward1/nplike.py:10
│ │ │ │ │ └─ 4.404 kernels awkward1/operations/convert.py:532
#
# Copyright 2015 gRPC 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
#!/usr/bin/env bash
set -e pipefail
NC='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
gpuminer_image="local/gpuminer:latest"
bcnode_image="local/bcnode:latest"
ARG SERVERBASE=20.09-py3
FROM nvcr.io/nvidia/pytorch:${SERVERBASE}
ENV FORCE_CUDA=1
ARG LIB_WITH_CUDA=ON
ARG NPROC=4
RUN git clone https://github.com/rusty1s/pytorch_cluster.git
RUN pushd pytorch_cluster &&\
def loadData(fileName):
# 1. Load Data #
#fileName = "/uscms/home/dkim2/nobackup/safetodel/nano_mc2017_1-11_Skim.root"
file = uproot.open(fileName)
printer.info("file: "+ fileName)
events = file["Events"].arrays(how="zip")
mask = events.pfcand_pt > 0
@lgray
lgray / test_hist_size.py
Created November 11, 2021 20:01
little script to understand nominal-use-case histogram sizes
from coffea import hist
import numpy as np
import random
import string
from tqdm import tqdm
N_ds = 45
N_reg = 3
N_ds_full_syst = 6
N_syst = 53
import torch
from torch_cmspepr.dataset import TauDataset
import json
from tqdm import tqdm
dataset = TauDataset("/mnt/d/mldata/hgcalml/npzs_all")
out_list = []
for i, data in tqdm(enumerate(dataset[:1000])):
import torch
from torch_cmspepr.gravnet_model import GravnetModelWithNoiseFilter
model = GravnetModelWithNoiseFilter(input_dim=9, output_dim=6, k=50, signal_threshold=.05)
weights = torch.load("ckpt_train_taus_integrated_noise_Oct20_212115_best_397.pth.tar")
model.load_state_dict(weights["model"])
jitted = torch.jit.script(model)
import random
from dask.distributed import Client, worker_client, as_completed, secede, rejoin
import pprint
import time
def reduce_chunks(items):
out = 0
for item in items:
out += item #.result()
return out