text stringlengths 1 93.6k |
|---|
self.chk_inst()
|
elif "darwin" in sys.platform:
|
print("Sorry, MyServer is not available for mac right now !!")
|
sys.exit()
|
elif "win" in sys.platform:
|
print("Sorry, MyServer is not available for windows right now !!")
|
sys.exit()
|
else:
|
print("MyServer is not available for \'%s\' right now !!!" %sys.platform)
|
sys.exit()
|
def chk_inst(self):
|
if os.path.exists(bpath+"myserver") and os.path.exists(spath+"MyServer"):
|
menu()
|
else:
|
self.inst()
|
def inst(self):
|
if system=="ubuntu":
|
noti()
|
opt=raw_input("\033[01;33m Do you want to install MyServer [\033[01;32mY/n\033[01;33m] >> \033[00m")
|
if opt=="Y" or opt=="y":
|
os.system("sh install")
|
elif opt=="N" or opt=="n":
|
sys.exit()
|
else:
|
print("\n \033[01;31m\007Command not found :\033[01;32m \'"+opt+"\'")
|
sleep(1)
|
self.inst()
|
else:
|
noti()
|
opt=raw_input("\033[01;33m Do you want to install MyServer [\033[01;32mY/n\033[01;33m] >> \033[00m")
|
if opt=="Y" or opt=="y":
|
os.system("sh install")
|
elif opt=="N" or opt=="n":
|
sys.exit()
|
else:
|
print("\n \033[01;31m\007Command not found :\033[01;32m \'"+opt+"\'")
|
sleep(1)
|
self.inst()
|
def MyServer():
|
try:
|
inst().chk_sys()
|
except KeyboardInterrupt:
|
exit()
|
MyServer()
|
# <FILESEP>
|
# Copyright (c) 2015-present, Facebook, Inc.
|
# All rights reserved.
|
"""
|
Misc functions, including distributed helpers.
|
Mostly copy-paste from torchvision references.
|
"""
|
import io
|
import os
|
import time
|
from collections import defaultdict, deque
|
import datetime
|
import logging
|
import torch
|
import torch.distributed as dist
|
class SmoothedValue(object):
|
"""Track a series of values and provide access to smoothed values over a
|
window or the global series average.
|
"""
|
def __init__(self, window_size=20, fmt=None):
|
if fmt is None:
|
fmt = "{median:.4f} ({global_avg:.4f})"
|
self.deque = deque(maxlen=window_size)
|
self.total = 0.0
|
self.count = 0
|
self.fmt = fmt
|
def update(self, value, n=1):
|
self.deque.append(value)
|
self.count += n
|
self.total += value * n
|
def synchronize_between_processes(self):
|
"""
|
Warning: does not synchronize the deque!
|
"""
|
if not is_dist_avail_and_initialized():
|
return
|
t = torch.tensor([self.count, self.total], dtype=torch.float64, device='cuda')
|
dist.barrier()
|
dist.all_reduce(t)
|
t = t.tolist()
|
self.count = int(t[0])
|
self.total = t[1]
|
@property
|
def median(self):
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.