def sample(self, model: clgen.Model) -> None: """ Sample CLgen model. Parameters ---------- model : clgen.Model CLgen model. """ cache = self.cache(model) # create samples database if it doesn't exist if not cache.get("kernels.db"): tmp_kernels_db = cache.keypath("kernels.tmp.db") dbutil.create_db(tmp_kernels_db) cache["kernels.db"] = tmp_kernels_db # producer-consumer queue queue = Queue(maxsize=128) log.info("sampling", self) sampler = SampleProducer(model, self.start_text, queue, **self.kernel_opts) sampler.start() consumer = SampleConsumer(cache["kernels.db"], sampler, self, cache, queue, **self.sampler_opts) consumer.start() sampler.join() consumer.join() clgen.explore(cache["kernels.db"])
def test_explore(): c = clgen.Corpus.from_json({ "language": "opencl", "path": tests.data_path("tiny", "corpus", exists=False) }) clgen.explore(c.contentcache["kernels.db"])
def _main(db_file: BinaryIO): clgen.explore(db_file.name)
def test_explore_gh(): db_path = tests.archive("tiny-gh.db") assert (fs.exists(db_path)) clgen.explore(db_path)