Base paper: https://arxiv.org/abs/2106.04399
Extension: https://arxiv.org/pdf/2111.09266.pdf
Tutorial: https://milayb.notion.site/The-GFlowNet-Tutorial-95434ef0e2d94c24aab90e69b30be9b3
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| import math | |
| from typing import Optional, Tuple | |
| class BertSelfAttention(nn.Module): | |
| def __init__(self, config): | |
| super().__init__() | |
| if config.hidden_size % config.num_attention_heads != 0: |
| import torch | |
| import copy | |
| from torch import nn | |
| from transformers import T5PreTrainedModel | |
| from transformers.models.t5.modeling_t5 import T5Stack | |
| from transformers.modeling_outputs import SequenceClassifierOutput | |
| from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss | |
| def mean_pooling(inputs, mask): |
| package | note |
|---|---|
| transformers | Transformer 기반 (masked) language models 알고리즘, 기학습된 모델을 제공 |
| tokenizers | transformers 에서 사용할 수 있는 토크나이저들을 학습/사용할 수 있는 기능 제공. transformers 와 분리된 패키지로 제공 |
| nlp | 데이터셋 및 평가 척도 (evaluation metrics) 을 제공 |
zoomAutenticationTool can be used to escalat| import re | |
| ip_middle_octet = u"(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5]))" | |
| ip_last_octet = u"(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))" | |
| regex = re.compile( | |
| u"^" | |
| # protocol identifier | |
| u"(?:(?:https?|ftp)://)" | |
| # user:pass authentication |
| import json | |
| import urllib.parse | |
| import boto3 | |
| print('Loading function') | |
| s3 = boto3.client('s3') | |
| def lambda_handler(event, context): | |
| #1 - Get the bucket name |
| from __future__ import print_function, absolute_import | |
| __all__ = ['accuracy'] | |
| def accuracy(output, target, topk=(1,)): | |
| """Computes the precision@k for the specified values of k""" | |
| maxk = max(topk) | |
| batch_size = target.size(0) | |
| _, pred = output.topk(maxk, 1, True, True) |
| #------------------------------------------------------------------------------ | |
| # Top 20K hashes from the Troy Hunt / haveibeenpwned Pwned Passwords list v2 (2018-02-21) | |
| # with frequency count and cracked plaintext passwords | |
| # | |
| # The latest version of this file can be found here: | |
| # https://gist.github.com/roycewilliams/281ce539915a947a23db17137d91aeb7 | |
| # | |
| # NOTE: THIS FILE IS DEPRECATED. | |
| # The equivalent of this file, but based on v6 of the Pwned Passwords, is here: | |
| # https://gist.github.com/roycewilliams/226886fd01572964e1431ac8afc999ce |