xlnet icon indicating copy to clipboard operation
xlnet copied to clipboard

Hope to have a colab version of run-classifier

Open SchenbergZY opened this issue 5 years ago • 14 comments

Actually i can't figure out what is the {TPU_NAME} when using colab tpu. Looking forward to a colab version of the code.

SchenbergZY avatar Jun 20 '19 11:06 SchenbergZY

Also could it be uploaded on tensorflow hub please ?

AxeldeRomblay avatar Jun 20 '19 15:06 AxeldeRomblay

If you are using TPU in Colab, then there will no TPU_NAME. However, you can do the following things to make it work. replace: https://github.com/zihangdai/xlnet/blob/master/run_classifier.py#L695 run_config = model_utils.configure_tpu(FLAGS) to

  tpu_cluster_resolver = tf.contrib.cluster_resolver.TPUClusterResolver(TPU_ADDRESS)
  is_per_host = tf.contrib.tpu.InputPipelineConfig.PER_HOST_V2
  run_config = tf.contrib.tpu.RunConfig(
      cluster=tpu_cluster_resolver,
      model_dir=OUTPUT_DIR,
      save_checkpoints_steps=2000,
      keep_checkpoint_max=2,
      tpu_config=tf.contrib.tpu.TPUConfig(
          iterations_per_loop=1000,
          num_shards=8,
          per_host_input_for_training=is_per_host))

If you are familiar with Colab, then you will know what is TPU_ADDRESS in the code above.

ymcui avatar Jun 21 '19 03:06 ymcui

@ymcui Thank you for your help. But Actually the same problem occurs:

tensorflow.python.framework.errors_impl.InvalidArgumentError: From /job:worker/replica:0/task:0: Unsuccessful TensorSliceReader constructor: Failed to get matching files on xlnet_cased_L-24_H-1024_A-16/xlnet_model.ckpt: Unimplemented: File system scheme '[local]' not implemented (file: 'xlnet_cased_L-24_H-1024_A-16/xlnet_model.ckpt') [[node checkpoint_initializer_224 (defined at /content/model_utils.py:76) ]]

SchenbergZY avatar Jun 21 '19 15:06 SchenbergZY

It seems that you should load checkpoint file from GCS (Google Cloud Storage) instead of loading from local file system (i.e. uploading directly in Colab). But spiece.model file should load from local file system. Also see: https://github.com/zihangdai/xlnet/issues/13

ymcui avatar Jun 21 '19 23:06 ymcui

Do you have a colab ready notebook for XLNet now @ymcui . Please share it, I'm working on integrating colab with XLNet too.

aditya-malte avatar Jun 22 '19 07:06 aditya-malte

can I run it over Colab using GPU?

hana9090 avatar Jun 23 '19 16:06 hana9090

I now have a notebook that's perfectly running with BERT TPUs, will share it shortly

aditya-malte avatar Jun 23 '19 18:06 aditya-malte

Thank you :) that's would be great. I appreciate that! @aditya-malte do I need a business account on google cloud to use TPU?

hana9090 avatar Jun 23 '19 20:06 hana9090

@aditya-malte I'm currently working on integrating run-classifier with colab (GPU first then TPU). Anything you could share would be appricated!

CharlieBickerton avatar Jun 24 '19 09:06 CharlieBickerton

#44 Here's a link to a working classifier (imdb) colab (code)

CharlieBickerton avatar Jun 24 '19 16:06 CharlieBickerton

With Colab TPU Tested

Hello @hana9090 , @CharlieBickerton , @SchenbergZY , I have made available a colab Notebook with modified repo at the following link: https://github.com/aditya-malte/Colab-XLNet-FineTuning

Please star and share.

aditya-malte avatar Jun 24 '19 17:06 aditya-malte

sure will star after my successful trial

SchenbergZY avatar Jul 15 '19 12:07 SchenbergZY

Please do :)

aditya-malte avatar Jul 15 '19 19:07 aditya-malte

Hi all,
I also have BERT versions running on Colab. Currently also trying to use xlnet on there as well...will post once it's running.

h21k avatar Sep 17 '19 13:09 h21k