from labm8 import app from util.photolib.shutterbug import shutterbug FLAGS = app.FLAGS app.DEFINE_string( 'src_dir', None, 'The directory to create chunks from. All files in this directory are ' 'packed into chunks.') app.DEFINE_string( 'chunks_dir', None, 'The root directory of the chunks. Each chunk is a directory containing ' 'files and a manifest.') app.DEFINE_integer( 'size_mb', 4695, 'The smaximum size of each chunk in megabytes. This excludes the MANIFEST ' 'and README files which are generated.') app.DEFINE_string('chunk_prefix', 'chunk_', 'The name to prepend to generated chunks.') app.DEFINE_boolean( 'random_ordering', True, 'Whether to randomize the ordering of files across and within chunks. If ' '--norandom_ordering is used, the files are arranged in chunks in the order ' 'in which they are found in --src_dir. This is not recommended, as it means ' 'the loss of a chunk causes a loss in a contiguous block of files.') app.DEFINE_integer( 'random_ordering_seed', 0, 'The number used to seed the random number generator. Not used if ' '--norandom_ordering is set. Using the same seed produces the same ordering ' 'of files.') app.DEFINE_boolean(
from deeplearning.clgen import sample_observers as sample_observers_lib from deeplearning.clgen import samplers from deeplearning.clgen.models import models from deeplearning.clgen.models import pretrained from deeplearning.clgen.proto import clgen_pb2 from deeplearning.clgen.proto import model_pb2 from labm8 import app from labm8 import pbutil from labm8 import prof FLAGS = app.FLAGS app.DEFINE_string('config', '/clgen/config.pbtxt', 'Path to a clgen.Instance proto file.') app.DEFINE_integer( 'min_samples', 0, 'The minimum number of samples to make. If <= 0, sampling continues ' 'indefinitely and never terminates.') app.DEFINE_boolean('print_samples', True, 'If set, print the generated samples.') app.DEFINE_boolean('cache_samples', False, 'If set, cache the generated sample protobufs.') app.DEFINE_string('sample_text_dir', None, 'A directory to write plain text samples to.') app.DEFINE_string('stop_after', None, 'Stop CLgen early. Valid options are: "corpus", or "train".') app.DEFINE_string( 'print_cache_path', None, 'Print the directory of a cache and exit. Valid options are: "corpus", ' '"model", or "sampler".') app.DEFINE_string( 'export_model', None,
""" import collections import pathlib import re import subprocess import sys import typing from compilers.llvm import llvm from labm8 import app from labm8 import bazelutil from labm8 import system FLAGS = app.FLAGS app.DEFINE_integer('clang_timeout_seconds', 60, 'The maximum number of seconds to allow process to run.') _LLVM_REPO = 'llvm_linux' if system.is_linux() else 'llvm_mac' # Path to clang binary. CLANG = bazelutil.DataPath(f'{_LLVM_REPO}/bin/clang') # Valid optimization levels. OPTIMIZATION_LEVELS = {"-O0", "-O1", "-O2", "-O3", "-Ofast", "-Os", "-Oz"} # A structured representation of the output of clang's bisect debugging, e.g. # $ clang foo.c -mllvm -opt-bisect-limit=-1. # The output is of the form: # BISECT: running pass (<number>) <name> on <target_type> (<target>) # # See ClangBisectMessageToInvocation() for the conversion.
from compilers.llvm import opt_util <<<<<<< HEAD:deeplearning/ml4pl/graphs/labelled/dataflow/alias_set/alias_set.py from labm8.py import app from labm8.py import decorators ======= from labm8 import app from labm8 import decorators >>>>>>> d5cd0e23d... Reduce verbosity of alias_set.:deeplearning/ml4pl/graphs/labelled/alias_set/alias_set.py FLAGS = app.FLAGS app.DEFINE_integer( "alias_set_min_size", 2, "The minimum number of pointers in an alias set to be used as a labelled " "example.", ) @decorators.timeout(seconds=120) def AnnotateAliasSet( g: nx.MultiDiGraph, root_identifier: str, identifiers_in_set: typing.List[str], x_label: str = "x", y_label: str = "y", false=False, true=True, ) -> int: """
from deeplearning.clgen import samplers from deeplearning.clgen import telemetry from deeplearning.clgen.models import backends from deeplearning.clgen.models import data_generators from deeplearning.clgen.proto import model_pb2 from labm8 import app from labm8 import humanize FLAGS = app.FLAGS app.DEFINE_boolean( 'clgen_tf_backend_reset_inference_state_between_batches', False, 'If set, reset the network state between sample batches. Else, the model ' 'state is unaffected.') app.DEFINE_integer( 'clgen_tf_backend_tensorboard_summary_step_count', 10, 'The number of steps between writing tensorboard summaries.') class TensorFlowBackend(backends.BackendBase): """A model with an embedding layer, using a keras backend.""" def __init__(self, *args, **kwargs): """Instantiate a model. Args: args: Arguments to be passed to BackendBase.__init__(). kwargs: Arguments to be passed to BackendBase.__init__(). """ super(TensorFlowBackend, self).__init__(*args, **kwargs) # Attributes that will be lazily set.
'Path to a clgen.Instance proto file containing a full ' 'CLgen configuration.') app.DEFINE_string('clgen_working_dir', str(pathlib.Path('~/.cache/clgen').expanduser()), 'The directory for CLgen working files.') # Corpus options. app.DEFINE_string('clgen_corpus_dir', "/mnt/cc/data/datasets/github/corpuses/opencl", "Directory where the corpus is stored.") app.DEFINE_boolean('clgen_multichar_tokenizer', False, 'If true, use multichar OpenCL token.') # Model options. app.DEFINE_integer('clgen_layer_size', 512, 'Size of LSTM model layers.') app.DEFINE_integer('clgen_num_layers', 2, 'Number of layers in LSTM model.') app.DEFINE_integer('clgen_max_sample_length', 20000, 'The maximum length of CLgen samples. If 0, no limit.') # Training options. app.DEFINE_integer("clgen_num_epochs", 50, "The number of training epochs.") app.DEFINE_integer("clgen_training_sequence_length", 64, "CLgen training sequence length.") app.DEFINE_integer("clgen_training_batch_size", 64, "CLgen training batch size.") # Sampling options. app.DEFINE_string("clgen_seed_text", "kernel void ", "CLgen sample seed text.") app.DEFINE_float("clgen_sample_temperature", 1.0, "CLgen sampling temperature.") app.DEFINE_integer("clgen_sample_sequence_length", 1024,
import pathlib import pytest import re import tempfile import typing from importlib import util as importutil from labm8 import app FLAGS = app.FLAGS app.DEFINE_boolean('test_color', False, 'Colorize pytest output.') app.DEFINE_boolean('test_skip_slow', True, 'Skip tests that have been marked slow.') app.DEFINE_integer( 'test_maxfail', 1, 'The maximum number of tests that can fail before execution terminates. ' 'If --test_maxfail=0, all tests will execute.') app.DEFINE_boolean('test_capture_output', True, 'Capture stdout and stderr during test execution.') app.DEFINE_boolean( 'test_print_durations', True, 'Print the duration of the slowest tests at the end of execution. Use ' '--test_durations to set the number of tests to print the durations of.') app.DEFINE_integer( 'test_durations', 3, 'The number of slowest tests to print the durations of after execution. ' 'If --test_durations=0, the duration of all tests is printed.') app.DEFINE_string( 'test_coverage_data_dir', None, 'Run tests with statement coverage and write coverage.py data files to ' 'this directory. The directory is created. Existing files are untouched.')