text stringlengths 0 93.6k |
|---|
# Create location to save manifest to |
manifest_location = os.path.join(manifests_directory, serial) |
# Write back manifest content to the new manifest |
try: |
plistlib.writePlist(manifest_content, manifest_location) |
except IOError: |
print "Unable to create %s manifest with display name of %s" % (serial, display_name) |
else: |
print "Creating %s manifest for %s" % (serial, display_name) |
#### Run Program ##### |
###################### |
# Make sure the manifests directory exists and is writable |
if os.path.isdir(manifests_directory) and os.access(manifests_directory, os.W_OK): |
if args.csv: |
# A CSV was supplied, use that for all data. |
with open(args.csv, mode='r') as infile: |
reader = csv.reader(infile) |
next(reader, None) # skip the header row |
for row in reader: |
serial = row[0] |
display_name = row[1] |
catalogs = [x.strip() for x in row[2].split(',')] |
manifests = [x.strip() for x in row[3].split(',')] |
# Each row contains 4 elements: Serial, Display Name, Catalogs, Manifests |
write_manifest(serial, display_name, catalogs, manifests) |
else: |
# Parse list of serials from cli args |
if args.serials: |
serials_array = args.serials.split(',') |
for pair in serials_array: |
pairs_array = pair.split(':') |
manifests_to_create[pairs_array[0].strip()] = pairs_array[1].strip() |
else: |
# Exit on an empty array of serials with an error message |
print >> sys.stderr, ("ERROR: No serials supplied, exiting") |
sys.exit(1) |
if args.catalogs: |
manifest_catalogs = [x.strip() for x in args.catalogs.split(',')] |
if args.manifests: |
manifests_to_include = [x.strip() for x in args.manifests.split(',')] |
# Loop through the manifests to create |
for serial,display_name in manifests_to_create.items(): |
write_manifest(serial, display_name, manifest_catalogs, manifests_to_include) |
else: |
print >> sys.stderr, ("ERROR: Manifest directory doesn't exist or isn't writeable") |
sys.exit(1) |
# <FILESEP> |
import os |
import argparse |
import json |
import re |
import jsonlines |
from fraction import Fraction |
from vllm import LLM, SamplingParams |
import sys |
from tqdm import trange |
import torch._dynamo; torch._dynamo.config.suppress_errors = True |
MAX_INT = sys.maxsize |
def is_number(s): |
try: |
float(s) |
return True |
except ValueError: |
pass |
try: |
import unicodedata |
unicodedata.numeric(s) |
return True |
except (TypeError, ValueError): |
pass |
return False |
def extract_answer_number(completion): |
text = completion.split('The answer is: ') |
if len(text) > 1: |
extract_ans = text[-1].strip() |
match = re.search(r'[\-+]?\d*[\.,/]?\d+', extract_ans) |
if match: |
if '/' in match.group(): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.