repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
MERL-LB | MERL-LB-main/sp_train_nn_dqn.py | import os
import random
import numpy as np
import torch
from collections import namedtuple, deque
from itertools import count
from config.dqn import *
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from envs.datacenter_env.env import DatacenterEnv
from utils import *
os.environ["CU... | 12,168 | 31.97832 | 96 | py |
MERL-LB | MERL-LB-main/mp_test_fixed_rr_sigma.py | import os
import numpy as np
import pandas as pd
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class RR:
def __init__(self, machine_num) -> None:
self.machine_num = machine_num
... | 6,391 | 30.643564 | 93 | py |
MERL-LB | MERL-LB-main/mp_train_nn_ga.py | import os
import torch
import random
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count
from config.ga import *
from typing import List
from envs.datacenter_env.env import DatacenterEnv
from torch.utils.tensorboard impor... | 18,403 | 34.460501 | 96 | py |
MERL-LB | MERL-LB-main/mp_train_nn_deepjs_no_mask.py | import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import matplotlib.pyplot as plt
from torch.distributions import Categorical
from torch.utils.data import Dataset, DataLoader
from config.deepjs import *
from envs.datacenter_env.en... | 18,402 | 35.586481 | 98 | py |
MERL-LB | MERL-LB-main/utils.py | import matplotlib.pyplot as plt
import numpy as np
def plot_mutil_lines_chart(
input,
legend_list=None,
max_line=np.inf,
save_name="test.png",
xlabel="",
ylabel="",
title=""
):
data = np.array(input)
data = data.T
plt.figure(figsize=(12, 6))
for y in data:
if max_li... | 960 | 19.020833 | 32 | py |
MERL-LB | MERL-LB-main/mp_test.py | import os
import random
import torch
import numpy as np
import pandas as pd
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEn... | 12,458 | 32.312834 | 131 | py |
MERL-LB | MERL-LB-main/mp_test_fixed_lg_load.py | import os
import numpy as np
import pandas as pd
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class LG:
def select_action(self, obs):
_, job_run_time, _, machines_run_time, _, action... | 6,402 | 30.234146 | 93 | py |
MERL-LB | MERL-LB-main/mp_test_fixed_lg_sigma.py | import os
import numpy as np
import pandas as pd
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class LG:
def select_action(self, obs):
_, job_run_time, _, machines_run_time, _, action... | 6,175 | 30.671795 | 93 | py |
MERL-LB | MERL-LB-main/sp_train_nn_ppo.py | import os
import random
import numpy as np
import torch
from collections import namedtuple, deque
from itertools import count
from config.ppo import *
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
from torch.utils.tensorboard import SummaryWriter
from envs.datacente... | 14,034 | 32.023529 | 96 | py |
MERL-LB | MERL-LB-main/mp_test_nn_sigma.py | import os
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import pandas as pd
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class Actor(nn.Module):
def _... | 10,899 | 33.169279 | 131 | py |
MERL-LB | MERL-LB-main/mp_test_fixed_lc_sigma.py | import os
import numpy as np
import pandas as pd
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class LC:
def select_action(self, obs):
_, _, _, _, jobs_num, action_mask = obs
... | 6,110 | 30.5 | 93 | py |
MERL-LB | MERL-LB-main/mp_train_nn_deepjs_no_mask_ppo.py | import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import matplotlib.pyplot as plt
from torch.distributions import Categorical
from torch.utils.data import Dataset, DataLoader
from config.deepjs import *
from envs.datacenter_env.en... | 19,410 | 36.185824 | 100 | py |
MERL-LB | MERL-LB-main/mp_train_nn_moead.py | import os
import torch
import random
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count
from config.moead import *
from typing import List
from envs.datacenter_env.env import DatacenterEnv
from torch.utils.tensorboard im... | 16,252 | 33.877682 | 96 | py |
MERL-LB | MERL-LB-main/mp_train_nn_deepjs.py | import os
import random
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import matplotlib.pyplot as plt
from torch.distributions import Categorical
from torch.utils.data import Dataset, DataLoader
from config.deepjs import *
from envs.datacenter_env.en... | 17,996 | 34.994 | 98 | py |
MERL-LB | MERL-LB-main/mp_test_nn.py | import os
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class Actor(nn.Module):
def __init__(self, dim_li... | 9,255 | 34.328244 | 134 | py |
MERL-LB | MERL-LB-main/try.py | from multiprocessing.pool import Pool
from time import sleep
def worker2(id):
print(f"worker2-id{id}")
def worker1(id):
print(f"worker1-id{id}")
for id in range(5):
pool.apply_async(worker2, args=(id,))
# def task(message):
# # report a message
# print(f"Task executing: {message}", flu... | 1,294 | 21.719298 | 83 | py |
MERL-LB | MERL-LB-main/mp_train_nn_nsga2_neighbor.py | import os
import torch
import random
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count
from config.ga import *
from typing import List
from envs.datacenter_env.env import DatacenterEnv
from torch.utils.tensorboard impor... | 23,003 | 34.665116 | 96 | py |
MERL-LB | MERL-LB-main/mp_test_fixed_lc.py | import os
import numpy as np
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class LC:
def select_action(self, obs):
_, _, _, _, jobs_num, action_mask = obs
jobs_num[action_mask... | 4,649 | 30.849315 | 100 | py |
MERL-LB | MERL-LB-main/mp_test_server_num.py | import os
import random
import torch
import numpy as np
import pandas as pd
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEn... | 13,588 | 31.823671 | 97 | py |
MERL-LB | MERL-LB-main/mp_test_fixed_rr_load.py | import os
import numpy as np
import pandas as pd
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class RR:
def __init__(self, machine_num) -> None:
self.machine_num = machine_num
... | 6,618 | 30.221698 | 93 | py |
MERL-LB | MERL-LB-main/mp_test_fixed_lc_load.py | import os
import numpy as np
import pandas as pd
from itertools import count
from multiprocessing import Pool, cpu_count
from config.test import *
from envs.datacenter_env.env import DatacenterEnv
from utils import *
class LC:
def select_action(self, obs):
_, _, _, _, jobs_num, action_mask = obs
... | 6,337 | 30.068627 | 93 | py |
MERL-LB | MERL-LB-main/mp_train_nn_nsga2_no_mask.py | import os
import torch
import random
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count
from config.ga import *
from typing import List
from envs.datacenter_env.env import DatacenterEnv
from torch.utils.tensorboard impor... | 21,474 | 34.378913 | 96 | py |
MERL-LB | MERL-LB-main/envs/datacenter_env/machine.py | import numpy as np
from typing import List
from envs.datacenter_env.job import Job
class Machine:
SLEEP = 0
RUN = 1
def __init__(self, args, machine_id) -> None:
self.args = args
self.id = machine_id
self.state = Machine.SLEEP
self.sleep_delay = 0
# resource time... | 8,221 | 35.705357 | 100 | py |
MERL-LB | MERL-LB-main/envs/datacenter_env/job_generator.py | import numpy as np
class JobGenerator:
def __init__(self, args) -> None:
self.args = args
self.big_job_len_lower = args.max_job_len * 2 / 3
self.big_job_len_upper = args.max_job_len
self.small_job_len_lower = 1
self.small_job_len_upper = args.max_job_len / 5
self.d... | 5,729 | 41.444444 | 96 | py |
MERL-LB | MERL-LB-main/envs/datacenter_env/buffer.py | import queue
import numpy as np
class Buffer(queue.Queue):
def __init__(self, args) -> None:
super(Buffer, self).__init__(args.buffer_size)
self.args = args
self.occupation_rate_record = []
# 记录占用率
def record_rate(self):
self.occupation_rate_record.append(self.qsize() / se... | 787 | 26.172414 | 80 | py |
MERL-LB | MERL-LB-main/envs/datacenter_env/job.py | import numpy as np
class Job:
def __init__(self, args, job_id, res_req, job_len, job_predict_len, enter_time) -> None:
self.args = args
self.id = job_id
self.res_req = res_req
self.len = job_len
self.predict_len = job_predict_len
self.enter_time = enter_time
... | 769 | 28.615385 | 92 | py |
MERL-LB | MERL-LB-main/envs/datacenter_env/env.py | import random
import numpy as np
from typing import List
from envs.datacenter_env.buffer import Buffer
from envs.datacenter_env.job import Job
from envs.datacenter_env.job_generator import JobGenerator
from envs.datacenter_env.machine import Machine
class DatacenterEnv:
def __init__(self, args) -> None:
... | 25,251 | 35.703488 | 100 | py |
MERL-LB | MERL-LB-main/config/test.py | import argparse
def parse_args():
parser = argparse.ArgumentParser()
# environment
parser.add_argument("--seed", default=10, type=int)
parser.add_argument(
"--reset_type",
default="index",
choices=["new", "repeat", "cycle", "index"],
type=str,
)
parser.add_argu... | 4,049 | 33.615385 | 90 | py |
MERL-LB | MERL-LB-main/config/deepjs.py | import argparse
def parse_args():
parser = argparse.ArgumentParser()
# environment
parser.add_argument("--seed", default=0, type=int)
parser.add_argument(
"--reset_type",
default="index",
choices=["new", "repeat", "cycle", "index"],
type=str,
)
parser.add_argum... | 3,736 | 33.284404 | 90 | py |
MERL-LB | MERL-LB-main/config/ppo.py | import argparse
def parse_args():
parser = argparse.ArgumentParser()
# environment
parser.add_argument("--seed", default=0, type=int)
parser.add_argument(
"--reset_type",
default="index",
choices=["new", "repeat", "cycle", "index"],
type=str,
)
parser.add_argu... | 4,417 | 33.787402 | 90 | py |
MERL-LB | MERL-LB-main/config/dqn.py | import argparse
def parse_args():
parser = argparse.ArgumentParser()
# environment
parser.add_argument("--seed", default=0, type=int)
parser.add_argument(
"--reset_type",
default="index",
choices=["new", "repeat", "cycle", "index"],
type=str,
)
parser.add_argu... | 4,322 | 33.309524 | 90 | py |
MERL-LB | MERL-LB-main/config/ga.py | import argparse
def parse_args():
parser = argparse.ArgumentParser()
# environment
parser.add_argument("--seed", default=0, type=int)
parser.add_argument(
"--reset_type",
default="index",
choices=["new", "repeat", "cycle", "index"],
type=str,
)
parser.add_argu... | 4,568 | 33.613636 | 90 | py |
MERL-LB | MERL-LB-main/config/es.py | import argparse
def parse_args():
parser = argparse.ArgumentParser()
# environment
parser.add_argument("--seed", default=0, type=int)
parser.add_argument(
"--reset_type",
default="index",
choices=["new", "repeat", "cycle", "index"],
type=str,
)
parser.add_argum... | 4,280 | 34.675 | 88 | py |
MERL-LB | MERL-LB-main/config/cdga.py | import argparse
def parse_args():
parser = argparse.ArgumentParser()
# environment
parser.add_argument("--seed", default=0, type=int)
parser.add_argument(
"--reset_type",
default="index",
choices=["new", "repeat", "cycle", "index"],
type=str,
)
parser.add_argum... | 4,291 | 34.766667 | 88 | py |
MERL-LB | MERL-LB-main/config/moead.py | import argparse
def parse_args():
parser = argparse.ArgumentParser()
# environment
parser.add_argument("--seed", default=0, type=int)
parser.add_argument(
"--reset_type",
default="index",
choices=["new", "repeat", "cycle", "index"],
type=str,
)
parser.add_argu... | 4,242 | 33.217742 | 90 | py |
PySDD | PySDD-master/setup.py | #!/usr/bin/env python3
# -*- coding: UTF-8 -*-
"""
setup.py
~~~~~~~~
Usage: python3 setup.py build_ext --inplace
:author: Wannes Meert
:copyright: Copyright 2017-2023 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
from setuptools import setup... | 9,384 | 32.398577 | 116 | py |
PySDD | PySDD-master/pysdd-cli.py | #!/usr/bin/env python3
# encoding: utf-8
"""
pysdd-cli
~~~~~~~~~
PySDD command line interface.
:author: Wannes Meert, Arthur Choi
:copyright: Copyright 2018 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
import sys
from pysdd import cli
if ... | 369 | 18.473684 | 81 | py |
PySDD | PySDD-master/pysdd/__main__.py | # -*- coding: UTF-8 -*-
"""
pysdd.__main__
~~~~~~~~~~~~~~
Command Line Interface.
Will be run when `python -m pysdd` is used.
:author: Wannes Meert, Arthur Choi
:copyright: Copyright 2017-2019 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
... | 382 | 18.15 | 86 | py |
PySDD | PySDD-master/pysdd/wmcstochastic.py | # -*- coding: UTF-8 -*-
"""
pysdd.wmcstochastic
~~~~~~~~~~~~~~~~~~~
Apply stochastic computing to Sentential Decision Diagrams (SDD).
:author: Wannes Meert
:copyright: Copyright 2018 KU Leuven.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
import random
from itertools import accumulate
from .sd... | 7,399 | 38.153439 | 106 | py |
PySDD | PySDD-master/pysdd/iterator.py | # -*- coding: UTF-8 -*-
"""
pysdd.iterator
~~~~~~~~~~~~~~
:author: Wannes Meert, Arthur Choi
:copyright: Copyright 2017-2019 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
from collections import deque
from .sdd import SddManager, Vtree, SddNo... | 9,854 | 42.995536 | 107 | py |
PySDD | PySDD-master/pysdd/cli.py | #!/usr/bin/env python3
# encoding: utf-8
"""
pysdd-cli
~~~~~~~~~
PySDD command line interface.
:author: Wannes Meert, Arthur Choi
:copyright: Copyright 2019 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
from pathlib import Path
import sys
im... | 9,639 | 35.793893 | 108 | py |
PySDD | PySDD-master/pysdd/util.py | # -*- coding: UTF-8 -*-
"""
pysdd.util
~~~~~~~~~~
Utility functions on top of the ``sdd`` package.
:author: Wannes Meert, Arthur Choi
:copyright: Copyright 2017-2019 KU Leuven and Regents of the University of California.
:license: Apache License, Version 2.0, see LICENSE for details.
"""
import math
import array
from... | 15,843 | 34.13082 | 114 | py |
PySDD | PySDD-master/pysdd/__init__.py | __version__ = "0.2.11"
| 23 | 11 | 22 | py |
PySDD | PySDD-master/examples/test-3.py | #!/usr/bin/env python3
from pathlib import Path
from pysdd.sdd import SddManager, Vtree
def main():
# set up vtree and manager
vtree = Vtree.from_file("input/opt-swap.vtree".encode())
manager = SddManager.from_vtree(vtree)
print("reading sdd from file ...")
alpha = manager.read_sdd_file("input/opt-swap.sd... | 1,008 | 23.02381 | 67 | py |
PySDD | PySDD-master/examples/wmc-1.py | #!/usr/bin/env python3
from pathlib import Path
import math
from pysdd.sdd import SddManager, Vtree, WmcManager
here = Path(__file__).parent
def main():
# Start from a given CNF and VTREE file
vtree = Vtree.from_file(bytes(here / "input" / "simple.vtree"))
sdd = SddManager.from_vtree(vtree)
print(f"... | 1,340 | 28.8 | 75 | py |
PySDD | PySDD-master/examples/test-4.py | #!/usr/bin/env python3
from pathlib import Path
from pysdd.sdd import SddManager, Vtree
here = Path(__file__).parent
def main():
# set up vtree and manager
vtree = Vtree.from_file(bytes(here / "input" / "rotate-left.vtree"))
manager = SddManager.from_vtree(vtree)
# construct the term X_1 ^ X_2 ^ X_3 ^ X_4... | 1,757 | 27.819672 | 70 | py |
PySDD | PySDD-master/examples/test-2.py | #!/usr/bin/env python3
from pathlib import Path
from pysdd.sdd import SddManager, Vtree
def main():
# set up vtree and manager
var_count = 4
vtree_type = "right".encode()
vtree = Vtree(var_count=var_count, vtree_type=vtree_type)
manager = SddManager(vtree=vtree)
x = [None] + [manager.literal(i) for i in... | 1,492 | 25.192982 | 59 | py |
PySDD | PySDD-master/examples/test-1.py | #!/usr/bin/env python3
from pysdd.sdd import SddManager, Vtree
def main():
# set up vtree and manager
var_count = 4
var_order = [2,1,4,3]
vtree_type = "balanced"
vtree = Vtree(var_count, var_order, vtree_type)
manager = SddManager.from_vtree(vtree)
# construct a formula (A^B)v(B^C)v(C^D)... | 738 | 22.83871 | 58 | py |
PySDD | PySDD-master/examples/test-5.py | #!/usr/bin/env python3
from pathlib import Path
from pysdd.sdd import SddManager, Vtree
here = Path(__file__).parent
def main():
# set up vtree and manager
vtree = Vtree.from_file(bytes(here / "input" / "big-swap.vtree"))
manager = SddManager.from_vtree(vtree)
print("reading sdd from file ...")
alpha = ... | 2,052 | 29.641791 | 85 | py |
PySDD | PySDD-master/tests/test_vtree.py | from pysdd.sdd import SddManager, Vtree
from pysdd.iterator import SddIterator
import sys
import os
import logging
from pathlib import Path
logger = logging.getLogger("pysdd")
directory = None
counter = 0
def test_dot():
vtree = Vtree(var_count=4, var_order=[1, 2, 3, 4], vtree_type="right")
if directory is ... | 832 | 25.03125 | 74 | py |
PySDD | PySDD-master/tests/test_wmcstochastic.py | from pysdd.sdd import SddManager, Vtree, WmcManager
from pysdd.wmcstochastic import WmcStochastic
import pytest
from array import array
import random
def test_wmc1(verbose=False):
vtree = Vtree(var_count=4, var_order=[2, 1, 4, 3], vtree_type="balanced")
sdd = SddManager.from_vtree(vtree)
a, b, c, d = [sdd... | 2,607 | 33.315789 | 99 | py |
PySDD | PySDD-master/tests/test_util.py | from pysdd.util import BitArray
import sys
import os
import logging
from pathlib import Path
logger = logging.getLogger("pysdd")
def test_bitarray1():
b = BitArray(10)
print(b)
assert b[4] is False
assert b[3] is False
assert b[2] is False
b[4] = 1
b[2] = True
print(b)
assert b[4]... | 992 | 19.265306 | 70 | py |
PySDD | PySDD-master/tests/test_nnf.py | from pysdd.util import nnf_file_wmc, sdd_file_wmc, psdd_file_wmc
from pysdd.sdd import Fnf, Vtree, SddManager
from pysdd import cli
import sys
import os
import math
import logging
from pathlib import Path
import filecmp
logger = logging.getLogger("pysdd")
directory = None
counter = 0
here = Path(__file__).parent
de... | 2,298 | 23.98913 | 76 | py |
PySDD | PySDD-master/tests/test_psdd.py | from pysdd.util import psdd_file_wmc
import sys
import os
import math
import logging
from pathlib import Path
import tempfile
logger = logging.getLogger("pysdd")
here = Path(__file__).parent
directory = Path(tempfile.gettempdir())
counter = 0
def test_psdd1():
wmc = psdd_file_wmc(here / "rsrc" / "loop.psdd")
... | 632 | 20.827586 | 58 | py |
PySDD | PySDD-master/tests/test_minimize.py | from pysdd.sdd import SddManager, Vtree
from pysdd.iterator import SddIterator
from pysdd.util import sdd_to_dot, vtree_to_dot
import sys
import os
import logging
from pathlib import Path
import tempfile
logger = logging.getLogger("pysdd")
directory = Path(tempfile.gettempdir())
counter = 0
def test_min1():
vt... | 2,621 | 29.488372 | 93 | py |
PySDD | PySDD-master/tests/test_iterator.py | from pysdd.sdd import SddManager, Vtree
from pysdd.iterator import SddIterator
from pysdd.util import sdd_to_dot, vtree_to_dot
import sys
import os
import logging
from pathlib import Path
logger = logging.getLogger("pysdd")
directory = None
counter = 0
def test_it1():
vtree = Vtree(var_count=4, var_order=[1, 2,... | 5,176 | 31.974522 | 96 | py |
PySDD | PySDD-master/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PySDD documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 21 16:36:46 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# auto... | 4,896 | 28.859756 | 79 | py |
CA-BNE | CA-BNE-master/misc/scripts/llg_fp_anim_BNE.py | #!/usr/bin/python3
import os
import sys
import glob
import re
import math
import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as anim
import itertools
import time
def main(path):
plot_BNE(path)
def plot_BNE(path):
data = []
max_ite... | 1,698 | 22.597222 | 141 | py |
CA-BNE | CA-BNE-master/misc/scripts/llg_anim_BNE.py | #!/usr/bin/python3
import os
import sys
import glob
import re
import math
import matplotlib as mpl
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as anim
import itertools
import time
def main(path):
plot_BNE(path)
def plot_BNE(path):
data = []
max_ite... | 1,531 | 20.885714 | 93 | py |
CA-BNE | CA-BNE-master/misc/scripts/llllgg_anim_BNE.py | #!/usr/bin/python3
import os
import sys
import glob
import re
import math
import matplotlib as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as anim
import itertools
import time
class MySubplot(object):
def __init__(self, data, ax, t... | 3,855 | 27.992481 | 100 | py |
panoptes-python-client | panoptes-python-client-master/setup.py | from setuptools import setup, find_packages
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
setup(
name='panoptes_client',
url='https://github.com/zooniverse/panoptes-python-client',
author='Adam McMaster / Zooniverse',
autho... | 1,147 | 30.888889 | 236 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/inaturalist.py | from panoptes_client.panoptes import Panoptes
class Inaturalist(object):
"""
The class that interacts with the Panoptes' iNaturalist functionality.
Currently, this includes a single route that allows the importing of
iNaturalist Observations as Zooniverse Subjects.
"""
def inat_import(
... | 1,734 | 39.348837 | 107 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/user.py | from __future__ import absolute_import, division, print_function
from panoptes_client.panoptes import PanoptesObject, LinkResolver
from panoptes_client.utils import isiterable, split
BATCH_SIZE = 50
class User(PanoptesObject):
_api_slug = 'users'
_link_slug = 'users'
_edit_attributes = (
'valid_ema... | 1,655 | 26.147541 | 73 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/subject_workflow_status.py | from panoptes_client.panoptes import PanoptesObject
class SubjectWorkflowStatus(PanoptesObject):
"""
Retrieve SubjectWorkflowStatus responses from Panoptes i.e. the retirement
status (current state, retirement date, retirement reason) of a
subject/workflow pair.
Example use:
Get the status o... | 861 | 29.785714 | 78 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/classification.py | from __future__ import absolute_import, division, print_function
from panoptes_client.panoptes import LinkResolver, PanoptesObject
class Classification(PanoptesObject):
_api_slug = 'classifications'
_link_slug = 'classification'
_edit_attributes = ( )
@classmethod
def where(cls, **kwargs):
... | 1,265 | 30.65 | 139 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/project_role.py | from __future__ import absolute_import, division, print_function
from panoptes_client.panoptes import PanoptesObject, LinkResolver
class ProjectRole(PanoptesObject):
_api_slug = 'project_roles'
_link_slug = 'project_roles'
_edit_attributes = ()
LinkResolver.register(ProjectRole)
| 296 | 23.75 | 65 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/subject.py | from __future__ import absolute_import, division, print_function
from panoptes_client.subject_workflow_status import SubjectWorkflowStatus
_OLD_STR_TYPES = (str,)
try:
_OLD_STR_TYPES = _OLD_STR_TYPES + (unicode,)
except NameError:
pass
from builtins import range, str
import logging
import requests
import thr... | 9,185 | 31.574468 | 93 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/set_member_subject.py | from panoptes_client.panoptes import PanoptesObject, LinkResolver
class SetMemberSubject(PanoptesObject):
_api_slug = 'set_member_subjects'
_link_slug = 'set_member_subjects'
_edit_attributes = ()
LinkResolver.register(SetMemberSubject)
LinkResolver.register(SetMemberSubject, 'set_member_subject')
| 314 | 27.636364 | 65 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/project.py | from __future__ import absolute_import, division, print_function
from copy import deepcopy
from panoptes_client.panoptes import (
LinkCollection,
LinkResolver,
PanoptesAPIException,
PanoptesObject,
)
from panoptes_client.project_role import ProjectRole
from panoptes_client.exportable import Exportable
... | 7,315 | 29.739496 | 79 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/utils.py | from __future__ import absolute_import, division, print_function
from builtins import range
import functools
ITERABLE_TYPES = (
list,
set,
tuple,
)
MISSING_POSITIONAL_ERR = 'Required positional argument (pos 1) not found'
try:
from numpy import ndarray
ITERABLE_TYPES = ITERABLE_TYPES + (ndarray... | 1,742 | 22.554054 | 75 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/project_preferences.py | from __future__ import absolute_import, division, print_function
from builtins import str
from panoptes_client.panoptes import PanoptesObject, LinkResolver
from panoptes_client.project import Project
from panoptes_client.user import User
class ProjectPreferences(PanoptesObject):
"""
Contains the settings for ... | 3,085 | 32.182796 | 78 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/workflow_version.py | from __future__ import absolute_import, division, print_function
from panoptes_client.panoptes import (
Panoptes,
PanoptesAPIException,
PanoptesObject,
)
from panoptes_client.workflow import Workflow
class WorkflowVersion(PanoptesObject):
_api_slug = 'versions'
_edit_attributes = tuple()
@cl... | 1,518 | 25.189655 | 77 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/collection_role.py | from __future__ import absolute_import, division, print_function
from panoptes_client.panoptes import PanoptesObject, LinkResolver
class CollectionRole(PanoptesObject):
_api_slug = 'collection_roles'
_link_slug = 'collection_roles'
_edit_attributes = (
'roles',
{
'links': (
... | 444 | 20.190476 | 65 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/collection.py | from __future__ import absolute_import, division, print_function
from builtins import str
from panoptes_client.panoptes import (
PanoptesAPIException,
PanoptesObject,
)
from panoptes_client.subject import Subject
from panoptes_client.utils import batchable
class Collection(PanoptesObject):
_api_slug = 'c... | 2,627 | 25.019802 | 79 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/caesar.py | from panoptes_client.panoptes import Panoptes, PanoptesAPIException
class Caesar(object):
"""
The low-level Caesar HTTP client class. Use this class to interact with the
Caesar API. User credentials are shared with Panoptes, so log in via
:py:meth:`.Panoptes.connect` before use.
"""
EXTRACTOR_... | 11,043 | 40.675472 | 160 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/exportable.py | from __future__ import absolute_import, division, print_function
import csv
import datetime
import functools
import time
import requests
from panoptes_client.panoptes import (
PanoptesAPIException,
Talk,
)
TALK_EXPORT_TYPES = (
'talk_comments',
'talk_tags',
)
talk = Talk()
class Exportable(objec... | 5,571 | 29.448087 | 79 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/__init__.py | from panoptes_client.classification import Classification
from panoptes_client.collection import Collection
from panoptes_client.collection_role import CollectionRole
from panoptes_client.organization import Organization
from panoptes_client.panoptes import Panoptes
from panoptes_client.project import Project
from pano... | 778 | 47.6875 | 73 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/workflow.py | from __future__ import absolute_import, division, print_function
from builtins import str
from copy import deepcopy
from panoptes_client.set_member_subject import SetMemberSubject
from panoptes_client.subject_workflow_status import SubjectWorkflowStatus
from panoptes_client.exportable import Exportable
from panoptes_c... | 21,737 | 38.667883 | 163 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/panoptes.py | from __future__ import absolute_import, division, print_function
from builtins import str
import getpass
import logging
import os
import requests
import threading
import pkg_resources
from datetime import datetime, timedelta
from redo import retrier
import six
from panoptes_client.utils import isiterable, batchable... | 33,577 | 27.552721 | 113 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/organization.py | from __future__ import absolute_import, division, print_function
from panoptes_client.panoptes import (
LinkResolver,
PanoptesObject,
)
from panoptes_client.project import Project
from panoptes_client.utils import batchable
class Organization(PanoptesObject):
_api_slug = 'organizations'
_link_slug = ... | 1,212 | 22.326923 | 76 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/subject_set.py | from __future__ import absolute_import, division, print_function
from builtins import str
from panoptes_client.subject_workflow_status import SubjectWorkflowStatus
from panoptes_client.panoptes import (
LinkCollection,
LinkResolver,
PanoptesAPIException,
PanoptesObject,
)
from panoptes_client.set_membe... | 4,116 | 28.833333 | 100 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_subject_set.py | from __future__ import absolute_import, division, print_function
import unittest
import sys
if sys.version_info <= (3, 0):
from mock import patch, Mock
else:
from unittest.mock import patch, Mock
from panoptes_client.subject_set import SubjectSet
class TestSubjectSet(unittest.TestCase):
def test_create... | 1,195 | 26.813953 | 64 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_bearer_expiry.py |
from panoptes_client.panoptes import Panoptes
import datetime
import unittest
import sys
if sys.version_info <= (3, 0):
from mock import patch
else:
from unittest.mock import patch
class MockDate(datetime.datetime):
_fake = None
@classmethod
def fake(cls, time):
cls._fake = time
... | 2,261 | 22.810526 | 71 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_workflow.py | import unittest
import sys
from panoptes_client.panoptes import PanoptesAPIException
from panoptes_client.workflow import Workflow
from panoptes_client.caesar import Caesar
if sys.version_info <= (3, 0):
from mock import patch
else:
from unittest.mock import patch
class TestWorkflow(unittest.TestCase):
... | 7,882 | 36.36019 | 117 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_linkcollection.py | from __future__ import absolute_import, division, print_function
from builtins import str
import unittest
import sys
if sys.version_info <= (3, 0):
from mock import Mock, patch
else:
from unittest.mock import Mock, patch
from panoptes_client.panoptes import LinkCollection, ObjectNotSavedException
LINKED_OB... | 7,899 | 31.113821 | 76 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/__init__.py | 0 | 0 | 0 | py | |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_set_member_subject.py | import unittest
from panoptes_client.set_member_subject import SetMemberSubject
class TestSetMemberSubject(unittest.TestCase):
def test_find_id(self):
sms = SetMemberSubject.find(1000)
self.assertEqual(sms.id, '1000')
| 241 | 23.2 | 63 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_inaturalist.py | from __future__ import absolute_import, division, print_function
import unittest
import sys
if sys.version_info <= (3, 0):
from mock import patch, Mock
else:
from unittest.mock import patch, Mock
from panoptes_client.inaturalist import Inaturalist
class TestInaturalist(unittest.TestCase):
def test_ina... | 1,249 | 28.069767 | 69 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_linkresolver.py | from __future__ import absolute_import, division, print_function
import unittest
import sys
if sys.version_info <= (3, 0):
from mock import Mock
else:
from unittest.mock import Mock
from panoptes_client.panoptes import LinkResolver
class TestLinkResolver(unittest.TestCase):
def test_set_new_link(self):... | 555 | 22.166667 | 74 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_project.py | from __future__ import absolute_import, division, print_function
import unittest
from panoptes_client import Project
from panoptes_client.panoptes import PanoptesAPIException
class TestProject(unittest.TestCase):
def test_find_id(self):
p = Project.find(1)
self.assertEqual(p.id, '1')
def te... | 677 | 26.12 | 64 | py |
panoptes-python-client | panoptes-python-client-master/panoptes_client/tests/test_http_retries.py | import unittest
import sys
if sys.version_info <= (3, 0):
from mock import patch, Mock
else:
from unittest.mock import patch, Mock
from panoptes_client.panoptes import (
HTTP_RETRY_LIMIT,
Panoptes,
PanoptesAPIException,
)
class TestRetries(unittest.TestCase):
def setUp(self):
self.ht... | 5,208 | 30.762195 | 67 | py |
panoptes-python-client | panoptes-python-client-master/docs/conf.py | # -*- coding: utf-8 -*-
#
# Panoptes Client documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 6 15:06:45 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated fil... | 10,041 | 28.107246 | 80 | py |
SLT-FAI | SLT-FAI-main/main.py | """
The system trains BERT (or any other transformer model like RoBERTa, DistilBERT etc.) on the SNLI + MultiNLI (AllNLI) dataset
with softmax loss function. At every 1000 training steps, the model is evaluated on the
STS benchmark dataset
Usage:
python training_nli.py --seed 1234
OR
python training_nli.py --seed 123... | 27,312 | 68.498728 | 1,079 | py |
SLT-FAI | SLT-FAI-main/testAtt.py | import torch
import pandas as pd
from transformers import BertModel, BertTokenizer
# model_path = "./output/unsup-consert-base-07260900/0_Transformer/" # baseline 32
# model_path = "./output/unsup-consert-base-07261600/0_Transformer/" # adversarial
model_path = "./output/unsup-consert-base-07271600/0_Transformer/" ... | 838 | 35.478261 | 83 | py |
SLT-FAI | SLT-FAI-main/testGRL.py | from torch.autograd import Function
from typing import Any, Optional, Tuple
import torch.nn as nn
import torch
import numpy as np
from tqdm import tqdm
import pandas as pd
import json
import torch.nn.functional as F
from torch.utils.data import DataLoader
from sklearn.manifold import TSNE
from sklearn.decomposition im... | 3,001 | 31.630435 | 102 | py |
SLT-FAI | SLT-FAI-main/eval_pretrain.py | import os
import json
import logging
import sys
from sentence_transformers import SentenceTransformer, InputExample, LoggingHandler
from sentence_transformers.evaluation import EmbeddingSimilarityEvaluator, SimilarityFunction
logging.basicConfig(format='%(asctime)s - %(filename)s - %(levelname)s - %(message)s',
... | 8,100 | 50.272152 | 178 | py |
SLT-FAI | SLT-FAI-main/correlation_visualization.py | import os
import torch
import matplotlib
import argparse
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from sentence_transformers import SentenceTransformer, util
from data_utils import load_datasets, load_chinese_tsv_data
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--mo... | 3,587 | 38.428571 | 117 | py |
SLT-FAI | SLT-FAI-main/testUA.py | import torch
import tqdm
import os
import time
import argparse
from torch.utils.data import DataLoader
from torch import nn, Tensor
from torch.nn.functional import normalize
from transformers import BertModel, BertTokenizer
from sentence_transformers import SentencesDataset, LoggingHandler, SentenceTransformer, util, I... | 5,313 | 47.309091 | 107 | py |
SLT-FAI | SLT-FAI-main/analysis_rep_space.py | import gzip
import csv
import argparse
import json
from sentence_transformers import models, losses
from sentence_transformers import SentencesDataset, LoggingHandler, SentenceTransformer, util, InputExample
from sentence_transformers.evaluation import EmbeddingSimilarityEvaluator, SimilarityFunction
from eval import ... | 6,737 | 48.544118 | 169 | py |
SLT-FAI | SLT-FAI-main/data_utils.py | import os
import json
import random
import logging
import argparse
import io
from sentence_transformers import InputExample, LoggingHandler
logging.basicConfig(format='%(asctime)s - %(filename)s - %(levelname)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
level=logging.INFO,
... | 11,144 | 43.939516 | 127 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.