This file contains 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
Command to run: | |
NCCL_DEBUG=WARN CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 ./scripts/dist_run_single.sh 6 contrastive_pretrain/train_end2end.py ./cfgs/contrastive_pretrain/base_prec_random_movienet_images_4x16G_fp32.yaml ./checkpoints_debug2 | tee debug2.txt | |
Namespace(cfg='./cfgs/contrastive_pretrain/base_prec_random_movienet_images_4x16G_fp32.yaml', cudnn_off=False, dist=True, do_test=False, log_dir='./checkpoints_debug2/./output/vl-bert/contrastive_random_images/base_prec_random_movienet_images_4x16G_fp32/train_train/tensorboard_logs', model_dir='./checkpoints_debug2', slurm=False) | |
Namespace(cfg='./cfgs/contrastive_pretrain/base_prec_random_movienet_images_4x16G_fp32.yaml', cudnn_off=False, dist=True, do_test=False, log_dir='./checkpoints_debug2/./output/vl-bert/contrastive_random_images/base_prec_random_movienet_images_4x16G_fp32/train_train/tensorboard_logs', model_dir='./checkpoints_debug2', slurm=False) | |
Namespace(cfg='./cfgs/contrastive_pretrain/base_prec_random_movienet_images_4x16G_fp32.yaml', cudnn_off=Fa |
This file contains 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
import tqdm | |
from multiprocessing import Pool | |
def process_movie(movie): | |
print("Processing movie : ", movie) | |
path_movie_videos = os.path.join(path_all_movies, movie) | |
list_avi_files = os.listdir(path_movie_videos) | |
count=1 |
This file contains 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
def print_gc_tensors(): | |
dict_tensorsize_to_count = defaultdict(int) # Tensor size to number | |
dict_device_to_tensors = defaultdict(lambda: defaultdict(int)) # Device to tensor count | |
dict_device_memory = defaultdict(int) # Device to tensor memory | |
total_count = 0 | |
for obj in gc.get_objects(): | |
try: | |
if torch.is_tensor(obj) or (hasattr(obj, 'data') and torch.is_tensor(obj.data)): |
This file contains 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
class VLBertClassifier(VLBert): | |
def __init__(self, cfg, args, tok, num_layers, num_outputs, hidden_units=1024, dim_mlp=384): | |
super(VLBertClassifier, self).__init__(cfg, args, tok) | |
if num_layers == 2: | |
self.final_mlp = torch.nn.Sequential( | |
torch.nn.Dropout(0.1, inplace=False), | |
torch.nn.Linear(dim_mlp, hidden_units), | |
torch.nn.ReLU(inplace=True), |
This file contains 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
import time | |
from collections import defaultdict | |
import os | |
import gc | |
import torch | |
from tqdm import trange, tqdm | |
import masker | |
import tests | |
import utils |
This file contains 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
import numpy as np | |
def generateData(a, b, num_samples): | |
data_x = np.random.uniform(a, b, num_samples) | |
data_y = np.random.uniform(a, b, num_samples) | |
data = np.array(list(zip(data_x, data_y))) | |
labels = np.array([-1 if datap[0] <= datap[1] else 1 for datap in data]) | |
return data, labels |
This file contains 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
import cv2 | |
import numpy as np | |
import time | |
drawing = False # true if mouse is pressed | |
ix,iy = -1,-1 | |
# mouse callback function | |
def draw_circle(event,x,y,flags,param): | |
global ix,iy,drawing |
This file contains 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
import tensorflow as tf | |
def load_graph(frozen_graph_filename): | |
# We load the protobuf file from the disk and parse it to retrieve the | |
# unserialized graph_def | |
with tf.gfile.GFile(frozen_graph_filename, "rb") as f: | |
graph_def = tf.GraphDef() | |
graph_def.ParseFromString(f.read()) | |
# Then, we import the graph_def into a new Graph and returns it |
This file contains 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 rospy | |
import sys | |
from std_msgs.msg import String, Header | |
from sensor_msgs.msg import CameraInfo | |
from sensor_msgs.msg import Image | |
class publishTF(object): |
This file contains 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 rospy | |
from std_msgs.msg import String | |
from sensor_msgs.msg import NavSatFix | |
class publishGPS(object): | |
def __init__(self): | |
rospy.loginfo("Initialising GPS publishing") |