readme: ---
  language: en
  datasets:
  - cornell_movie_dialog
  license: gpl-3.0
  tags:
    - NLP
    - ChatBot
    - Game AI
  metrics:
    - rouge
  widget:
  - text: "personality: Hinata was soft-spoken and polite, always addressing people with proper honorifics. She is kind, always thinking of others more than for herself, caring for their feelings and well-being. She doesn't like being confrontational for any reason. This led to her being meek or timid to others, as her overwhelming kindness can render her unable to respond or act for fear of offending somebody.</s> inquiry: What's your name?"
    example_title: "Talk to Hinata"
  - text: "personality: Voldemort is a raging psychopath, devoid of the normal human responses to other people's suffering. He has no conscience, feels no remorse or empathy, and does not recognize the worth and humanity of anybody except himself.</s> inquiry: What's your name?"
    example_title: "Talk to Voldemort"
  inference:
    parameters:
      num_beams: 6
      diversity_penalty: 2.5
      num_beam_groups: 2
  ---
  # FreeIsland AI
  
  With the advancement of the graphical processing power of computers and sophisticated algorithms like [Nanite](https://docs.unrealengine.com/5.0/en-US/RenderingFeatures/Nanite/), simulating lifelike sceneries in real-time is never being easier. About a month ago Epic Games [showoff](https://www.youtube.com/watch?v=WU0gvPcc3jQ) the newest capabilities of their newest game engine by simulating an entire city including population, traffic, weather, etc running on a Playstore 5. That made me think what are the things missing from that simulation and how can I use my skills to improve it.
  
  One of the main missing components that separate our world and the simulated world is people. More importantly, the interactivity of people in simulated worlds. Last year a game called cyberpunk got released and it had an option to [talk to any person](https://www.youtube.com/watch?v=Z1OtYGzUoSo) in its city but the problem with that was all the responses from the Non-player Characters (NPCs) are hardcoded which greatly reduce the immersion of the game.
  
  So the goal of this project is to experiment with how the advancement of Natural Language Processing makes NPCs from video games interactive and enhances immersion in video games.
  
  # Usage
  ```py
  from transformers import AutoModelForSeq2SeqLM
  
  trained_model = AutoModelForSeq2SeqLM.from_pretrained(f"Supiri/t5-base-conversation")
  
  prompt = "What's your name?"
  
  context = "Hinata was soft-spoken and polite, always addressing people with proper honorifics. She is kind, always thinking of others more than for herself, caring for their feelings and well-being. She doesn't like being confrontational for any reason. This led to her being meek or timid to others, as her overwhelming kindness can render her unable to respond or act for fear of offending somebody."
  
  input_ids = tokenizer(f"personality: {context}", f"inquiry: {prompt}", return_tensors='pt').input_ids
  outputs = trained_model.generate(input_ids, num_beams=6, diversity_penalty=2.5, num_beam_groups=2)
  
  print("Answer:\t", tokenizer.decode(outputs[0], skip_special_tokens=True))
  
  # Answer: My name is Hinata 
  ```
  
  # Evaluation
  
  ## Test 1
  For this test, I sampled input from the test dataset. For this question the actual response is  
  
  > "It works a little."
  
  But models' response was
  
  > "I don't want to flirt with you."
  
  Which reflect its bio which was filled by GPT-3
  
  > "He stands primarily to gain self-esteem, which he often receives through the submission of others"
  
  
  In gist, Dr. Greenbaum tried to tease Sebastian about his seductive traits but this model's go-to response was to shut her down since the biography of Sebastian states he often tries to assert his dominance over others.
  
  ```py
  prompt = dataset['test'][66]['request']
  contexts = dataset['test'][66]['bio']
  
  input_ids = tokenizer(f"personality: {contexts}", f"inquiry: {prompt}", return_tensors='pt').input_ids
  outputs = trained_model.generate(input_ids, num_beams=6, diversity_penalty=5.0, num_beam_groups=2)
  
  print("Input to the Model")
  print("Bio:\t",contexts)
  print("\nPrompt:\t", prompt)
  
  print("\nGround truth response")
  print("\t", dataset['test'][66]['response'])
  
  print("\nModel's Prediction")
  print("Answer:\t", tokenizer.decode(outputs[0], skip_special_tokens=True))
  
  ```
  
  ```txt
  Input to the Model
  Bio:	 Sebastian is a very extreme representation of the trope of the "Confidence Man", and acts it out to a degree that is sometimes comedic but mostly frightening. He stands primarily to gain self-esteem, which he often receives through the submission of others or solely through his own perceptions. An artful seducer, his incredible charisma is both his greatest weapon and most intoxicating weakness.
  
  Prompt:	 You think you can come in here with that cute little smirk on your face and try and flirt with me. It doesn't work, Sebastian.
  
  Ground truth response
  	 It works a little.
  
  Model's Prediction
  Answer:	 I don't want to flirt with you.
  ```
  
  
  ### Test 2
  