id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,287,200 | rand_dataset.py | dptech-corp_NAG2G/NAG2G/data/rand_dataset.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
import numpy as np
from scipy.spatial import distance_matrix
from functools import lru_cache
from torch.utils.data.dataload... | 1,363 | Python | .py | 38 | 29.815789 | 67 | 0.666413 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,201 | graph_features.py | dptech-corp_NAG2G/NAG2G/data/graph_features.py | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from functools import lru_cache
from unicore.data import BaseWrapperDataset, data_utils
from numba import njit
from .collator import... | 14,494 | Python | .py | 411 | 25.776156 | 88 | 0.530871 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,202 | empty_smiles_dataset.py | dptech-corp_NAG2G/NAG2G/data/empty_smiles_dataset.py | import logging
from rdkit import Chem
from rdkit.Chem import AllChem
import numpy as np
import re
import pickle
from functools import lru_cache
from unicore.data import UnicoreDataset
logger = logging.getLogger(__name__)
def get_atom(smiles):
mol = Chem.MolFromSmiles(smiles)
mol = AllChem.AddHs(mol)
atom... | 3,278 | Python | .py | 86 | 31.313953 | 119 | 0.626381 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,203 | distance_dataset.py | dptech-corp_NAG2G/NAG2G/data/distance_dataset.py |
import numpy as np
import torch
from scipy.spatial import distance_matrix
from functools import lru_cache
from unicore.data import BaseWrapperDataset
class DistanceDataset(BaseWrapperDataset):
def __init__(self, dataset):
super().__init__(dataset)
self.dataset = dataset
@lru_cache(maxsize=... | 1,721 | Python | .py | 43 | 33.046512 | 79 | 0.630631 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,204 | __init__.py | dptech-corp_NAG2G/NAG2G/data/__init__.py | from .customized_unicore_dataset import CustomizedUnicoreDataset
from .mask_points_dataset import MaskPointsDataset, MaskPointsPocketDataset
from .distance_dataset import DistanceDataset, EdgeTypeDataset, CrossDistanceDataset
from .rand_dataset import RandomDataset, RandomLabelDataset
from .key_dataset import KeyDatase... | 1,111 | Python | .py | 25 | 42.16 | 84 | 0.861878 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,205 | list_shuffle_dataset.py | dptech-corp_NAG2G/NAG2G/data/list_shuffle_dataset.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from functools import lru_cache
from unicore.data import BaseWrapperDataset
import random
import logging
logger = logging.getLogger(__n... | 748 | Python | .py | 21 | 30.714286 | 65 | 0.697642 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,206 | reorder_dataset.py | dptech-corp_NAG2G/NAG2G/data/reorder_dataset.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import lmdb
import os
import pickle
import torch
import numpy as np
from functools import lru_cache
import logging
from unicore.data imp... | 2,311 | Python | .py | 54 | 35.518519 | 124 | 0.648444 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,207 | key_dataset.py | dptech-corp_NAG2G/NAG2G/data/key_dataset.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
from functools import lru_cache
from unicore.data import BaseWrapperDataset
import logging
logger = logging.getLogger(__name__... | 614 | Python | .py | 18 | 30.166667 | 65 | 0.71912 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,208 | size_dataset.py | dptech-corp_NAG2G/NAG2G/data/size_dataset.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import numpy as np
from functools import lru_cache
from unicore.data import BaseWrapperDataset
import logging
logger = logging... | 1,222 | Python | .py | 31 | 32.645161 | 65 | 0.644426 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,209 | beam_search_generator.py | dptech-corp_NAG2G/NAG2G/search_strategies/beam_search_generator.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
import sys
from typing import Dict, List, Optional
import torch
import torch.nn as nn
from torch import Tensor
from unicore impo... | 41,579 | Python | .py | 919 | 33.022851 | 110 | 0.560465 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,210 | simple_sequence_generator.py | dptech-corp_NAG2G/NAG2G/search_strategies/simple_sequence_generator.py | import math
from typing import Dict, List, Optional
import sys
import torch
import torch.nn as nn
from torch import Tensor
# from . import move_to_cuda, strip_pad
import logging
import math
import sys
from typing import Dict, List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from tor... | 11,220 | Python | .py | 259 | 31.69112 | 121 | 0.562512 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,211 | sample_generator.py | dptech-corp_NAG2G/NAG2G/search_strategies/sample_generator.py | import math
from typing import Dict, List, Optional
import sys
import torch
import torch.nn as nn
from torch import Tensor
# from . import move_to_cuda, strip_pad
import logging
import math
import sys
from typing import Dict, List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from tor... | 11,063 | Python | .py | 233 | 38.446352 | 141 | 0.576966 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,212 | search.py | dptech-corp_NAG2G/NAG2G/search_strategies/search.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import List, Optional
import torch
import torch.nn as nn
from .token_generation_constraints import (
ConstraintSt... | 31,343 | Python | .py | 693 | 34.793651 | 100 | 0.598533 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,213 | greedy_generator.py | dptech-corp_NAG2G/NAG2G/search_strategies/greedy_generator.py | import math
from typing import Dict, List, Optional
import sys
import torch
import torch.nn as nn
from torch import Tensor
# from . import move_to_cuda, strip_pad
import logging
import math
import sys
from typing import Dict, List, Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from torc... | 9,969 | Python | .py | 203 | 37.334975 | 190 | 0.586533 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,214 | token_generation_constraints.py | dptech-corp_NAG2G/NAG2G/search_strategies/token_generation_constraints.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Implements tracking of constraints for a beam item.
A list of constraints is given as a list of one or more token
sequences, each of length... | 16,536 | Python | .py | 402 | 32.532338 | 96 | 0.629844 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,215 | search_utils.py | dptech-corp_NAG2G/NAG2G/search_strategies/search_utils.py | from itertools import accumulate
def collate_tokens(
values,
pad_idx,
left_pad=False,
pad_to_length=None,
pad_to_multiple=1,
):
"""Convert a list of 1d tensors into a padded 2d tensor."""
size = max(v.size(0) for v in values)
size = size if pad_to_length is None else max(size, pad_to_l... | 2,483 | Python | .py | 60 | 34.45 | 88 | 0.601825 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,216 | __init__.py | dptech-corp_NAG2G/NAG2G/search_strategies/__init__.py | # from .beam_search_generator import SequenceGeneratorBeamSearch, EnsembleModel, EnsembleModelWithAlignment, SequenceGeneratorWithAlignment
from .search import Search, BeamSearch, PrefixConstrainedBeamSearch, LexicallyConstrainedBeamSearch, LengthConstrainedBeamSearch, DiverseBeamSearch, Sampling, DiverseSiblingsSearch... | 621 | Python | .py | 7 | 87.857143 | 180 | 0.894309 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,217 | ngram_repeat_block.py | dptech-corp_NAG2G/NAG2G/search_strategies/ngram_repeat_block.py | # Originally from Microsoft Corporation.
# Licensed under the MIT License.
""" Wrapper for ngram_repeat_block cuda extension """
import math
import warnings
from typing import List
import torch
from torch import nn
try:
from fairseq import ngram_repeat_block_cuda
EXTENSION_BUILT = True
except ImportError:
... | 4,105 | Python | .py | 106 | 28.698113 | 102 | 0.571249 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,218 | parse.py | dptech-corp_NAG2G/NAG2G/search_strategies/parse.py | def add_search_strategies_args(parser, train=False, gen=False):
group = parser.add_argument_group("beam search")
group.add_argument(
"--beam-size", default=10, type=int, metavar="N", help="beam size for inference"
)
group.add_argument(
"--search_strategies",
type=str,
def... | 1,067 | Python | .py | 33 | 25.363636 | 107 | 0.618587 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,219 | unimol_encoder.py | dptech-corp_NAG2G/NAG2G/models/unimol_encoder.py | import torch
try:
from unimol.models import UniMolModel
class CustomizedUniMolModel(UniMolModel):
def forward(
self,
src_tokens,
src_distance,
src_coord,
src_edge_type,
encoder_masked_tokens=None,
features_only=False,
... | 3,072 | Python | .py | 72 | 27.166667 | 85 | 0.506024 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,220 | NAG2G.py | dptech-corp_NAG2G/NAG2G/models/NAG2G.py | import logging
import os
import json
import torch
import torch.nn as nn
import torch.nn.functional as F
from unicore import utils
from unicore.models import BaseUnicoreModel, register_model, register_model_architecture
from typing import Callable, Optional, Dict, Tuple, Any, NamedTuple, List
import math
from NAG2G.modu... | 26,512 | Python | .py | 640 | 30.490625 | 122 | 0.582552 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,221 | __init__.py | dptech-corp_NAG2G/NAG2G/models/__init__.py | try:
from .unimol_encoder import CustomizedUniMolModel
except:
print("Cannot import unimol")
from .NAG2G import NAG2GFModel
from .G2G import G2GModel | 157 | Python | .py | 6 | 24 | 53 | 0.809211 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,222 | G2G.py | dptech-corp_NAG2G/NAG2G/models/G2G.py | import logging
import torch
import torch.nn as nn
from unicore.models import register_model, register_model_architecture
from unimol import __version__
if __version__ == "1.5.0":
from unimol.models.transformer_m import TransformerMModel
from unimol.models.transformer_m import (
bert_base_architecture... | 11,513 | Python | .py | 278 | 30.266187 | 110 | 0.57421 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,223 | decay_t2t_schedule.py | dptech-corp_NAG2G/NAG2G/optim/lr_scheduler/decay_t2t_schedule.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional, List
import math
from unicore.optim.lr_scheduler import UnicoreLRScheduler, register_lr_scheduler
@regist... | 3,679 | Python | .py | 73 | 40.438356 | 101 | 0.624409 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,224 | __init__.py | dptech-corp_NAG2G/NAG2G/optim/lr_scheduler/__init__.py | from pathlib import Path
import importlib
import os
# automatically import any Python files in the optim/lr_scheduler/ directory
for file in os.listdir(os.path.dirname(__file__)):
if file.endswith(".py") and not file.startswith("_"):
file_name = file[: file.find(".py")]
importlib.import_module("NAG... | 357 | Python | .py | 8 | 41 | 76 | 0.718391 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,225 | unimolv2.py | dptech-corp_NAG2G/NAG2G/tasks/unimolv2.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from unimol import __version__
if __version__ == "2.0.0":
import logging
import os
import numpy as np
from unicore.dat... | 7,261 | Python | .py | 169 | 28.142012 | 94 | 0.542704 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,226 | transformer_m.py | dptech-corp_NAG2G/NAG2G/tasks/transformer_m.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from unimol import __version__
from unicore import distributed_utils
from NAG2G.utils import save_config
if __version__ == "1.5.0" or __... | 22,317 | Python | .py | 538 | 25.249071 | 98 | 0.47254 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,227 | __init__.py | dptech-corp_NAG2G/NAG2G/tasks/__init__.py | from pathlib import Path
import importlib
# automatically import any Python files in the criterions/ directory
for file in sorted(Path(__file__).parent.glob("*.py")):
if not file.name.startswith("_"):
importlib.import_module("NAG2G.tasks." + file.name[:-3])
| 271 | Python | .py | 6 | 42 | 68 | 0.723485 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,228 | G2G_cal.py | dptech-corp_NAG2G/NAG2G/utils/G2G_cal.py | import sys
import numpy as np
from tqdm import tqdm
from rdkit import Chem
from .draw_img import draw_mol
from .chemutils import add_chirality
from .graph_process import seq2graph
from .mol_graph_basic import graph2mol, error, get_InchiKey, judge_InchiKey, same_smi
import os
from multiprocessing import Pool
import time... | 8,522 | Python | .py | 230 | 29.904348 | 93 | 0.590799 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,229 | chemutils.py | dptech-corp_NAG2G/NAG2G/utils/chemutils.py | # Modified from https://github.com/wengong-jin/iclr19-graph2graph
import rdkit.Chem as Chem
from rdchiral.chiral import copy_chirality
from rdkit.Chem import SanitizeMol, SanitizeFlags
from rdkit.Chem.AllChem import AssignStereochemistry
def canonicalize(smiles, add_atom_num=False):
try:
tmp = Chem.MolFro... | 4,778 | Python | .py | 114 | 35.04386 | 113 | 0.669262 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,230 | utils.py | dptech-corp_NAG2G/NAG2G/utils/utils.py | import torch
import torch.nn.functional as F
def softmax(x, dim: int, onnx_trace: bool = False):
if onnx_trace:
return F.softmax(x.float(), dim=dim)
else:
return F.softmax(x, dim=dim, dtype=torch.float32)
def log_softmax(x, dim: int, onnx_trace: bool = False):
if onnx_trace:
retur... | 673 | Python | .py | 20 | 28 | 61 | 0.660494 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,231 | mol_graph_basic.py | dptech-corp_NAG2G/NAG2G/utils/mol_graph_basic.py | from rdkit import Chem
from rdkit.Chem import AllChem
import numpy as np
try:
from rdkit.Chem import Draw
except:
print("can not import chem draw")
from itertools import product
from copy import deepcopy
from collections import OrderedDict
np.set_printoptions(threshold=np.inf)
flag_kekulize = False
flag_ato... | 13,048 | Python | .py | 335 | 31.731343 | 101 | 0.661209 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,232 | get_curve_plot.py | dptech-corp_NAG2G/NAG2G/utils/get_curve_plot.py | import numpy as np
import matplotlib.pyplot as plt
import os
import sys
def get_result(lines):
count = 0
want = ""
for i in lines:
if "strict" in i or "nodup_list_all" in i:
count += 1
if count == 10:
want = want + i
if count == 11:
break
want... | 1,674 | Python | .py | 52 | 25.307692 | 87 | 0.522896 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,233 | draw_img.py | dptech-corp_NAG2G/NAG2G/utils/draw_img.py | from rdkit import Chem
try:
from rdkit.Chem import Draw
except:
print("can not import chem draw")
def draw_mol(smis, save_path, mols_per_row=4, img_size=(400, 400)):
mols = []
for smi in smis:
try:
mol = Chem.MolFromSmiles(smi)
except:
mol = None
mols.ap... | 479 | Python | .py | 17 | 22.117647 | 86 | 0.619565 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,234 | graph_process.py | dptech-corp_NAG2G/NAG2G/utils/graph_process.py | from rdkit import Chem
from rdkit.Chem import AllChem
import numpy as np
import pandas as pd
import random
import torch
import time
from tqdm import tqdm
from functools import lru_cache, wraps
# from scipy.sparse.csgraph import laplacian
import scipy.sparse as sparse
# allowable multiple choice node and edge feature... | 15,340 | Python | .py | 449 | 25.824053 | 88 | 0.56205 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,235 | save_config.py | dptech-corp_NAG2G/NAG2G/utils/save_config.py | import configparser
list_ = [
"batch_size",
"batch_size_valid",
"data",
"tensorboard_logdir",
"bf16",
"num_workers",
"required_batch_size_multiple",
"valid_subset",
"label_prob",
"mid_prob",
"mid_upper",
"mid_lower",
"plddt_loss_weight",
"pos_loss_weight",
"s... | 2,862 | Python | .py | 98 | 18.979592 | 57 | 0.492017 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,236 | new_multihead_attention.py | dptech-corp_NAG2G/NAG2G/decoder/new_multihead_attention.py | from typing import Dict, Optional
import torch
from torch import Tensor, nn
from unicore.modules import softmax_dropout
class NewSelfMultiheadAttention(nn.Module):
def __init__(
self,
embed_dim,
num_heads,
dropout=0.1,
bias=True,
scaling_factor=1,
reduced_h... | 5,017 | Python | .py | 120 | 30.5 | 112 | 0.552184 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,237 | transformer_decoder.py | dptech-corp_NAG2G/NAG2G/decoder/transformer_decoder.py | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
from unicore.mod... | 7,986 | Python | .py | 176 | 34.454545 | 140 | 0.590366 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,238 | transformer_decoder_layer.py | dptech-corp_NAG2G/NAG2G/decoder/transformer_decoder_layer.py | # Copyright (c) DP Technology.
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict, Optional
import torch
import torch.nn.functional as F
from unicore import utils
from ... | 4,261 | Python | .py | 114 | 28.026316 | 86 | 0.605627 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,239 | __init__.py | dptech-corp_NAG2G/NAG2G/decoder/__init__.py | from .new_multihead_attention import NewSelfMultiheadAttention
from .transformer_decoder_layer import TransformerDecoderLayer
from .transformer_decoder import TransformerDecoder
| 178 | Python | .py | 3 | 58.333333 | 62 | 0.902857 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,240 | init_method.py | dptech-corp_NAG2G/NAG2G/modules/init_method.py | from torch.nn.init import xavier_uniform_
def init_xavier_params(module):
for p in module.parameters():
if p.dim() > 1:
xavier_uniform_(p)
for p in module.parameters():
if p.dim() > 1:
xavier_uniform_(p)
| 254 | Python | .py | 8 | 24.5 | 41 | 0.594262 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,241 | heads.py | dptech-corp_NAG2G/NAG2G/modules/heads.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from unicore import utils
from unicore.modules import LayerNorm
import logging
logger = logging.getLogger(__name__)
class MaskLMHead(nn.Module):
"""Head for masked language modeling."""
def __init__(self, embed_dim, output_dim, activation_f... | 2,550 | Python | .py | 71 | 28.323944 | 74 | 0.617946 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,242 | attn_bias_layer.py | dptech-corp_NAG2G/NAG2G/modules/attn_bias_layer.py | import torch
import torch.nn as nn
from functools import lru_cache
import numpy as np
import time
@lru_cache(maxsize=2)
def laplacian_pe_batch(A, k, idx_type=0):
assert len(A.shape) == 3
B, n, _ = A.shape
assert n > k and k <= 0
degree = A.sum(axis=-1)
return None, degree
class seq2attn: # (nn... | 7,731 | Python | .py | 173 | 33.219653 | 108 | 0.530591 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,243 | __init__.py | dptech-corp_NAG2G/NAG2G/modules/__init__.py | from .init_method import init_xavier_params
from .heads import MaskLMHead, ClassificationHead, NonLinearHead
from .freeze_network import freeze_network
from .attn_bias_layer import seq2attn
| 190 | Python | .py | 4 | 46.5 | 64 | 0.854839 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,244 | NAG2G.py | dptech-corp_NAG2G/NAG2G/losses/NAG2G.py | import math
import torch
import torch.nn.functional as F
from unicore import metrics, utils
from unicore.losses import UnicoreLoss, register_loss
import torch.nn as nn
import torch.distributed as dist
def get_loss(logits_decoder, decoder_target, padding_idx):
decoder_target = decoder_target[:, 1:]
logits_deco... | 5,524 | Python | .py | 109 | 39.045872 | 113 | 0.591481 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,245 | __init__.py | dptech-corp_NAG2G/NAG2G/losses/__init__.py | from pathlib import Path
import importlib
# automatically import any Python files in the criterions/ directory
for file in sorted(Path(__file__).parent.glob("*.py")):
if not file.name.startswith("_"):
importlib.import_module("NAG2G.losses." + file.name[:-3])
| 272 | Python | .py | 6 | 42.166667 | 68 | 0.724528 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,246 | G2G.py | dptech-corp_NAG2G/NAG2G/losses/G2G.py | import math
import torch
import torch.nn.functional as F
from unicore import metrics, utils
from unicore.losses import UnicoreLoss, register_loss
import torch.nn as nn
import torch.distributed as dist
def get_loss(logits_decoder, decoder_target, padding_idx):
decoder_target = decoder_target[:, 1:]
logits_deco... | 5,615 | Python | .py | 110 | 39.472727 | 129 | 0.593989 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,247 | preprocess_smi_to_3d.py | dptech-corp_NAG2G/data_preprocess/preprocess_smi_to_3d.py | import numpy as np
import warnings
import contextlib
import timeout_decorator
from sklearn.mixture import BayesianGaussianMixture
from rdkit import Chem
from rdkit.Chem import Descriptors
from rdkit.Chem import AllChem
from rdkit.Chem import rdMolTransforms
from rdkit import RDLogger
RDLogger.DisableLog("rdApp.*")
w... | 6,673 | Python | .py | 169 | 29.828402 | 121 | 0.604536 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,248 | basic.py | dptech-corp_NAG2G/data_preprocess/basic.py | import pandas as pd
from rdkit import Chem
from rdkit.Chem import AllChem
def get_canonical_smile(testsmi, isomericSmiles=True):
if testsmi == "":
return testsmi
try:
mol = Chem.MolFromSmiles(testsmi)
canonical_smi = Chem.MolToSmiles(mol, isomericSmiles=isomericSmiles)
except:
... | 2,585 | Python | .py | 71 | 29.929577 | 86 | 0.640144 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,249 | lmdb_preprocess.py | dptech-corp_NAG2G/data_preprocess/lmdb_preprocess.py | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import lmdb
import os
import sys
import pickle
import logging
from tqdm import tqdm
import numpy as np
from preprocess_smi_to_3d import smi2coords_3D, smi2coords_2D... | 3,728 | Python | .py | 100 | 28.54 | 86 | 0.595633 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,250 | inference.py | dptech-corp_NAG2G/unimol_plus/inference.py | #!/usr/bin/env python3 -u
# Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import sys
import pickle
import torch
import lmdb
import gzip
import numpy as np
from... | 5,540 | Python | .py | 151 | 28.490066 | 84 | 0.60492 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,251 | setup.py | dptech-corp_NAG2G/unimol_plus/setup.py | """Install script for setuptools."""
from setuptools import find_packages
from setuptools import setup
setup(
name="unimol",
version="2.0.0",
description="",
author="DP Technology",
author_email="unimol@dp.tech",
license="The MIT License",
url="https://github.com/dptech-corp/Uni-Mol",
... | 995 | Python | .py | 30 | 27.166667 | 72 | 0.620976 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,252 | __init__.py | dptech-corp_NAG2G/unimol_plus/unimol/__init__.py | __version__ = "2.0.0"
import importlib
import unimol.tasks
import unimol.data
import unimol.models
import unimol.losses | 128 | Python | .py | 6 | 19 | 21 | 0.824561 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,253 | data_utils.py | dptech-corp_NAG2G/unimol_plus/unimol/data/data_utils.py | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import contextlib
def str_hash(text: str):
hash = 0
for ch in text:
hash = (hash * 281 ^ ord(ch) * 997) & 0xFFFFFFFF
return... | 1,037 | Python | .py | 32 | 26.5625 | 77 | 0.636273 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,254 | conformer_sample_dataset.py | dptech-corp_NAG2G/unimol_plus/unimol/data/conformer_sample_dataset.py | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
from functools import lru_cache
from unicore.data import BaseWrapperDataset, data_utils
from copy import deepcopy
from tqdm import tqdm
class C... | 3,352 | Python | .py | 87 | 30.034483 | 70 | 0.633733 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,255 | molecule_dataset.py | dptech-corp_NAG2G/unimol_plus/unimol/data/molecule_dataset.py | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
from unicore.data import BaseWrapperDataset
from . import data_utils
from numba import njit
from functools import lru_cache
from sci... | 9,658 | Python | .py | 257 | 28.645914 | 110 | 0.548387 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,256 | coord_noise_dataset.py | dptech-corp_NAG2G/unimol_plus/unimol/data/coord_noise_dataset.py | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from functools import lru_cache
import numpy as np
import torch
from unicore.data import BaseWrapperDataset
from . import data_utils
def kabsch_rotation(P, Q):
... | 2,471 | Python | .py | 65 | 30.430769 | 77 | 0.606516 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,257 | __init__.py | dptech-corp_NAG2G/unimol_plus/unimol/data/__init__.py | from .key_dataset import KeyDataset
from .conformer_sample_dataset import (
ConformerPCQSampleDataset,
ConformerPCQTTASampleDataset,
)
from .coord_noise_dataset import CoordNoiseDataset
from .lmdb_dataset import (
LMDBPCQDataset,
)
from .molecule_dataset import (
Unimolv2Features,
)
from .data_utils imp... | 349 | Python | .py | 14 | 22.714286 | 50 | 0.796407 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,258 | key_dataset.py | dptech-corp_NAG2G/unimol_plus/unimol/data/key_dataset.py | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from functools import lru_cache
from unicore.data import BaseWrapperDataset
class KeyDataset(BaseWrapperDataset):
def __init__(self, dataset, key):
se... | 760 | Python | .py | 20 | 32.25 | 65 | 0.671214 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,259 | lmdb_dataset.py | dptech-corp_NAG2G/unimol_plus/unimol/data/lmdb_dataset.py | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from xmlrpc.client import gzip_encode
import lmdb
import os
import numpy as np
import gzip
import collections
import pickle
from functools import lru_cache
import ... | 1,567 | Python | .py | 47 | 26.212766 | 80 | 0.623016 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,260 | unimolv2.py | dptech-corp_NAG2G/unimol_plus/unimol/models/unimolv2.py | import logging
import numpy as np
import torch
import torch.nn as nn
from unicore import utils
from unimol.data import numpy_seed
from unicore.models import (
BaseUnicoreModel,
register_model,
register_model_architecture,
)
from unicore.modules import (
LayerNorm,
)
from .layers import (
AtomFeatu... | 13,766 | Python | .py | 378 | 26.145503 | 148 | 0.564827 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,261 | layers.py | dptech-corp_NAG2G/unimol_plus/unimol/models/layers.py | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from unicore import utils
from unicore.modules import softmax_dropout, SelfMultiheadAttention, LayerNorm
from unicore.utils import (
permute_final_dims,
)
from torch import Tensor
from typing import Callable, Optional
class Dropout... | 21,560 | Python | .py | 577 | 28.542461 | 126 | 0.56734 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,262 | __init__.py | dptech-corp_NAG2G/unimol_plus/unimol/models/__init__.py | from pathlib import Path
import importlib
# automatically import any Python files in the criterions/ directory
for file in sorted(Path(__file__).parent.glob("*.py")):
if not file.name.startswith("_"):
importlib.import_module("unimol.models." + file.name[:-3]) | 272 | Python | .py | 6 | 42.333333 | 68 | 0.725564 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,263 | unimolv2_encoder.py | dptech-corp_NAG2G/unimol_plus/unimol/models/unimolv2_encoder.py | import imp
from typing import Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
from unicore.modules import LayerNorm
from .layers import (
TransformerEncoderLayer,
Dropout,
)
class UniMolv2Encoder(nn.Module):
def __init__(
self,
num_encoder_layers: int = 6,
e... | 2,326 | Python | .py | 73 | 20.876712 | 86 | 0.530303 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,264 | unimolv2.py | dptech-corp_NAG2G/unimol_plus/unimol/tasks/unimolv2.py | # Copyright (c) DP Techonology, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from unicore.data import (
NestedDictionaryDataset,
EpochShuffleDataset,
)
from uni... | 2,851 | Python | .py | 83 | 25.493976 | 76 | 0.604499 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,265 | __init__.py | dptech-corp_NAG2G/unimol_plus/unimol/tasks/__init__.py | from pathlib import Path
import importlib
# automatically import any Python files in the criterions/ directory
for file in sorted(Path(__file__).parent.glob("*.py")):
if not file.name.startswith("_"):
importlib.import_module("unimol.tasks." + file.name[:-3])
| 272 | Python | .py | 6 | 42.166667 | 68 | 0.724528 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,266 | unimolv2.py | dptech-corp_NAG2G/unimol_plus/unimol/losses/unimolv2.py | from dataclasses import dataclass
import math
import torch
import torch.nn.functional as F
import numpy as np
import pandas as pd
from unicore import metrics
from unicore.losses import UnicoreLoss, register_loss
from scipy.spatial.transform import Rotation as R
from typing import List, Callable, Any, Dict
import os
... | 10,294 | Python | .py | 245 | 31.012245 | 88 | 0.546298 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,267 | __init__.py | dptech-corp_NAG2G/unimol_plus/unimol/losses/__init__.py | from pathlib import Path
import importlib
# automatically import any Python files in the criterions/ directory
for file in sorted(Path(__file__).parent.glob("*.py")):
if not file.name.startswith("_"):
importlib.import_module("unimol.losses." + file.name[:-3])
| 273 | Python | .py | 6 | 42.333333 | 68 | 0.725564 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,268 | check_train_smi.py | dptech-corp_NAG2G/unimol_plus/examples/pcqm4m/check_train_smi.py | import gzip
import os, sys
import pickle
from tqdm import tqdm
from multiprocessing import Pool
import lmdb
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.rdMolAlign import GetBestAlignmentTransform
import numpy as np
lines = gzip.open("data.csv.gz", "r").readlines()
target = []
smiles = []
fo... | 1,686 | Python | .py | 62 | 22.403226 | 79 | 0.659416 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,269 | gen_label3d_lmdb.py | dptech-corp_NAG2G/unimol_plus/examples/pcqm4m/gen_label3d_lmdb.py | import gzip
import os, sys
import pickle
from tqdm import tqdm
from multiprocessing import Pool
import lmdb
from rdkit import Chem
import torch
split = torch.load("split_dict.pt")
train_index = split["train"]
os.system("rm -f label_3D.lmdb")
env_new = lmdb.open(
"label_3D.lmdb",
subdir=False,
readonly=F... | 1,028 | Python | .py | 38 | 21.578947 | 84 | 0.61687 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,270 | get_mul3d_lmdb.py | dptech-corp_NAG2G/unimol_plus/examples/pcqm4m/get_mul3d_lmdb.py | import gzip
import os, sys
import pickle
from tqdm import tqdm
from multiprocessing import Pool
import lmdb
# '2022.09.3'
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.rdMolAlign import GetBestAlignmentTransform
import numpy as np
import torch
split_key = sys.argv[1]
split = torch.load("split... | 11,291 | Python | .py | 339 | 25.961652 | 88 | 0.5942 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,271 | preprocess_slurm.py | dptech-corp_NAG2G/unimol_plus/examples/molecules/preprocess_slurm.py | import os
import sys
import json
import glob
import pickle
import pandas as pd
import numpy as np
from rdkit import Chem
from tqdm import tqdm
from rdkit.Chem import Descriptors
from rdkit.Chem import AllChem
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.*')
import warnings
import contextlib
warnings.filterwa... | 5,827 | Python | .py | 148 | 31.648649 | 124 | 0.6339 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,272 | preprocess.py | dptech-corp_NAG2G/unimol_plus/examples/molecules/preprocess.py | import os
import sys
import json
import glob
import pickle
import lmdb
import pandas as pd
import numpy as np
from rdkit import Chem
from tqdm import tqdm
from rdkit.Chem import Descriptors
from rdkit.Chem import AllChem
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.*')
import warnings
import contextlib
warni... | 6,891 | Python | .py | 175 | 30.851429 | 124 | 0.615362 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,273 | preprocess.py | dptech-corp_NAG2G/unimol_plus/examples/mol_conformers/preprocess.py | import os
import sys
import json
import glob
import pickle
import lmdb
import pandas as pd
import numpy as np
from rdkit import Chem
from tqdm import tqdm
from rdkit.Chem import Descriptors
from rdkit.Chem import AllChem
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.*')
import warnings
import contextlib
warni... | 8,758 | Python | .py | 234 | 28.628205 | 154 | 0.595199 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,274 | replace_pos_pred.py | dptech-corp_NAG2G/unimol_plus/scripts/replace_pos_pred.py | import logging
import os
import sys
import pickle
import torch
import lmdb
import gzip
import numpy as np
from unicore import checkpoint_utils, distributed_utils, options, utils
from unicore.logging import progress_bar
from unicore import tasks
from multiprocessing import Pool
from tqdm import tqdm
input_data = sys.a... | 2,985 | Python | .py | 93 | 26.612903 | 82 | 0.630775 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,275 | replace_keys.py | dptech-corp_NAG2G/unimol_plus/scripts/replace_keys.py | import logging
import os
import sys
import pickle
import torch
import lmdb
import gzip
import numpy as np
from unicore import checkpoint_utils, distributed_utils, options, utils
from unicore.logging import progress_bar
from unicore import tasks
input_data = sys.argv[1]
output_data = sys.argv[2]
subset = sys.argv[3]
... | 1,408 | Python | .py | 53 | 23.45283 | 71 | 0.696521 | dptech-corp/NAG2G | 8 | 4 | 2 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,276 | __init__.py | nkchocoai_ComfyUI-PromptUtilities/__init__.py | import configparser
import os
from .py.node.const import *
from .py.node.format import *
from .py.node.preset import *
from .py.node.weight import *
from .py.node.replace import *
from .py.node.random import *
from .py.server import *
from .py.preset import PresetManager
NODE_CLASS_MAPPINGS = {
"PromptUtilitiesFo... | 2,578 | Python | .py | 52 | 45.769231 | 80 | 0.793651 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,277 | preset.py | nkchocoai_ComfyUI-PromptUtilities/py/preset.py | import csv
import json
import os
import yaml
import numpy as np
import folder_paths
class PresetManagerBase:
_presets = None
custom_nodes_dir = folder_paths.get_folder_paths("custom_nodes")[0]
file_extensions = []
@classmethod
def get_presets_dir(cls):
return os.path.join(
... | 7,260 | Python | .py | 174 | 28.534483 | 87 | 0.520771 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,278 | server.py | nkchocoai_ComfyUI-PromptUtilities/py/server.py | import json
from aiohttp import web
import server
from .preset import PresetManager, PresetManagerAdvanced
@server.PromptServer.instance.routes.post("/prompt_utilities/refresh")
async def refresh_preset_manager(request):
PresetManager.load_presets()
PresetManagerAdvanced.load_presets()
return web.Respon... | 1,554 | Python | .py | 37 | 30.972973 | 88 | 0.603586 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,279 | weight.py | nkchocoai_ComfyUI-PromptUtilities/py/node/weight.py | import re
from .base import BaseNode
class PromptUtilitiesPromptWeight(BaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"prompt1": ("STRING", {"default": "", "multiline": False}),
"weight1": (
"FLOAT",
... | 2,639 | Python | .py | 71 | 24.422535 | 75 | 0.435395 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,280 | const.py | nkchocoai_ComfyUI-PromptUtilities/py/node/const.py | from .base import BaseNode
class PromptUtilitiesConstStringBase(BaseNode):
RETURN_TYPES = ("STRING",)
FUNCTION = "get_string"
def get_string(self, string):
return (string,)
class PromptUtilitiesConstString(PromptUtilitiesConstStringBase):
@classmethod
def INPUT_TYPES(cls):
return... | 706 | Python | .py | 22 | 24.136364 | 74 | 0.605302 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,281 | format.py | nkchocoai_ComfyUI-PromptUtilities/py/node/format.py | from .base import BaseNode
class PromptUtilitiesFormatString(BaseNode):
@classmethod
def INPUT_TYPES(s):
input_types = {
"required": {
"prompt": ("STRING", {"default": "[1], [2]", "display": "prompt"}),
},
"optional": {
"arg1": ("STRI... | 1,258 | Python | .py | 38 | 23.736842 | 83 | 0.514876 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,282 | preset.py | nkchocoai_ComfyUI-PromptUtilities/py/node/preset.py | import json
import numpy as np
from .base import BaseNode
from ..preset import PresetManager, PresetManagerAdvanced
import folder_paths
class PromptUtilitiesLoadPreset(BaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"preset": (list(PresetManager.get_pr... | 3,092 | Python | .py | 67 | 36.761194 | 115 | 0.633526 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,283 | replace.py | nkchocoai_ComfyUI-PromptUtilities/py/node/replace.py | from .base import BaseNode
import re
from comfy.sd1_clip import token_weights
class PromptUtilitiesReplaceOrInsertTag(BaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"text": (
"STRING",
{"multiline": True, "default... | 1,772 | Python | .py | 51 | 22.568627 | 75 | 0.439067 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,284 | random.py | nkchocoai_ComfyUI-PromptUtilities/py/node/random.py | from .base import BaseNode
import numpy as np
class PromptUtilitiesSampleTags(BaseNode):
@classmethod
def INPUT_TYPES(s):
return {
"required": {
"tags": ("STRING", {"default": "", "multiline": True}),
"tags_delimiter": (("new line", ","),),
... | 2,937 | Python | .py | 66 | 33.015152 | 86 | 0.496327 | nkchocoai/ComfyUI-PromptUtilities | 8 | 4 | 3 | GPL-3.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,285 | manage.py | Aftendo_Afternote/manage.py | #!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ugoflip.settings')
try:
from django.core.management import execute_from_command_line
except Impo... | 663 | Python | .py | 18 | 30.944444 | 73 | 0.677067 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,286 | urls.py | Aftendo_Afternote/flip/urls.py | from django.urls import path
from . import views
urlpatterns = [
path('auth', views.auth, name='auth'),
path('<str:country>/<str:file>.txt', views.content, name="eula"),
path('<str:country>/confirm/<str:file>.txt', views.content, name="garbage"),
path('flipnote/<str:file>.ppm', views.ppmloader, name="... | 1,536 | Python | .py | 27 | 52.444444 | 80 | 0.669761 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,287 | apps.py | Aftendo_Afternote/flip/apps.py | from django.apps import AppConfig
class FlipConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'flip'
| 140 | Python | .py | 4 | 31.5 | 56 | 0.768657 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,288 | views.py | Aftendo_Afternote/flip/views.py | from django.shortcuts import render
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.core.exceptions import ObjectDoesNotExist
from util.ugo import UgoMenu
from util.ppm import PPMParser
import os.path, io, random, string, datetime
from django.contrib.auth import aut... | 19,233 | Python | .py | 435 | 35.537931 | 319 | 0.618078 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,289 | models.py | Aftendo_Afternote/db/models.py | from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class User(AbstractUser):
fsid = models.CharField(max_length=16, null=True, unique=True, blank=True)
mac = models.CharField(max_length=12, null=True, unique=True, blank=True)
ban = models.BooleanFie... | 3,629 | Python | .py | 65 | 50.861538 | 93 | 0.734384 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,290 | apps.py | Aftendo_Afternote/db/apps.py | from django.apps import AppConfig
class DbConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'db'
| 136 | Python | .py | 4 | 30.5 | 56 | 0.761538 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,291 | admin.py | Aftendo_Afternote/db/admin.py | from django.contrib import admin
from .models import *
# Register your models here.
admin.site.register(Flipnote)
admin.site.register(User)
admin.site.register(Session)
admin.site.register(Category)
admin.site.register(Channel)
admin.site.register(StarLog) | 258 | Python | .py | 9 | 27.555556 | 32 | 0.842742 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,292 | 0012_flipnote_channel.py | Aftendo_Afternote/db/migrations/0012_flipnote_channel.py | # Generated by Django 4.1.7 on 2024-01-14 18:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('db', '0011_channel_category'),
]
operations = [
migrations.AddField(
model_name='flipnote',
... | 508 | Python | .py | 15 | 26.666667 | 109 | 0.645492 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,293 | 0013_user_blue_star_user_green_star_user_purple_star_and_more.py | Aftendo_Afternote/db/migrations/0013_user_blue_star_user_green_star_user_purple_star_and_more.py | # Generated by Django 4.1.7 on 2024-01-15 00:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('db', '0012_flipnote_channel'),
]
operations = [
migrations.AddField(
model_name='user',
name='blue_star',
... | 832 | Python | .py | 28 | 20.25 | 49 | 0.553191 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,294 | 0002_session.py | Aftendo_Afternote/db/migrations/0002_session.py | # Generated by Django 4.1.7 on 2024-01-14 11:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('db', '0001_initial'),
]
operations = [
migrations.CreateModel(
... | 666 | Python | .py | 18 | 28.833333 | 118 | 0.625194 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,295 | 0011_channel_category.py | Aftendo_Afternote/db/migrations/0011_channel_category.py | # Generated by Django 4.1.7 on 2024-01-14 18:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('db', '0010_category_channel'),
]
operations = [
migrations.AddField(
model_name='channel',
... | 509 | Python | .py | 15 | 26.733333 | 110 | 0.646217 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,296 | 0006_session_temp_alter_session_token.py | Aftendo_Afternote/db/migrations/0006_session_temp_alter_session_token.py | # Generated by Django 4.1.7 on 2024-01-14 12:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('db', '0005_rename_session_id_session_token'),
]
operations = [
migrations.AddField(
model_name='session',
name='temp... | 570 | Python | .py | 18 | 23.277778 | 63 | 0.590494 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,297 | 0018_channel_locked_channel_show_in_frontpage.py | Aftendo_Afternote/db/migrations/0018_channel_locked_channel_show_in_frontpage.py | # Generated by Django 4.1.7 on 2024-01-15 23:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('db', '0017_flipnote_date'),
]
operations = [
migrations.AddField(
model_name='channel',
name='locked',
f... | 543 | Python | .py | 18 | 21.777778 | 53 | 0.590385 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,298 | 0001_initial.py | Aftendo_Afternote/db/migrations/0001_initial.py | # Generated by Django 4.1.7 on 2024-01-14 03:06
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_m... | 3,478 | Python | .py | 50 | 57.16 | 329 | 0.635009 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |
2,287,299 | 0005_rename_session_id_session_token.py | Aftendo_Afternote/db/migrations/0005_rename_session_id_session_token.py | # Generated by Django 4.1.7 on 2024-01-14 11:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('db', '0004_user_ban'),
]
operations = [
migrations.RenameField(
model_name='session',
old_name='session_id',
new... | 352 | Python | .py | 13 | 19.846154 | 47 | 0.583832 | Aftendo/Afternote | 8 | 2 | 1 | GPL-2.0 | 9/5/2024, 10:48:09 PM (Europe/Amsterdam) |