repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/evals/__init__.py
# Copyright 2019 The Texar Authors. 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 ...
806
35.681818
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/evals/bleu_transformer_test.py
# -*- coding: utf-8 -*- # """ Unit tests for bleu_tool. """ import unittest import tempfile from texar.torch.evals.bleu_transformer import ( bleu_transformer_tokenize, file_bleu) class BLEUToolTest(unittest.TestCase): r"""Test bleu_tool. """ def _create_temp_file(self, text): temp_file = t...
2,610
33.813333
77
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/condition.py
# Copyright 2019 The Texar Authors. 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 ...
13,906
32.836983
98
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/executor_utils.py
# Copyright 2019 The Texar Authors. 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 ...
13,263
30.505938
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/condition_test.py
import unittest import torch import texar.torch as tx from texar.torch.run import condition as cond from texar.torch.run.executor_test import DummyClassifier, DummyData class ConditionTest(unittest.TestCase): def _create_dataset(self, n_examples: int): data = torch.randint(self.vocab_size, size=(n_examp...
2,171
32.415385
79
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/action.py
# Copyright 2019 The Texar Authors. 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 ...
2,533
30.283951
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/executor_test.py
import shutil import tempfile import unittest from pathlib import Path import os from typing import List, Dict, Tuple import torch from torch import nn from torch.nn import functional as F import texar.torch as tx from texar.torch.run import * class DummyClassifier(nn.Module): def __init__(self, vocab_size: int...
6,150
37.685535
79
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/executor.py
# Copyright 2019 The Texar Authors. 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 ...
82,899
41.339122
102
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/__init__.py
# Copyright 2019 The Texar Authors. 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 ...
903
29.133333
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/classification.py
# Copyright 2019 The Texar Authors. 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 ...
13,477
39.232836
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/summary_test.py
import unittest import numpy as np from texar.torch.run.metric.summary import * class RegressionMetricTest(unittest.TestCase): def setUp(self) -> None: self.n_examples = 100 self.batch_size = 2 self.values = np.random.randn(self.n_examples) def test_running_average(self): qu...
703
29.608696
77
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/regression.py
# Copyright 2019 The Texar Authors. 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 ...
4,003
36.074074
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/regression_test.py
import unittest import numpy as np from texar.torch.run.metric.regression import * from texar.torch.utils.test import external_library_test class RegressionMetricTest(unittest.TestCase): def setUp(self) -> None: self.n_examples = 100 self.batch_size = 2 self.labels = np.random.randn(self...
1,256
33.916667
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/generation.py
# Copyright 2019 The Texar Authors. 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 ...
6,239
37.518519
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/base_metric.py
# Copyright 2019 The Texar Authors. 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 ...
7,467
34.903846
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/__init__.py
# Copyright 2019 The Texar Authors. 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 ...
888
37.652174
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/generation_test.py
import unittest from texar.torch.run.metric.generation import * from texar.torch.evals.bleu import corpus_bleu class GenerationMetricTest(unittest.TestCase): def setUp(self) -> None: self.hypotheses = [ "this is a test sentence to evaluate the good bleu score . 词", "i believe that...
1,087
37.857143
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/classification_test.py
import functools import unittest import numpy as np from texar.torch.run.executor import make_deterministic from texar.torch.run.metric.classification import * from texar.torch.utils.test import external_library_test @external_library_test("sklearn") class ClassificationMetricTest(unittest.TestCase): def setUp(...
2,429
38.836066
78
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/run/metric/summary.py
# Copyright 2019 The Texar Authors. 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 ...
6,021
35.05988
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/average_recorder_test.py
""" Unit tests for average recoder. """ import unittest from texar.torch.utils.average_recorder import _SingleAverageRecorder, AverageRecorder class AverageRecorderTest(unittest.TestCase): r"""Tests average recoder. """ def test_single_average_recoder(self): r"""Tests :class:`~texar.torch.utils...
2,298
32.318841
86
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/rnn_test.py
# -*- coding: utf-8 -*- # """ Unit tests for rnn helpers. """ import unittest import torch from texar.torch.core.cell_wrappers import RNNCell, GRUCell, LSTMCell from texar.torch.utils.rnn import ( dynamic_rnn, reverse_sequence, bidirectional_dynamic_rnn) class ReverseSequenceTest(unittest.TestCase): r"""Te...
30,097
47.311396
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/nest.py
# Apply from Tensorflow: # https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/util/nest.py """This module can perform operations on nested structures. A nested structure is a Python sequence, tuple (including `namedtuple`), or dict that can contain further sequences, tuples, and dicts. """ import ...
9,158
36.231707
85
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/average_recorder.py
# Copyright 2019 The Texar Authors. 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 ...
11,951
35.439024
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/utils.py
# Copyright 2019 The Texar Authors. 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 ...
40,879
33.066667
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/shapes_test.py
""" Unit tests for shape-related utility functions. """ import unittest import numpy as np import torch from texar.torch.utils import shapes class ShapesTest(unittest.TestCase): r"""Tests shape-related utility functions. """ def test_mask_sequences(self): r"""Tests :func:`texar.torch.utils.sha...
2,006
31.901639
69
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/beam_search.py
# Adapted from the Tensor2Tensor's implementation. # # 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...
27,642
38.265625
130
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/shapes.py
# Copyright 2019 The Texar Authors. 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 ...
7,828
33.950893
79
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/transformer_attentions.py
# Copyright 2019 The Texar Authors. 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 ...
3,541
32.102804
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/__init__.py
# Copyright 2019 The Texar Authors. 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 ...
894
36.291667
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/rnn.py
# Copyright 2019 The Texar Authors. 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 ...
16,989
43.828496
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/beam_search_test.py
""" Unit tests for beam search. """ import unittest import torch import numpy as np from texar.torch.utils import beam_search class BeamSearchTest(unittest.TestCase): r"""Tests beam_search. """ def testShapes(self): batch_size = 2 beam_size = 3 vocab_size = 4 decode_len...
14,252
35.546154
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/utils_test.py
""" Unit tests for utility functions. """ import unittest import numpy as np import torch from texar.torch.utils import utils class UtilsTest(unittest.TestCase): r"""Tests utility functions. """ def test_sequence_mask(self): r"""Tests :meth:`texar.torch.utils.sequence_mask`. """ ...
7,165
33.451923
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/utils/dtypes.py
# Copyright 2019 The Texar Authors. 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 ...
5,380
29.230337
78
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/embedding.py
# Copyright 2018 The Texar Authors. 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 ...
8,432
34.885106
78
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/vocabulary.py
# -*- coding: utf-8 -*- # Copyright 2019 The Texar Authors. 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...
11,559
34.900621
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/vocabulary_test.py
""" Unit tests for vocabulary related operations. """ import tempfile import unittest from texar.torch.data import vocabulary class VocabularyTest(unittest.TestCase): """Tests vocabulary related operations. """ def test_make_defaultdict(self): """Tests the _make_defaultdict function. """...
1,468
26.716981
73
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/embedding_test.py
# -*- coding: utf-8 -*- # Copyright 2018 The Texar Authors. 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...
2,802
31.593023
76
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data_utils.py
# Copyright 2019 The Texar Authors. 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 ...
10,412
32.808442
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/__init__.py
# Copyright 2019 The Texar Authors. 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 ...
846
37.5
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/tokenizer_base.py
# Copyright 2019 The Texar Authors. 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 ...
21,246
38.128913
112
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/xlnet_tokenizer.py
# Copyright 2019 The Texar Authors. 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 ...
14,068
35.074359
112
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/roberta_tokenizer_test.py
""" Unit tests for pre-trained RoBERTa tokenizer. """ import unittest import json import os import pickle import tempfile from texar.torch.data.tokenizers.roberta_tokenizer import \ RoBERTaTokenizer from texar.torch.utils.test import pretrained_test class RoBERTaTokenizerTest(unittest.TestCase): def setUp...
7,448
35.514706
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/bert_tokenizer.py
# Copyright 2019 The Texar Authors. 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 ...
14,396
37.087302
111
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/sentencepiece_tokenizer.py
# Copyright 2019 The Texar Authors. 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 ...
11,107
35.539474
87
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/gpt2_tokenizer_test.py
""" Unit tests for pre-trained GPT2 tokenizer. """ import unittest import json import os import pickle import tempfile from texar.torch.data.tokenizers.gpt2_tokenizer import \ GPT2Tokenizer from texar.torch.utils.test import pretrained_test class GPT2TokenizerTest(unittest.TestCase): def setUp(self): ...
7,051
34.979592
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/xlnet_tokenizer_test.py
""" Unit tests for pre-trained XLNet tokenizer. """ import unittest import os import pickle import tempfile from texar.torch.data.data_utils import maybe_download from texar.torch.data.tokenizers.xlnet_tokenizer import \ XLNetTokenizer, SPIECE_UNDERLINE from texar.torch.utils.test import pretrained_test class ...
10,862
41.433594
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/bert_tokenizer_utils.py
# Copyright 2019 The Texar Authors. 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 ...
11,630
33.513353
111
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/bert_tokenizer_utils_test.py
""" Unit tests for pre-trained BERT tokenizer utils. """ import unittest from texar.torch.data.tokenizers.bert_tokenizer_utils import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace) class BERTTokenizerUtilsTest(unittest.TestCase): def test_chinese(self): tok...
2,716
28.215054
84
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/bert_tokenizer_test.py
""" Unit tests for pre-trained BERT tokenizer. """ import unittest import os import pickle import tempfile from texar.torch.data.tokenizers.bert_tokenizer import \ BERTTokenizer from texar.torch.utils.test import pretrained_test class BERTTokenizerTest(unittest.TestCase): def setUp(self): vocab_to...
6,700
34.834225
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/sentencepiece_tokenizer_test.py
""" Unit tests for SentencePiece tokenizer. """ import unittest import os import pickle import tempfile from texar.torch.data.data_utils import maybe_download from texar.torch.data.tokenizers.sentencepiece_tokenizer import \ SentencePieceTokenizer class SentencePieceTokenizerTest(unittest.TestCase): def s...
5,734
35.528662
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/roberta_tokenizer.py
# Copyright 2019 The Texar Authors. 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 ...
7,976
33.682609
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/__init__.py
# Copyright 2019 The Texar Authors. 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 ...
1,004
40.875
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/gpt2_tokenizer.py
# Copyright 2019 The Texar Authors. 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 ...
13,201
35.469613
111
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/tokenizers/gpt2_tokenizer_utils.py
# Copyright 2019 The Texar Authors. 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 ...
2,330
32.782609
111
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/multi_aligned_data.py
# Copyright 2019 The Texar Authors. 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 ...
23,256
40.754039
79
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/large_file_test.py
import contextlib import resource import time import unittest from typing import List, Optional, Tuple import gc import numpy as np import torch from texar.torch.data.data.data_base import DatasetBase, DataSource from texar.torch.data.data.data_iterators import DataIterator from texar.torch.data.data.dataset_utils im...
5,487
36.848276
78
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/scalar_data_test.py
# -*- coding: utf-8 -*- # """ Unit tests for data related operations. """ import torch import copy import tempfile import numpy as np import unittest from texar.torch.data import DataIterator, ScalarData from texar.torch.utils.dtypes import torch_bool class ScalarDataTest(unittest.TestCase): """Tests scalar da...
4,888
28.810976
72
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/scalar_data.py
# Copyright 2019 The Texar Authors. 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 ...
7,307
33.309859
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/dataset_utils.py
""" Various utilities for data module """ from enum import Enum from typing import ( Any, Dict, ItemsView, KeysView, List, Optional, Tuple, Union, ValuesView) import numpy as np __all__ = [ 'padded_batch', 'connect_name', 'Batch', '_LazyStrategy', '_CacheStrategy', ] def padded_batch(exampl...
3,675
27.71875
79
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/record_data_test.py
""" Unit tests for data related operations. """ import copy import os import shutil import tempfile import unittest import numpy as np import torch from texar.torch.data.data.record_data import RecordData from texar.torch.data.data.data_iterators import DataIterator from texar.torch.data.data_utils import maybe_down...
6,963
34.530612
75
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/mono_text_data.py
# Copyright 2019 The Texar Authors. 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 ...
17,341
36.782135
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/paired_text_data_test.py
# -*- coding: utf-8 -*- # """ Unit tests for data related operations. """ import tempfile import copy import numpy as np import unittest from texar.torch.data.data.data_iterators import DataIterator from texar.torch.data.data.paired_text_data import PairedTextData from texar.torch.data.vocabulary import SpecialTokens...
6,132
35.505952
79
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/data_iterators_test.py
""" Unit tests for data iterator related operations. """ import copy import tempfile import unittest from unittest.mock import patch from typing import List, Tuple, no_type_check import numpy as np import torch from texar.torch.data.data.data_base import ( DatasetBase, DataSource, IterDataSource, SequenceDataSour...
18,143
38.615721
84
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/data_base.py
# Copyright 2019 The Texar Authors. 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 ...
43,333
42.727548
120
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/paired_text_data.py
# Copyright 2019 The Texar Authors. 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 ...
20,701
39.198058
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/__init__.py
# Copyright 2019 The Texar Authors. 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 ...
1,104
39.925926
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/text_data_base.py
# Copyright 2019 The Texar Authors. 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 ...
6,359
35.551724
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/data_iterators.py
# Copyright 2019 The Texar Authors. 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 ...
39,354
40.209424
99
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/multi_aligned_data_test.py
# -*- coding: utf-8 -*- # """ Unit tests for data related operations. """ import copy import os import tempfile import unittest import numpy as np import torch from texar.torch.data.data.data_iterators import DataIterator from texar.torch.data.data.multi_aligned_data import MultiAlignedData from texar.torch.data.data...
9,082
34.342412
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/mono_text_data_test.py
""" Unit tests for data related operations. """ import copy import tempfile import unittest import numpy as np from texar.torch.data.data.data_iterators import DataIterator from texar.torch.data.data.mono_text_data import MonoTextData from texar.torch.data.vocabulary import SpecialTokens class MonoTextDataTest(unit...
11,099
34.691318
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/data/data/record_data.py
# Copyright 2019 The Texar Authors. 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 ...
28,474
37.584011
89
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/custom/initializers.py
""" Custom initializers used in various methods. """ import math import torch def variance_scaling_initializer(inputs: torch.Tensor, factor: float = 2.0, mode: str = 'FAN_IN', uniform: bool = False): r"""Returns an initializer that generates tens...
3,540
38.344444
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/custom/distributions.py
from torch.distributions import Normal, Independent def MultivariateNormalDiag(loc, scale_diag): if loc.dim() < 1: raise ValueError("loc must be at least one-dimensional.") return Independent(Normal(loc, scale_diag), 1)
238
28.875
65
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/custom/activation.py
""" Custom activation functions used in various methods. """ import math import torch from torch import nn class BertGELU(nn.Module): r"""Bert uses GELU as the activation function for the position-wise network. """ def forward(self, x): return x * 0.5 * (1.0 + torch.erf(x / math.sqrt(2.0))) c...
603
21.37037
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/custom/__init__.py
""" Custom modules in Texar """ from texar.torch.custom.activation import * from texar.torch.custom.initializers import * from texar.torch.custom.distributions import *
170
20.375
46
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/adv_losses.py
# Copyright 2019 The Texar Authors. 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 ...
3,704
36.806122
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/adv_losses_test.py
""" Unit tests for adv_losses. """ import unittest import torch from texar.torch.losses.adv_losses import binary_adversarial_losses class AdvLossesTest(unittest.TestCase): """Tests adversarial losses. """ def test_binary_adversarial_losses(self): """Tests :meth:`~texar.torch.losses.adv_losses....
1,210
30.868421
81
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/rewards.py
# Copyright 2019 The Texar Authors. 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 ...
5,564
34.44586
78
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/rewards_test.py
""" Unit tests for RL rewards. """ import unittest import numpy as np import torch from texar.torch.losses import rewards class RewardTest(unittest.TestCase): """Tests reward related functions. """ def test_discount_reward(self): """Tests :func:`texar.torch.losses.rewards.discount_reward` ...
4,285
34.421488
78
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/entropy_test.py
""" Unit tests for entropy. """ import unittest import torch from texar.torch.losses import entropy from texar.torch.utils.shapes import get_rank class EntropyTest(unittest.TestCase): """Tests entropy. """ def setUp(self): self._batch_size = 64 self._max_time = 128 self._d = 16...
3,498
36.623656
75
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/mle_losses_test.py
""" Unit tests for mle losses. """ import unittest import torch import torch.nn.functional as F from texar.torch.losses import mle_losses from texar.torch.utils.shapes import get_rank class MLELossesTest(unittest.TestCase): """Tests mle losses. """ def setUp(self): self._batch_size = 64 ...
3,844
35.619048
77
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/losses_utils.py
# Copyright 2019 The Texar Authors. 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 ...
10,032
42.812227
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/pg_losses.py
# Copyright 2019 The Texar Authors. 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 ...
12,253
46.496124
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/mle_losses.py
# Copyright 2019 The Texar Authors. 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 ...
19,923
43.873874
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/__init__.py
# Copyright 2019 The Texar Authors. 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 ...
897
36.416667
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/entropy.py
# Copyright 2019 The Texar Authors. 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 ...
8,787
40.258216
79
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/texar/torch/losses/pg_losses_test.py
""" Unit tests for pg losses. """ import unittest import torch from texar.torch.losses.pg_losses import pg_loss_with_logits from texar.torch.utils.shapes import get_rank class PGLossesTest(unittest.TestCase): """Tests pg losses """ def setUp(self): self._batch_size = 64 self._max_time ...
4,198
37.172727
80
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/main.py
from utils import setup_seed import torch import torch.nn as nn import texar.torch as tx from utils import read_vocab, Tokenizer, resume_training, set_tb_logger, save_checkpoint from env import load_features, TouchdownBatch from agent import TouchdownRConcat, TouchdownVLNTransformer, TouchdownGA from trainer import Tou...
8,329
53.802632
154
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/utils.py
import json, re, string import numpy as np import os, sys, torch import warnings from tensorboardX import SummaryWriter import networkx as nx import random import shutil base_vocab = ['<PAD>', '<START>', '<EOS>', '<UNK>'] padding_idx = 0 def setup_seed(seed): torch.manual_seed(seed) torch.cuda.manual_seed...
9,328
35.873518
117
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/agent.py
import random, torch from torch import nn import numpy as np from utils import padding_idx class BaseAgent: def __init__(self, env): self.env = env random.seed(1) def _get_tensor_and_length(self, encodings): """ :param encodings: a list of 1-d numpy arrays, K elements ...
11,297
48.552632
135
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/env.py
import numpy as np import glob, re, random from base_navigator import BaseNavigator from utils import load_datasets, print_progress, load_nav_graph, input_img, random_list import networkx as nx import torch import torch.nn.functional as F from pyxdameraulevenshtein import damerau_levenshtein_distance as edit_dis _SUC...
9,978
38.442688
132
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/trainer.py
import torch from utils import load_datasets, AverageMeter import time import math class TouchdownTrainer: def __init__(self, opts, agent, optimizer, bert_optimizer=None): self.opts = opts self.agent = agent self.optimizer = optimizer self.bert_optimizer = bert_optimizer se...
4,433
39.309091
114
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/models/RConcat.py
import torch from torch import nn from models.rnn import CustomRNN from utils import padding_idx class Conv_net(nn.Module): def __init__(self, opts): super(Conv_net, self).__init__() self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") self.opts = opts self.co...
3,528
39.102273
93
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/models/VLNTransformer.py
from typing import Optional, Union, Tuple import torch from torch import nn from torch.nn import functional as F from texar.torch.core import layers from texar.torch.modules.embedders.embedders import WordEmbedder from texar.torch.modules.embedders.position_embedders import PositionEmbedder from texar.torch.modules.e...
14,776
39.374317
88
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/models/GA.py
import torch from torch import nn class Conv(nn.Module): def __init__(self): super(Conv, self).__init__() self.conv = nn.Sequential(nn.Conv2d(1, 128, kernel_size=8, stride=4), nn.ReLU(), nn.Conv2d(128, 64, kernel_size=4, stride=2)...
1,560
33.688889
82
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/models/rnn.py
import torch from torch import nn class CustomRNN(nn.Module): """ A module that runs multiple steps of RNN cell With this module, you can use mask for variable-length input """ def __init__(self, cell_class, input_size, hidden_size, num_layers=1, use_bias=True, batch_first=False, ...
2,729
34.921053
74
py
Diagnose_VLN
Diagnose_VLN-master/touchdown/model/VLN-Transformer/touchdown/checkpoints/download_ckpt.py
""" Download RCONCAT and VLN Transformer checkpoints. """ import os import texar.torch as tx models = ['rconcat', 'vlntrans', 'ga'] experiments = ['vanilla', 'finetuned_manh50', 'finetuned_mask'] model_name = {'rconcat': 'RCONCAT', 'vlntrans': 'VLN Transformer', 'ga': 'GA'} def check_dir(model): if not os.path.i...
1,196
31.351351
100
py
Diagnose_VLN
Diagnose_VLN-master/r2r/model/PREVALENT_R2R/r2r_src/vilmodel.py
from __future__ import absolute_import, division, print_function, unicode_literals import json import logging import math import os import sys from io import open import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from modeling_utils import (WEIGHTS_NAME, CONFIG_NAME, PretrainedConfig,...
74,130
50.731333
187
py
Diagnose_VLN
Diagnose_VLN-master/r2r/model/PREVALENT_R2R/r2r_src/r2rmodel.py
import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from pytorch_pretrained_bert import BertModel, OpenAIGPTModel from vilmodel import BertImgModel,BertLayer,BertLayerNorm,BertPooler,BertAddModel...
171,546
44.868182
223
py
Diagnose_VLN
Diagnose_VLN-master/r2r/model/PREVALENT_R2R/r2r_src/modeling_utils.py
from __future__ import (absolute_import, division, print_function, unicode_literals) import copy import json import logging import os from io import open import six import torch from torch import nn from torch.nn import CrossEntropyLoss from torch.nn import functional as F #from .file_utils i...
48,476
53.714447
480
py