This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| if [ ! -x .git/hooks/commit-msg ] || [ ! -f .git/hooks/commit-msg ] || ! cmp ./hooks/commit-msg.sh .git/hooks/commit-msg | |
| then | |
| echo -e "\033[33m Setting Up Git commit Hook..." | |
| mkdir -p .git/hooks/ | |
| cp ./hooks/commit-msg.sh .git/hooks/commit-msg | |
| chmod +x .git/hooks/commit-msg | |
| echo -e "\033[32m Done" | |
| echo -e "\033[33m You can make commit now." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import tarfile | |
| import urllib.request | |
| from datetime import datetime | |
| import zipfile | |
| data_dir = "./data/" | |
| if not os.path.exists(data_dir): | |
| os.mkdir(data_dir) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"version":1,"resource":"file:///Users/smap/Project/seqal/seqal/stoppers/__init__.py","entries":[{"id":"F4pE.py","timestamp":1658194872996}]} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import unicodedata | |
| from typing import List | |
| from pathlib import Path | |
| from collections import defaultdict | |
| from ahocorasick import Automaton | |
| def read_dictionary(dict_path: str) -> dict: | |
| with open(dict_path, 'r', encoding='utf-8') as f: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import List, Dict, Sequence | |
| class Matrics: | |
| def __init__(self, sents_true_labels: Sequence[Sequence[Dict]], sents_pred_labels:Sequence[Sequence[Dict]]): | |
| self.sents_true_labels = sents_true_labels | |
| self.sents_pred_labels = sents_pred_labels | |
| self.types = set(entity['type'] for sent in sents_true_labels for entity in sent) | |
| self.confusion_matrices = {type: {'TP': 0, 'TN': 0, 'FP': 0, 'FN': 0} for type in self.types} | |
| self.scores = {type: {'p': 0, 'r': 0, 'f1': 0} for type in self.types} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| pip install torch==1.4.0 torchvision==0.5.0 tensorboard==2.1.0 | |
| command: | |
| python tensorboard_epoch_demo.py | |
| tensorboard --logdir=runs | |
| """ | |
| import torch | |
| import torch.nn as nn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| import torch.nn as nn | |
| import torch.optim as optim | |
| import torch.nn.functional as F | |
| import torchvision | |
| import torchvision.transforms as transforms | |
| from torch.utils.tensorboard import SummaryWriter | |
| print(torch.__version__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| st = {2: 1478515, | |
| 3: 449113, | |
| 4: 646495, | |
| 5: 166796, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| headers ={ | |
| 'Authorization': 'token <TOKEN>', # replace <TOKEN> with your token | |
| } | |
| response = requests.get('https://api.github.com/users/<username>/received_events', headers=headers) # replace <username> with your user name | |
| data = response.json() | |
| event_actions = {'WatchEvent': 'starred', 'PushEvent': 'pushed to'} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import requests | |
| from lxml import etree | |
| import wget | |
| # prepare | |
| download_directory = 'slides/' | |
| url = 'http://inst.eecs.berkeley.edu/~cs61a/fa18/' | |
| # make request |
NewerOlder