text
stringlengths
1
93.6k
continue
if old_uuid in statink_uploads:
if not utils.custom_key_exists("force_uploads", CONFIG_DATA):
print("Skipping already-uploaded battle (use the `force_uploads` config key to override).")
continue
to_upload.append(result)
except KeyError: # salmon run job
if result["data"]["coopHistoryDetail"] is not None:
full_id = utils.b64d(result["data"]["coopHistoryDetail"]["id"])
old_uuid = str(uuid.uuid5(utils.SALMON_NAMESPACE, full_id[-52:]))
new_uuid = str(uuid.uuid5(utils.SALMON_NAMESPACE, full_id))
if new_uuid in statink_uploads:
print("Skipping already-uploaded job.")
continue
if old_uuid in statink_uploads:
if not utils.custom_key_exists("force_uploads", CONFIG_DATA):
print("Skipping already-uploaded job (use the `force_uploads` config key to override).")
continue
to_upload.append(result)
if len(to_upload) == 0:
print("Nothing to upload that isn't already on stat.ink.")
else:
post_result(to_upload, False, blackout, test_run, overview_data=overview_file) # one or multiple; monitoring mode = False
sys.exit(0)
# regular run
#############
which = "ink" if only_ink else "salmon" if only_salmon else "both"
# if which in ("salmon", "both"):
# update_salmon_profile() # not a thing for spl3, done on stat.ink's end
if check_old:
if which == "both":
prefetch_checks(printout=True)
skipprefetch = True
check_if_missing(which, blackout, test_run, skipprefetch) # monitoring mode hasn't begun yet
print()
if secs != -1: # monitoring mode
skipprefetch = True if skipprefetch or check_old else False
monitor_battles(which, secs, blackout, test_run, skipprefetch) # skip prefetch checks if already done in -r
elif not check_old: # regular mode (no -M) and did not just use -r
if which == "both":
print("Please specify whether you want to upload battle results (-nsr) or Salmon Run jobs (-osr). Exiting.")
sys.exit(0)
n = get_num_results(which)
print("Pulling data from online...")
# ! fetch from online
try:
results = fetch_json(which, numbers_only=True, printout=True, skipprefetch=skipprefetch)
except json.decoder.JSONDecodeError:
print("\nCould not fetch results JSON. Are your tokens invalid?")
sys.exit(1)
results = results[:n] # limit to n uploads
results.reverse() # sort from oldest to newest
noun = utils.set_noun(which)
for hash_ in results:
fetch_and_upload_single_result(hash_, noun, blackout, test_run) # not monitoring mode
thread_pool.shutdown(wait=True)
if __name__ == "__main__":
main()
# <FILESEP>
'''
Copyright (c) Facebook, Inc. and its affiliates.
All rights reserved.
This source code is licensed under the license found in the
LICENSE file in the root directory of this source tree.
'''
import torch
from torch.nn import functional as F
import os
import sys
import copy
import argparse
from tqdm import tqdm
import pickle
from pytorch_transformers import *
import numpy as np
import random
from wsd_models.util import *
parser = argparse.ArgumentParser(description='BERT Frozen Probing Model for WSD')
parser.add_argument('--rand_seed', type=int, default=42)