Skip to content

Instantly share code, notes, and snippets.

View monk1337's full-sized avatar
🌱
It's a long hard fight / But I'll always live for tomorrow.

Aaditya Ura monk1337

🌱
It's a long hard fight / But I'll always live for tomorrow.
View GitHub Profile
from torch_geometric.nn import Explainer, GCNConv, to_captum
from captum.attr import Saliency, IntegratedGradients
import matplotlib.pyplot as plt
def explain_output(model, num_edges, edge_index, node_feat,
node_id= 2,
device = 'cpu'):
captum_model = to_captum(model, mask_type='edge', output_idx=node_id)
@monk1337
monk1337 / call.py
Last active November 25, 2022 16:17
import time
NextPage = True
request_count = 0
# endCursor = '5981683117051934905'
endCursor = '9173542013414046873'
multifeed_n = 20
fetch('https://www.quora.com/ajax/receive_POST', {
method: 'POST',
headers: {
'Accept': '*/*',
'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8',
'Connection': 'keep-alive',
'Cookie': 'm-b=QFncGIoFeSEWiYczzU8Npw==; m-b_lax=QFncGIoFeSEWiYczzU8Npw==; m-b_strict=QFncGIoFeSEWiYczzU8Npw==; m-s=eeDfjDc-QEPVyXxa_tLBMQ==; m-dynamicFontSize=regular; G_ENABLED_IDPS=google; m-ans_frontend_early_version=9d4efaf3578d95ce; __stripe_mid=31d91cf3-05c1-47e0-a1b2-cf13611d568ebac2ef; m-theme=light; m-sa=1; g_state={"i_p":1655016883763,"i_l":1}; _scid=eb3c85b7-2443-47f5-a98a-3a91bc98934c; _gcl_au=1.1.11585039.1655010027; _fbp=fb.1.1655010027457.732862936; _sctr=1|1654972200000; m-lat=ZsW8sG1mBmSKHTmCpjnoig==; m-login=1; m-uid=323905208; __aaxsc=2; aasd=2%7C1655098800968; __stripe_sid=701b6b56-783f-41f5-a615-7d8ad927f96bf85ca1',
'Origin': 'https://www.quora.com',
'Referer': 'https://www.quora.com/topic/Anatomy-1',
'Sec-Fetch-Dest': 'empty',
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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
import pandas as pd
from tqdm import tqdm
import nlpaug.augmenter.char as nac
import nlpaug.augmenter.word as naw
import nlpaug.augmenter.sentence as nas
import nlpaug.flow as nafc
from nlpaug.util import Action
import os
import uuid
sshpass -p 'password' ssh [email protected]
printf "\n\n\nGpu name : name_of_gpu \nIP address : 10.0.0.0 \nalias : 'i' \n\n"
sshpass -p 'password' ssh [email protected]
from transformers import BertTokenizer, BertModel
import torch
import numpy as np
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = BertModel.from_pretrained('bert-base-uncased')
class GcnData(object):
def get_adj_matrix(df, ml_format = True):
"""where df should be one hot of labels"""
all_categoris = list(df.columns)
label_freq = {}
for i in all_categoris:
label_freq[i] = df[i].value_counts()[1]
from metapub import PubMedFetcher
import pickle as pk
from tqdm import tqdm
import uuid
fetch = PubMedFetcher()
import os
os.environ["NCBI_API_KEYY"] = "abcd"
final_data = {}
This file has been truncated, but you can view the full file.
(function() {
function fs(n, t) {
return n.isInstanceOfType(t) ? t : null
}
function dr(n, t) {
if (n.isInstanceOfType(t) || t === null || typeof t == "undefined")
return n.isStruct ? t.boxedValue : t;
throw "InvalidCast to " + n.fullName;
}
function wwf(n) {