text
stringlengths
1
93.6k
# plot trajectories
plt.plot(sol.y[0], sol.y[1])
plt.plot(x_g[0], x_g[1], 'go')
circle = plt.Circle((x_o[0], x_o[1]), r_o, color='k', fill=False)
plt.gca().add_artist(circle)
plt.axis([-5, 5, -5, 5])
plt.gca().set_aspect('equal', 'box')
plt.show()
# --------------------------------------------
# <FILESEP>
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#Refrescador automatico de clines
#Creado por Dagger - https://github.com/gavazquez
import ReloadCam_Main, ReloadCam_Helper
def GetVersion():
return 2
#Filename must start with Server, classname and argument must be the same!
class Demed(ReloadCam_Main.Server):
def GetUrl(self):
#Pon un breakpoint aqui si quieres ver la URL verdadera ;)
#http://demed.no-ip.org/index.php
realUrl = ReloadCam_Helper.Decrypt('maanpH1wfNbK2dTFkp-hYJ2zb7zkzJvYz8iWqmGkq7E=')
return realUrl
def GetClines(self):
print "Now getting Demed clines!"
demedClines = []
demedClines.append(self.__GetDemedCline())
demedClines = filter(None, demedClines)
if len(demedClines) == 0: print "No Demed lines retrieved"
return demedClines
def __GetDemedCline(self):
values= {
'user': ReloadCam_Helper.GetRandomString(5),
'pass': 'demed',
'submit':'Active User!'
}
htmlCode = ReloadCam_Helper.GetPostHtmlCode(values, None, self.GetUrl())
cline = ReloadCam_Helper.FindStandardClineInText(htmlCode)
if cline != None and ReloadCam_Helper.TestCline(cline):
return cline
return None
# <FILESEP>
# coding=utf-8
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Pretrain T5"""
import torch
from megatron import get_args
from megatron import print_rank_0
from megatron import get_timers
from megatron import get_tokenizer
from megatron import mpu
from megatron.data.T5_dataset import build_train_valid_test_datasets
from megatron.model import T5ModelPipe, T5Model
from megatron.training import pretrain
from megatron.utils import get_masks_and_position_ids_for_t5
from megatron.utils import reduce_losses
from megatron.fp16 import fp32_to_fp16
def model_provider():
"""Build the model."""
args = get_args()
print_rank_0('building T5 model ...')
if args.pipe_parallel_size == 0 or args.pipe_parallel_size == 1:
model = T5Model(num_tokentypes=0, parallel_output=True)
else:
model = T5ModelPipe(num_tokentypes=0, parallel_output=True, topology=mpu.get_topology())
model._megatron_batch_fn = get_batch_pipe
model._input_grad = [True, False, True, False, False]
model._input_type = ['float', 'int', 'float', 'int', 'int']