mirror of
https://github.com/wassname/Clover-Edition.git
synced 2026-08-28 12:42:41 +08:00
fixes
This commit is contained in:
+2
-1
@@ -66,7 +66,7 @@ def sample_sequence(
|
||||
context = torch.tensor(context, dtype=torch.long, device=device)
|
||||
context = context.unsqueeze(0).repeat(num_samples, 1)
|
||||
generated = context
|
||||
USE_PAST = False
|
||||
USE_PAST = True
|
||||
next_token = context
|
||||
outputs = None
|
||||
with torch.no_grad():
|
||||
@@ -194,6 +194,7 @@ class GPT2Generator:
|
||||
truncate_multiple_sequences(context_tokens, self.max_history_tokens)
|
||||
context_tokens = list(itertools.chain(*context_tokens))
|
||||
|
||||
if os.environ.get("DEBUG_GPT2", False):
|
||||
logger.debug("Text passing into model %s", self.tokenizer.decode(context_tokens, clean_up_tokenization_spaces=True, skip_special_tokens=True))
|
||||
|
||||
generated = 0
|
||||
|
||||
@@ -81,9 +81,9 @@ class Story:
|
||||
# When we have to much history we will take the last 10, and sample randomly from the rest
|
||||
# first take last mem_ind//2
|
||||
all_inds = list(range(len(self.results)))
|
||||
first = all_inds[:-mem_ind//2]
|
||||
last = all_inds[-mem_ind//2:]
|
||||
first = all_inds[:mem_ind//2]
|
||||
inds = sorted(last + random.sample(first, mem_ind//2))
|
||||
inds = sorted(random.sample(first, mem_ind//2)+last)
|
||||
else:
|
||||
inds = range(len(self.results))
|
||||
logger.debug("Using history indices %s", inds)
|
||||
|
||||
Reference in New Issue
Block a user