Skip to content

Commit

Permalink
finally a good one
Browse files Browse the repository at this point in the history
  • Loading branch information
gorkemgoknar committed Dec 19, 2020
1 parent b6ec286 commit d486d9c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Binary file modified __pycache__/utils.cpython-36.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion data/make_persona_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def preprocess_line(text):

##remove empty start end
##it is possible text may become empty!
text = test.strip()
text = text.strip()

return text

Expand Down
17 changes: 17 additions & 0 deletions interact.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,24 @@ def run():
logger.info("Sample a personality")
dataset = get_dataset(tokenizer, args.dataset_path, args.dataset_cache)
personalities = [dialog["personality"] for dataset in dataset.values() for dialog in dataset]


logger.info("Tokenize and encode the dataset")
def tokenize(obj):
if isinstance(obj, str):
return tokenizer.convert_tokens_to_ids(tokenizer.tokenize(obj))
if isinstance(obj, dict):
return dict((n, tokenize(o)) for n, o in obj.items())
return list(tokenize(o) for o in obj)


personality = random.choice(personalities)

##TALK TO HAL
personality_hal = ["that's true. my name is hal"]
personality = tokenize(personality_hal)
print(personality)

logger.info("Selected personality: %s", tokenizer.decode(chain(*personality)))

history = []
Expand Down

0 comments on commit d486d9c

Please sign in to comment.