This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
import sys | |
import argparse | |
import ftfy | |
import re | |
import random | |
import tqdm | |
import os | |
from multiprocessing import Pool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2020-10-14 00:19:19.237771: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudart.so.10.1 | |
Parse Error: unrecognized arguments: foo | |
usage: parlai interactive [-h] [--helpall] [-o INIT_OPT] [-t TASK] | |
[-dt DATATYPE] [-bs BATCHSIZE] | |
[-dynb {None,full,batchsort}] [-dp DATAPATH] | |
[-m MODEL] [-mf MODEL_FILE] [-im INIT_MODEL] | |
[-d DISPLAY_EXAMPLES] | |
[--display-prettify DISPLAY_PRETTIFY] | |
[--display-ignore-fields DISPLAY_IGNORE_FIELDS] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Copyright Facebook 2018-2020 | |
; Licensed under MIT. | |
(def noun "[{tag:/N.+/}]") | |
(def simple-noun-phrase (format "%s+" noun noun)) | |
(def noun-phrase (format "(%s /of|--|'s/ )?%s" simple-noun-phrase simple-noun-phrase)) | |
(def premodifier "(([{tag:/RB.?/}] )*([{tag:JJ}] | [{tag:JJR}] | [{tag:JJS}] | [{tag:VBN}]))?") | |
(def premodifier-adjonly "(([{tag:/RB.?/}] )*([{tag:JJ}] | [{tag:JJR}] | [{tag:JJS}]))?") | |
(def head-phrase-adjonly (format "/\"/?(?$prehead %s) (?$head %s)/\"/?" premodifier-adjonly noun-phrase)) | |
(def head-phrase (format "/\"/?(?$prehead %s) (?$head %s)/\"/?" premodifier noun-phrase)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Example of dynamic/adaptive batching. | |
Author: Stephen Roller (twitter/github @stephenroller) | |
Public domain licensed. do whatever you want with this. | |
Example usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Example of dynamic/adaptive batching. | |
Author: Stephen Roller (twitter/github @stephenroller) | |
Public domain licensed. do whatever you want with this. | |
Example usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# should work after `pip install parlai` | |
from parlai.core.agents import create_agent | |
agent = create_agent( | |
{ | |
'model_file': 'zoo:blender/blender_3B/model', # maps to the parlai downloads url | |
'datapath': '/tmp/blender', # where we save the downloaded model files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# No checkpoint 0 | |
# No checkpoint 1 | |
# No checkpoint 2 | |
# No checkpoint 3 | |
# None grads with NO grad checkpoint: 0 | |
# | |
# Checkpointing 0 | |
# Checkpointing 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
data = sys.stdin.read() | |
lines = data.split('\n') | |
columnized = [ | |
x.replace(r'\\[-0.25mm]', '').replace(r'\\', '').split('&') for x in lines | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Example of a generic Mixout implementation. (Lee et al., 2019). | |
https://arxiv.org/abs/1909.11299 | |
Implementation by Stephen Roller (https://stephenroller.com). | |
Updated 2020-02-10 to include 1/(1 - p) correction term. Thanks to | |
Cheolhyoung Lee for making this correction. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Results of running. Seems indifferent to --dim and --eps. | |
$ python flntest.py --batchsize 65535 | |
Worse case difference: 2.86102294921875e-06 | |
Average case difference: 3.698113104633194e-08 | |
$ python flntest.py --batchsize 65536 |
NewerOlder