Comments (4)
Start on a colab notebook
https://colab.research.google.com/drive/1G2-EPTbQMQ_QWDh5Ht-p38jFBLc1SUyi
from lasertagger.
Looks like one needs to store the data on Google Cloud bucket in order to be able to use Google's TPU.
E.g., for the BERT data:*
INPUT_DIR = 'gs://{}/bert/{}'.format(BUCKET, BERT_MODEL)
tf.gfile.MakeDirs(INPUT_DIR)
for f in tf.gfile.Glob('/content/{}/*'.format(BERT_MODEL)):
tf.gfile.Copy(f, os.path.join(INPUT_DIR, f.split('/')[-1]))
%env BERT_BASE_DIR=$INPUT_DIR
And for the output data:
GS_OUTPUT_DIR = 'gs://{}/output'.format(BUCKET)
tf.gfile.MakeDirs(GS_OUTPUT_DIR)
for f in tf.gfile.Glob('/content/output/*'):
if tf.gfile.Stat(f).is_directory:
continue
tf.gfile.Copy(f, os.path.join(GS_OUTPUT_DIR, f.split('/')[-1]))
%env OUTPUT_DIR=$GS_OUTPUT_DIR
(*) Assuming the data was previously stored locally, e.g.,
bert_url = 'https://storage.googleapis.com/bert_models/2018_10_18/' + BERT_MODEL + '.zip'
bert_zip = BERT_MODEL + '.zip'
!wget $bert_url
!unzip $bert_zip
from lasertagger.
The notebook has been updated to support TPU, via writing all data to a cloud bucket.
Note: the prediction step - predict_main.py doesn't have flags for using a TPU. It's currently running very slowly, roughly 1 example per second. Is this expected?
I1107 15:31:14.475278 139814862706560 predict_main.py:89] 0 examples processed, 0 converted to tf.Example.
I1107 15:33:06.323075 139814862706560 predict_main.py:89] 100 examples processed, 100 converted to tf.Example.
from lasertagger.
Hi and sorry for the slow reply! Having a Colab would indeed be very useful but atm I don't have time to do that. However, if you'd like to create a pull request, I'd be very happy to review it.
Regarding slow inference: This is indeed an issue and the expected behavior when you run the code as such. Internally, we heavily parallelize inference so it's not an issue in that case. To make it faster, one should ideally increase the batch size (currently it's 1 [*]) which requires small code changes.
A quicker fix is to use LaserTaggerFF by setting use_t2t_decoder to false in configs/lasertagger_config.json. This should already make prediction about 40 times faster (at least on GPU). This may hurt the accuracy slightly but not radically at least in our experiments.
[*] https://github.com/google-research/lasertagger/blob/master/predict_utils.py#L57
from lasertagger.
Related Issues (19)
- Can tagging_converter support consecutive DELETE|add_phrases? HOT 5
- MSR Summarization Example HOT 3
- Output files (e.g. label map) not found HOT 3
- Update for TF 2
- why the prediction of Exact score is 0.00 HOT 2
- Problem with pkg-resources==0.0.0 when installing requirements.txt HOT 7
- Problem when training using GPU HOT 2
- Is the weights available? HOT 2
- CUBLAS_STATUS_EXECUTION_FAILED when running on GPU. HOT 4
- How do tag "keep" and "delete" accurately correspond to the input token ? HOT 1
- why it can not train?
- Config for BERT large HOT 1
- Why my model only predicts KEEP tags? HOT 1
- How to use GPU? HOT 4
- Fine-tuned models request HOT 9
- Permission denied error while replicating HOT 2
- How can I use this model on Chinese dataset? HOT 13
- Which version of tensorflow does the code run on HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lasertagger.