old_contents: # Copyright (c) 2017-present, Facebook, Inc.
  # All rights reserved.
  # This source code is licensed under the BSD-style license found in the
  # LICENSE file in the root directory of this source tree. An additional grant
  # of patent rights can be found in the PATENTS file in the same directory.
  # Download and build the data if it does not exist.
  
  import parlai.core.build_data as build_data
  import os
  
  def build_fb_format():
      pass
  
  def build(opt):
      version = 'v1.0'
      dpath = os.path.join(opt['datapath'], 'ConvAI2')
  
      if not build_data.built(dpath, version):
          print('[building data: ' + dpath + ']')
          if build_data.built(dpath):
              # An older version exists, so remove these outdated files.
              build_data.remove_dir(dpath)
          build_data.make_dir(dpath)
  
          # Download the data.
          fname = 'convai2.tar.gz'
          url = 'https://s3.amazonaws.com/fair-data/parlai/convai2/' + fname
          build_data.download(url, dpath, fname)
          build_data.untar(dpath, fname)
  
          # Mark the data as built.
          build_data.mark_done(dpath, version)
  
new_contents: # Copyright (c) 2017-present, Facebook, Inc.
  # All rights reserved.
  # This source code is licensed under the BSD-style license found in the
  # LICENSE file in the root directory of this source tree. An additional grant
  # of patent rights can be found in the PATENTS file in the same directory.
  # Download and build the data if it does not exist.
  
  import parlai.core.build_data as build_data
  import os
  
  def build_fb_format():
      pass
  
  def build(opt):
      version = 'v2.0'
      dpath = os.path.join(opt['datapath'], 'ConvAI2')
  
      if not build_data.built(dpath, version):
          print('[building data: ' + dpath + ']')
          if build_data.built(dpath):
              # An older version exists, so remove these outdated files.
              build_data.remove_dir(dpath)
          build_data.make_dir(dpath)
  
          # Download the data.
          fname = 'convai2.tar.gz'
          url = 'https://s3.amazonaws.com/fair-data/parlai/convai2/' + fname
          build_data.download(url, dpath, fname)
          build_data.untar(dpath, fname)
  
          # Mark the data as built.
          build_data.mark_done(dpath, version)
  
subject: change convai2 build version