To run inductive bias experiments, see below. Note that many scripts assume that MLFLOW_TRAKCING_URI exists, and points to a valid mlflow server.
Use jupyter/mll/sample_grammars.ipynb
For metrics except tre:
python mll/sample_grammar_rhos.py --out-csv cmet005.csv --meanings 5x10 --metrics posdis,bosdis,compent,topsim
For TRE:
python mll/sample_grammar_tres.py --out-csv ibg011.csv
The code for the web-site is in mll/turk/turk-web. You need to have npm installed. Then from this folder, run:
npm install
npm run build
- The
buildsubdirectory will then contain the built website - The website will be served from your webservice, see below
To run the webservice, you need to first build the web site (above), then, with python 3.7+ installed, first install the requirements`
pip install -r mll/turk/webservice/requirements.txt
Then, to run the webservice:
aihttp-devtools runserver mll/turk/webservice/service.py -p 5000
- this will run on port 5000 by default
- this will also serve the website, from the
mll/turk/web-site/buildfolder, as the sub-folder/web/
You will need to place an https/ssl reverse proxy in front of the webservice. Nginx was used for this, and an example configuration file is pasted into the head of service.py file.
You will need to configure a dns name to point to your web-hosting, in order to obtain an https/ssl certificate. We used LetsEncrypt to create our certificate.
From an Amazon Mechanical Turk 'Requester' account, create a 'survey' task, and edit the url to point to your published webservice
- you need to add the querystring parameter
?taskId=[task type]to the url, where[task_type]is the name of one of the files frommll/turk/webservice/configsfolder, without the.yamlextension - you need to provide the url of the published
index.htmlfrom thebuildsubdirectory, which the webservice publishes as thewebsub-folder - the url will likely look something like
https://mydomain.com/web/index.html?taskId=eng_pnts_rot- (where you will replace
mydomain.comwith the actual dns name that you are publishing the webservice under)
- (where you will replace
synth dataset:
- pnts_comp
- pnts_perm
- pnts_proj
- pnts_rot
- pnts_shufdet
eng dataset:
- eng_pnts_comp
- eng_pnts_perm
- eng_pnts_proj
- eng_pnts_rot
- eng_pnts_shufdet
service.pywill create an SQLite database atdata/turk.db
- you can use the script
mll/turk/tools/review_hits.pyto review hits, and accept/reject them- by default, the script rejects all HITs which score 0, and accepts automatically all HITs with a score of 100 or more
- other hits are presented to you, for review. you can hit
ato accept,nto reject,sto skip
- you can use the script
mll/turk/tools/reduce_results.pyto retrieve the results, from the database, and write into latex formatted tables.
for seed in {123..127}; do { python mll/mem_runner2.py --ref foo${seed} --dir send --tgt-acc 0.8 -m 5x10 --count-steps --seed ${seed}; } done
You can synthesize the resulting logs using:
python mll/analyse/reduce_csvs.py --in-refs foo123-foo127 \
--out-ref foo \
--row-key arch \
--include-fields arch,params,Permute_ratio,RandomProj_ratio,Cumrot_ratio,ShuffleWordsDet_ratio,Holistic_ratio
--numeric-fields Permute_ratio,RandomProj_ratio,Cumrot_ratio,ShuffleWordsDet_ratio,Holistic_ratio \
--include-keys FC1L,FC2L,RNNAutoReg:LSTM,RNNAutoReg2L:LSTM,TransDecSoft,TransDecSoft2L,Hashtable
for seed in {123..127}; do { python mll/mem_runner2.py --ref foo${seed} --dir recv --tgt-acc 0.8 -m 5x10 --count-steps --seed ${seed}; } done
You can again use mll/analyse/reduce_csvs.py to reduce the resulting logs files.
for seed in {123..132}; do { python mll/mem_runner2.py --ref foo${seed} --dir send --tgt-acc 0.8 -m 5x10 --count-steps --send-arch RNNAutoReg:LSTM,FC2L --embedding-size 1280 --render-every-steps 1 --seed ${seed}; } done
Then reduce the results using reduce_csvs.py, as above
for seed in {123..132}; do { ulfs_submit.py --ref foo${seed} -- mll/mem_runner2.py --dir send --max-mins 60 --seed ${seed}; } done
Reduce the results using
python mll/analyse/reduce_csvs.py --in-refs foo123-foo132 --out-ref foo --row-key arch --include-fields arch,params,Permute,RandomProj,Cumrot,ShuffleWordsDet,Holistic --numeric-fields Permute,RandomProj,Cumrot,ShuffleWordsDet,Holistic --include-keys FC1L,FC2L,RNNAutoReg:LSTM,RNNAutoReg2L:LSTM,TransDecSoft,TransDecSoft2L,Hashtable
for seed in {123..132}; do { python mll/mem_runner2.py --ref foo${seed} --dir send --tgt-acc 0.8 --send-arch RNNAutoReg:LSTM,RNNZero:LSTM,HierAutoReg:RNN,HierZero:RNN,RNNAutoReg:dgsend,RNNZero:dgsend,HierAutoReg:dgsend,HierZero:dgsend --count-steps --seed ${seed}; } done
Then reduce the results using:
python mll/analyse/reduce_csvs.py --in-refs foo123-foo132 --out-ref foo --row-key arch --include-fields arch,params,Permute_ratio,RandomProj_ratio,Cumrot_ratio,ShuffleWordsDet_ratio,Holistic_ratio --numeric-fields Permute_ratio,RandomProj_ratio,Cumrot_ratio,ShuffleWordsDet_ratio,Holistic_ratio
for seed in {123..132}; do { python mll/mem_runner_e2e.py --ref foo${seed} --link RL --train-acc 0.99 --send-ent-reg 0.01 --recv-ent-reg 0.01 --opt Adam --softmax-sup --seed ${seed} --arch-pairs FC2L+RNN:LSTM,RNNAutoReg:LSTM+RNN:LSTM,TransDecSoft+RNN:LSTM,HierZero:dgsend+RNN:LSTM; } done
Then, to output csv of results:
python mll/analyse/graph_example_training_curves_2.py --in-ref foo123-foo132 --out-csv /tmp/foo.csv
Or to plot a png:
python mll/analyse/graph_example_training_curves_2.py --in-ref foo123-foo132 --out-png /tmp/out.png