diff --git a/CUDA-Optimized/FastSpeech/fastspeech/model/fastspeech.py b/CUDA-Optimized/FastSpeech/fastspeech/model/fastspeech.py index 72c40dc6a..c2b0dca41 100644 --- a/CUDA-Optimized/FastSpeech/fastspeech/model/fastspeech.py +++ b/CUDA-Optimized/FastSpeech/fastspeech/model/fastspeech.py @@ -1,195 +1,195 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the NVIDIA CORPORATION nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -from collections import OrderedDict - -import numpy as np -import torch -from torch import nn as nn - -from fastspeech.model.module import FFTBlocks, LengthRegulator -from fastspeech.utils.pytorch import to_device_async -from fastspeech.utils.nvtx import Nvtx -from torch.nn import functional as F -from fastspeech.utils.logging import tprint -from fastspeech.text_norm.symbols import symbols - -class Fastspeech(nn.Module): - """ FastSpeech """ - - def __init__(self, - max_seq_len, - d_model, - phoneme_side_n_layer, - phoneme_side_head, - phoneme_side_conv1d_filter_size, - phoneme_side_output_size, - mel_side_n_layer, - mel_side_head, - mel_side_conv1d_filter_size, - mel_side_output_size, - fft_conv1d_kernel, - fft_conv1d_padding, - duration_predictor_filter_size, - duration_predictor_kernel_size, - dropout, - n_mels, - fused_layernorm=False): - super(Fastspeech, self).__init__() - - self.max_seq_len = max_seq_len - self.d_model = d_model - self.phoneme_side_n_layer = phoneme_side_n_layer - self.phoneme_side_head = phoneme_side_head - self.phoneme_side_conv1d_filter_size = phoneme_side_conv1d_filter_size - self.phoneme_side_output_size = phoneme_side_output_size - self.mel_side_n_layer = mel_side_n_layer - self.mel_side_head = mel_side_head - self.mel_side_conv1d_filter_size = mel_side_conv1d_filter_size - self.mel_side_output_size = mel_side_output_size - self.fft_conv1d_kernel = fft_conv1d_kernel - self.fft_conv1d_padding = fft_conv1d_padding - self.duration_predictor_filter_size = duration_predictor_filter_size - self.duration_predictor_kernel_size = duration_predictor_kernel_size - self.dropout = dropout - self.n_mels = n_mels - self.fused_layernorm = fused_layernorm - self.n_phns = len(symbols)+1 - - self.word_emb = nn.Embedding( - self.n_phns, - d_model, - padding_idx=0) - - self.phoneme_side = FFTBlocks( - max_seq_len=max_seq_len, - n_layers=phoneme_side_n_layer, - n_head=phoneme_side_head, - d_k=64, - d_v=64, - d_model=d_model, - d_inner=phoneme_side_conv1d_filter_size, - fft_conv1d_kernel=fft_conv1d_kernel, - fft_conv1d_padding=fft_conv1d_padding, - dropout=dropout, - name="phoneme_side", - fused_layernorm=fused_layernorm - ) - - self.length_regulator = LengthRegulator( - input_size=phoneme_side_output_size, - duration_predictor_filter_size=duration_predictor_filter_size, - duration_predictor_kernel_size=duration_predictor_kernel_size, - dropout=dropout, - fused_layernorm=fused_layernorm - ) - - self.mel_side = FFTBlocks( - max_seq_len=max_seq_len, - n_layers=mel_side_n_layer, - n_head=mel_side_head, - d_k=64, - d_v=64, - d_model=d_model, - d_inner=mel_side_conv1d_filter_size, - fft_conv1d_kernel=fft_conv1d_kernel, - fft_conv1d_padding=fft_conv1d_padding, - dropout=dropout, - name="mel_side", - fused_layernorm=fused_layernorm - ) - - self.mel_linear = nn.Linear(mel_side_output_size, n_mels, bias=True) - - def forward(self, seq, pos, duration_target=None, alpha=1.0, seq_output_len=None, use_fp16=False, acts=None): - - # Phoneme Embedding - output = self.word_emb(seq) - - if acts is not None: - acts["act.emb"] = output - - if use_fp16: - output = output.half() - - # Phoneme Side FFT Blocks - output, output_mask = self.phoneme_side(output, pos, acts=acts) - - if acts is not None: - acts["act.phoneme_side.seq"] = output - - # Length Regulator - output, pos, duration = self.length_regulator( - output, - output_mask, - target=duration_target, - alpha=alpha) - - if seq_output_len: - output = F.pad(output, pad=(0, 0, 0, seq_output_len - output.size(1))) - pos = F.pad(pos, pad=(0, seq_output_len - pos.size(1))) - - # length of output mel shouldn't exceed max_seq_len - output = output[:, :self.max_seq_len] - pos = pos[:, :self.max_seq_len] - - if acts is not None: - acts["act.length_regulator.seq"] = output - acts["act.length_regulator.dur"] = torch.round(duration) - - if self.training or output.bool().any(): - # Mel Side FFT Blocks - output, output_mask = self.mel_side(output, pos, acts=acts) - - if acts is not None: - acts["act.mel_side.seq"] = output - - # Linear Layer - output = self.mel_linear(output) - - if acts is not None: - acts["out.seq_mask"] = output_mask - acts["out.seq"] = output - else: - # seq length could be zero, in case duration predictor outputs all zeros. - # In this case, skip feed-forwarding. - tprint("Duration Predictor outputs all zeros. Output will be zero length.") - output_shape = (output.size(0), 0, output_mask.size(2)) - output = torch.zeros(size=(output_shape)) - output_mask = torch.ones(size=(output_shape)) - - if torch.cuda.device_count() > 1: - # In a multi-gpu setting, all output mels from devices must have the same length. - # otherwise, an error occurs in process of gathering output. - if not seq_output_len: - seq_output_len = self.max_seq_len - padding = (0, 0, 0, seq_output_len - output.size(1)) - - output = F.pad(output, padding) - output = output[:, :seq_output_len, :] - - output_mask = F.pad(output_mask, padding) - output_mask = output_mask[:, :seq_output_len, :] - - return output, output_mask, duration +# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the NVIDIA CORPORATION nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +from collections import OrderedDict + +import numpy as np +import torch +from torch import nn as nn + +from fastspeech.model.module import FFTBlocks, LengthRegulator +from fastspeech.utils.pytorch import to_device_async +from fastspeech.utils.nvtx import Nvtx +from torch.nn import functional as F +from fastspeech.utils.logging import tprint +from fastspeech.text_norm.symbols import symbols + +class Fastspeech(nn.Module): + """ FastSpeech """ + + def __init__(self, + max_seq_len, + d_model, + phoneme_side_n_layer, + phoneme_side_head, + phoneme_side_conv1d_filter_size, + phoneme_side_output_size, + mel_side_n_layer, + mel_side_head, + mel_side_conv1d_filter_size, + mel_side_output_size, + fft_conv1d_kernel, + fft_conv1d_padding, + duration_predictor_filter_size, + duration_predictor_kernel_size, + dropout, + n_mels, + fused_layernorm=False): + super(Fastspeech, self).__init__() + + self.max_seq_len = max_seq_len + self.d_model = d_model + self.phoneme_side_n_layer = phoneme_side_n_layer + self.phoneme_side_head = phoneme_side_head + self.phoneme_side_conv1d_filter_size = phoneme_side_conv1d_filter_size + self.phoneme_side_output_size = phoneme_side_output_size + self.mel_side_n_layer = mel_side_n_layer + self.mel_side_head = mel_side_head + self.mel_side_conv1d_filter_size = mel_side_conv1d_filter_size + self.mel_side_output_size = mel_side_output_size + self.fft_conv1d_kernel = fft_conv1d_kernel + self.fft_conv1d_padding = fft_conv1d_padding + self.duration_predictor_filter_size = duration_predictor_filter_size + self.duration_predictor_kernel_size = duration_predictor_kernel_size + self.dropout = dropout + self.n_mels = n_mels + self.fused_layernorm = fused_layernorm + self.n_phns = len(symbols)+1 + + self.word_emb = nn.Embedding( + self.n_phns, + d_model, + padding_idx=0) + + self.phoneme_side = FFTBlocks( + max_seq_len=max_seq_len, + n_layers=phoneme_side_n_layer, + n_head=phoneme_side_head, + d_k=64, + d_v=64, + d_model=d_model, + d_inner=phoneme_side_conv1d_filter_size, + fft_conv1d_kernel=fft_conv1d_kernel, + fft_conv1d_padding=fft_conv1d_padding, + dropout=dropout, + name="phoneme_side", + fused_layernorm=fused_layernorm + ) + + self.length_regulator = LengthRegulator( + input_size=phoneme_side_output_size, + duration_predictor_filter_size=duration_predictor_filter_size, + duration_predictor_kernel_size=duration_predictor_kernel_size, + dropout=dropout, + fused_layernorm=fused_layernorm + ) + + self.mel_side = FFTBlocks( + max_seq_len=max_seq_len, + n_layers=mel_side_n_layer, + n_head=mel_side_head, + d_k=64, + d_v=64, + d_model=d_model, + d_inner=mel_side_conv1d_filter_size, + fft_conv1d_kernel=fft_conv1d_kernel, + fft_conv1d_padding=fft_conv1d_padding, + dropout=dropout, + name="mel_side", + fused_layernorm=fused_layernorm + ) + + self.mel_linear = nn.Linear(mel_side_output_size, n_mels, bias=True) + + def forward(self, seq, pos, duration_target=None, alpha=1.0, seq_output_len=None, use_fp16=False, acts=None): + + # Phoneme Embedding + output = self.word_emb(seq) + + if acts is not None: + acts["act.emb"] = output + + if use_fp16: + output = output.half() + + # Phoneme Side FFT Blocks + output, output_mask = self.phoneme_side(output, pos, acts=acts) + + if acts is not None: + acts["act.phoneme_side.seq"] = output + + # Length Regulator + output, pos, duration = self.length_regulator( + output, + output_mask, + target=duration_target, + alpha=alpha) + + if seq_output_len: + output = F.pad(output, pad=(0, 0, 0, seq_output_len - output.size(1))) + pos = F.pad(pos, pad=(0, seq_output_len - pos.size(1))) + + # length of output mel shouldn't exceed max_seq_len + output = output[:, :self.max_seq_len] + pos = pos[:, :self.max_seq_len] + + if acts is not None: + acts["act.length_regulator.seq"] = output + acts["act.length_regulator.dur"] = torch.round(duration) + + if self.training or output.bool().any(): + # Mel Side FFT Blocks + output, output_mask = self.mel_side(output, pos, acts=acts) + + if acts is not None: + acts["act.mel_side.seq"] = output + + # Linear Layer + output = self.mel_linear(output) + + if acts is not None: + acts["out.seq_mask"] = output_mask + acts["out.seq"] = output + else: + # seq length could be zero, in case duration predictor outputs all zeros. + # In this case, skip feed-forwarding. + tprint("Duration Predictor outputs all zeros. Output will be zero length.") + output_shape = (output.size(0), 0, output_mask.size(2)) + output = torch.zeros(size=(output_shape)) + output_mask = torch.ones(size=(output_shape)) + + if torch.cuda.device_count() > 1: + # In a multi-gpu setting, all output mels from devices must have the same length. + # otherwise, an error occurs in process of gathering output. + if not seq_output_len: + seq_output_len = self.max_seq_len + padding = (0, 0, 0, seq_output_len - output.size(1)) + + output = F.pad(output, padding) + output = output[:, :seq_output_len, :] + + output_mask = F.pad(output_mask, padding) + output_mask = output_mask[:, :seq_output_len, :] + + return output, output_mask, duration diff --git a/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/add_pos_enc/AddPosEncPlugin.h b/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/add_pos_enc/AddPosEncPlugin.h index 4206a681e..15ca4db7a 100644 --- a/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/add_pos_enc/AddPosEncPlugin.h +++ b/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/add_pos_enc/AddPosEncPlugin.h @@ -1,140 +1,140 @@ -// Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. - -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the NVIDIA CORPORATION nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY -// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "NvInfer.h" -#include "NvInferRuntimeCommon.h" -#include -#include -#include - -using namespace std; -using namespace nvinfer1; - -class AddPosEncPlugin: public IPluginV2IOExt { -public: - AddPosEncPlugin() {}; - - AddPosEncPlugin(const void *buffer, size_t length) { - memcpy(&m, buffer, sizeof(m)); - } - - virtual size_t getSerializationSize() const override { - return sizeof(m); - } - virtual void serialize(void *buffer) const override { - memcpy(buffer, &m, sizeof(m)); - } - - nvinfer1::IPluginV2Ext* clone() const override { - return new AddPosEncPlugin(&m, sizeof(m)); - } - - int getNbOutputs() const override { - return 1; - } - nvinfer1::Dims getOutputDimensions(int index, const nvinfer1::Dims* pInputDim, int nInputDim) override { - return pInputDim[0]; - } - - size_t getWorkspaceSize(int nBatch) const override {return 0;} - int enqueue(int nBatch, const void * const *inputs, void **outputs, void* workspace, cudaStream_t stream) override; - - int initialize() override {return 0;} - void terminate() override {} - void destroy() override { delete this; } - void setPluginNamespace(const char* szNamespace) override {} - const char* getPluginNamespace() const override {return "";} - const char* getPluginType() const override {return "AddPosEncPlugin";} - const char* getPluginVersion() const override {return "0.0.1";} - - void configurePlugin(const PluginTensorDesc* in, int nbInput, const PluginTensorDesc* out, int nbOutput) override - { - m.inputDim = in[0].dims; - m.dataType = in[0].type; - } - - bool supportsFormatCombination(int pos, const PluginTensorDesc* inOut, int nbInputs, int nbOutputs) const override - { - assert(nbInputs == 1 && nbOutputs == 1 && pos < nbInputs + nbOutputs); - - bool condition = inOut[pos].format == TensorFormat::kLINEAR; - condition &= ((inOut[pos].type == DataType::kFLOAT) - // || (inOut[pos].type == DataType::kHALF) - ); - - switch (pos) { - case 0: // input - condition &= ((inOut[pos].type == DataType::kFLOAT) // for seq in fp32 - || (inOut[pos].type == DataType::kHALF)); // for seq in fp16 - break; - case 1: // output - condition &= ((inOut[pos].type == inOut[0].type)); // the same type as the input - break; - } - - return condition; - } - - DataType getOutputDataType(int index, const DataType* inputTypes, int nbInputs) const override - { - return inputTypes[0]; - } - - bool isOutputBroadcastAcrossBatch(int outputIndex, const bool* inputIsBroadcasted, int nbInputs) const override - { - return false; - } - - bool canBroadcastInputAcrossBatch(int inputIndex) const override - { - return false; - } - -private: - struct { - Dims inputDim; - DataType dataType; - } m; -}; - -class AddPosEncPluginCreator : public nvinfer1::IPluginCreator { -public: - nvinfer1::IPluginV2* deserializePlugin(const char* name, const void* serialData, size_t serialLength) override { - return new AddPosEncPlugin(serialData, serialLength); - } - - const char* getPluginName() const override {return "AddPosEncPlugin";} - const char* getPluginVersion() const override {return "0.0.1";} - - void setPluginNamespace(const char* szNamespace) override {} - const char* getPluginNamespace() const override {return "";} - - const nvinfer1::PluginFieldCollection* getFieldNames() override { - std::cout << __FUNCTION__ << std::endl; - return nullptr; - } - nvinfer1::IPluginV2* createPlugin(const char* name, const nvinfer1::PluginFieldCollection* fc) override { - return new AddPosEncPlugin(); - } -}; +// Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of the NVIDIA CORPORATION nor the +// names of its contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "NvInfer.h" +#include "NvInferRuntimeCommon.h" +#include +#include +#include + +using namespace std; +using namespace nvinfer1; + +class AddPosEncPlugin: public IPluginV2IOExt { +public: + AddPosEncPlugin() {}; + + AddPosEncPlugin(const void *buffer, size_t length) { + memcpy(&m, buffer, sizeof(m)); + } + + virtual size_t getSerializationSize() const override { + return sizeof(m); + } + virtual void serialize(void *buffer) const override { + memcpy(buffer, &m, sizeof(m)); + } + + nvinfer1::IPluginV2Ext* clone() const override { + return new AddPosEncPlugin(&m, sizeof(m)); + } + + int getNbOutputs() const override { + return 1; + } + nvinfer1::Dims getOutputDimensions(int index, const nvinfer1::Dims* pInputDim, int nInputDim) override { + return pInputDim[0]; + } + + size_t getWorkspaceSize(int nBatch) const override {return 0;} + int enqueue(int nBatch, const void * const *inputs, void **outputs, void* workspace, cudaStream_t stream) override; + + int initialize() override {return 0;} + void terminate() override {} + void destroy() override { delete this; } + void setPluginNamespace(const char* szNamespace) override {} + const char* getPluginNamespace() const override {return "";} + const char* getPluginType() const override {return "AddPosEncPlugin";} + const char* getPluginVersion() const override {return "0.0.1";} + + void configurePlugin(const PluginTensorDesc* in, int nbInput, const PluginTensorDesc* out, int nbOutput) override + { + m.inputDim = in[0].dims; + m.dataType = in[0].type; + } + + bool supportsFormatCombination(int pos, const PluginTensorDesc* inOut, int nbInputs, int nbOutputs) const override + { + assert(nbInputs == 1 && nbOutputs == 1 && pos < nbInputs + nbOutputs); + + bool condition = inOut[pos].format == TensorFormat::kLINEAR; + condition &= ((inOut[pos].type == DataType::kFLOAT) + // || (inOut[pos].type == DataType::kHALF) + ); + + switch (pos) { + case 0: // input + condition &= ((inOut[pos].type == DataType::kFLOAT) // for seq in fp32 + || (inOut[pos].type == DataType::kHALF)); // for seq in fp16 + break; + case 1: // output + condition &= ((inOut[pos].type == inOut[0].type)); // the same type as the input + break; + } + + return condition; + } + + DataType getOutputDataType(int index, const DataType* inputTypes, int nbInputs) const override + { + return inputTypes[0]; + } + + bool isOutputBroadcastAcrossBatch(int outputIndex, const bool* inputIsBroadcasted, int nbInputs) const override + { + return false; + } + + bool canBroadcastInputAcrossBatch(int inputIndex) const override + { + return false; + } + +private: + struct { + Dims inputDim; + DataType dataType; + } m; +}; + +class AddPosEncPluginCreator : public nvinfer1::IPluginCreator { +public: + nvinfer1::IPluginV2* deserializePlugin(const char* name, const void* serialData, size_t serialLength) override { + return new AddPosEncPlugin(serialData, serialLength); + } + + const char* getPluginName() const override {return "AddPosEncPlugin";} + const char* getPluginVersion() const override {return "0.0.1";} + + void setPluginNamespace(const char* szNamespace) override {} + const char* getPluginNamespace() const override {return "";} + + const nvinfer1::PluginFieldCollection* getFieldNames() override { + std::cout << __FUNCTION__ << std::endl; + return nullptr; + } + nvinfer1::IPluginV2* createPlugin(const char* name, const nvinfer1::PluginFieldCollection* fc) override { + return new AddPosEncPlugin(); + } +}; diff --git a/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/add_pos_enc/AddPosEncPlugin.so b/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/add_pos_enc/AddPosEncPlugin.so old mode 100755 new mode 100644 diff --git a/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/repeat/RepeatPlugin.h b/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/repeat/RepeatPlugin.h index 8486d1988..419883670 100644 --- a/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/repeat/RepeatPlugin.h +++ b/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/repeat/RepeatPlugin.h @@ -1,154 +1,154 @@ -// Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. - -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// * Neither the name of the NVIDIA CORPORATION nor the -// names of its contributors may be used to endorse or promote products -// derived from this software without specific prior written permission. - -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -// DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY -// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "NvInfer.h" -#include "NvInferRuntimeCommon.h" -#include -#include -#include - -using namespace std; -using namespace nvinfer1; - -class RepeatPlugin: public IPluginV2IOExt { -public: - RepeatPlugin() = delete; - - RepeatPlugin(int maxOutputLength) { - m.maxOutputLength = maxOutputLength; - } - - RepeatPlugin(const void *buffer, size_t length) { - memcpy(&m, buffer, sizeof(m)); - } - - virtual size_t getSerializationSize() const override { - return sizeof(m); - } - virtual void serialize(void *buffer) const override { - memcpy(buffer, &m, sizeof(m)); - } - - nvinfer1::IPluginV2Ext* clone() const override { - return new RepeatPlugin(&m, sizeof(m)); - } - - int getNbOutputs() const override { - return 1; - } - nvinfer1::Dims getOutputDimensions(int index, const nvinfer1::Dims* pInputDim, int nInputDim) override { - int t = m.maxOutputLength; - int w = pInputDim[0].d[1]; - - return nvinfer1::Dims2(t, w); - } - - size_t getWorkspaceSize(int nBatch) const override {return 0;} - int enqueue(int nBatch, const void * const *inputs, void **outputs, void* workspace, cudaStream_t stream) override; - - int initialize() override {return 0;} - void terminate() override {} - void destroy() override { delete this; } - void setPluginNamespace(const char* szNamespace) override {} - const char* getPluginNamespace() const override {return "";} - const char* getPluginType() const override {return "RepeatPlugin";} - const char* getPluginVersion() const override {return "0.0.1";} - - void configurePlugin(const PluginTensorDesc* in, int nbInput, const PluginTensorDesc* out, int nbOutput) override - { - m.inputDim = in[0].dims; - m.dataType = in[0].type; - } - - bool supportsFormatCombination(int pos, const PluginTensorDesc* inOut, int nbInputs, int nbOutputs) const override - { - bool condition = inOut[pos].format == TensorFormat::kLINEAR; - - switch (pos) { - case 0: // input seq - condition &= ((inOut[pos].type == DataType::kFLOAT) // for seq in fp32 - || (inOut[pos].type == DataType::kHALF) // for seq in fp16 - || (inOut[pos].type == DataType::kINT32)); // for seq_mask - break; - case 1: // repeat count - condition &= ((inOut[pos].type == DataType::kFLOAT)); - break; - case 2: // output seq - condition &= ((inOut[pos].type == inOut[0].type)); // the same type as the input - break; - } - - return condition; - } - - DataType getOutputDataType(int index, const DataType* inputTypes, int nbInputs) const override - { - return inputTypes[0]; - } - - bool isOutputBroadcastAcrossBatch(int outputIndex, const bool* inputIsBroadcasted, int nbInputs) const override - { - return false; - } - - bool canBroadcastInputAcrossBatch(int inputIndex) const override - { - return false; - } - -private: - struct { - Dims inputDim; - DataType dataType; - int maxOutputLength; - } m; - -}; - -class RepeatPluginCreator : public nvinfer1::IPluginCreator { -public: - nvinfer1::IPluginV2* deserializePlugin(const char* name, const void* serialData, size_t serialLength) override { - return new RepeatPlugin(serialData, serialLength); - } - - const char* getPluginName() const override {return "RepeatPlugin";} - const char* getPluginVersion() const override {return "0.0.1";} - - void setPluginNamespace(const char* szNamespace) override {} - const char* getPluginNamespace() const override {return "";} - - const nvinfer1::PluginFieldCollection* getFieldNames() override { - std::cout << __FUNCTION__ << std::endl; - return nullptr; - } - nvinfer1::IPluginV2* createPlugin(const char* name, const nvinfer1::PluginFieldCollection* fc) override { - int maxOutputLength = 0; - for (int i = 0; i < fc->nbFields; i++) { - if (!strcmp(fc->fields[i].name, "maxOutputLength")) { - maxOutputLength = *(int *)fc->fields[i].data; - } - } - return new RepeatPlugin(maxOutputLength); - } -}; +// Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of the NVIDIA CORPORATION nor the +// names of its contributors may be used to endorse or promote products +// derived from this software without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +// DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY +// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "NvInfer.h" +#include "NvInferRuntimeCommon.h" +#include +#include +#include + +using namespace std; +using namespace nvinfer1; + +class RepeatPlugin: public IPluginV2IOExt { +public: + RepeatPlugin() = delete; + + RepeatPlugin(int maxOutputLength) { + m.maxOutputLength = maxOutputLength; + } + + RepeatPlugin(const void *buffer, size_t length) { + memcpy(&m, buffer, sizeof(m)); + } + + virtual size_t getSerializationSize() const override { + return sizeof(m); + } + virtual void serialize(void *buffer) const override { + memcpy(buffer, &m, sizeof(m)); + } + + nvinfer1::IPluginV2Ext* clone() const override { + return new RepeatPlugin(&m, sizeof(m)); + } + + int getNbOutputs() const override { + return 1; + } + nvinfer1::Dims getOutputDimensions(int index, const nvinfer1::Dims* pInputDim, int nInputDim) override { + int t = m.maxOutputLength; + int w = pInputDim[0].d[1]; + + return nvinfer1::Dims2(t, w); + } + + size_t getWorkspaceSize(int nBatch) const override {return 0;} + int enqueue(int nBatch, const void * const *inputs, void **outputs, void* workspace, cudaStream_t stream) override; + + int initialize() override {return 0;} + void terminate() override {} + void destroy() override { delete this; } + void setPluginNamespace(const char* szNamespace) override {} + const char* getPluginNamespace() const override {return "";} + const char* getPluginType() const override {return "RepeatPlugin";} + const char* getPluginVersion() const override {return "0.0.1";} + + void configurePlugin(const PluginTensorDesc* in, int nbInput, const PluginTensorDesc* out, int nbOutput) override + { + m.inputDim = in[0].dims; + m.dataType = in[0].type; + } + + bool supportsFormatCombination(int pos, const PluginTensorDesc* inOut, int nbInputs, int nbOutputs) const override + { + bool condition = inOut[pos].format == TensorFormat::kLINEAR; + + switch (pos) { + case 0: // input seq + condition &= ((inOut[pos].type == DataType::kFLOAT) // for seq in fp32 + || (inOut[pos].type == DataType::kHALF) // for seq in fp16 + || (inOut[pos].type == DataType::kINT32)); // for seq_mask + break; + case 1: // repeat count + condition &= ((inOut[pos].type == DataType::kFLOAT)); + break; + case 2: // output seq + condition &= ((inOut[pos].type == inOut[0].type)); // the same type as the input + break; + } + + return condition; + } + + DataType getOutputDataType(int index, const DataType* inputTypes, int nbInputs) const override + { + return inputTypes[0]; + } + + bool isOutputBroadcastAcrossBatch(int outputIndex, const bool* inputIsBroadcasted, int nbInputs) const override + { + return false; + } + + bool canBroadcastInputAcrossBatch(int inputIndex) const override + { + return false; + } + +private: + struct { + Dims inputDim; + DataType dataType; + int maxOutputLength; + } m; + +}; + +class RepeatPluginCreator : public nvinfer1::IPluginCreator { +public: + nvinfer1::IPluginV2* deserializePlugin(const char* name, const void* serialData, size_t serialLength) override { + return new RepeatPlugin(serialData, serialLength); + } + + const char* getPluginName() const override {return "RepeatPlugin";} + const char* getPluginVersion() const override {return "0.0.1";} + + void setPluginNamespace(const char* szNamespace) override {} + const char* getPluginNamespace() const override {return "";} + + const nvinfer1::PluginFieldCollection* getFieldNames() override { + std::cout << __FUNCTION__ << std::endl; + return nullptr; + } + nvinfer1::IPluginV2* createPlugin(const char* name, const nvinfer1::PluginFieldCollection* fc) override { + int maxOutputLength = 0; + for (int i = 0; i < fc->nbFields; i++) { + if (!strcmp(fc->fields[i].name, "maxOutputLength")) { + maxOutputLength = *(int *)fc->fields[i].data; + } + } + return new RepeatPlugin(maxOutputLength); + } +}; diff --git a/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/repeat/RepeatPlugin.so b/CUDA-Optimized/FastSpeech/fastspeech/trt/plugins/repeat/RepeatPlugin.so old mode 100755 new mode 100644 diff --git a/CUDA-Optimized/FastSpeech/fastspeech/trt/samples/To deliver interfaces that are significantly better suited to create and process RFC eight twenty one, RFC eight twenty two, RFC.wav b/CUDA-Optimized/FastSpeech/fastspeech/trt/samples/To deliver interfaces that are significantly better suited to create and process RFC eight twenty one, RFC eight twenty two, RFC.wav deleted file mode 100644 index e5275e494..000000000 Binary files a/CUDA-Optimized/FastSpeech/fastspeech/trt/samples/To deliver interfaces that are significantly better suited to create and process RFC eight twenty one, RFC eight twenty two, RFC.wav and /dev/null differ diff --git a/CUDA-Optimized/FastSpeech/fastspeech/trt/samples/You can call me directly at four two five seven zero three seven three four four or my cell four two five four four four seven f.wav b/CUDA-Optimized/FastSpeech/fastspeech/trt/samples/You can call me directly at four two five seven zero three seven three four four or my cell four two five four four four seven f.wav deleted file mode 100644 index e17b9413d..000000000 Binary files a/CUDA-Optimized/FastSpeech/fastspeech/trt/samples/You can call me directly at four two five seven zero three seven three four four or my cell four two five four four four seven f.wav and /dev/null differ diff --git a/CUDA-Optimized/FastSpeech/fastspeech/trt/samples_fp16/To deliver interfaces that are significantly better suited to create and process RFC eight twenty one, RFC eight twenty two, RFC.wav b/CUDA-Optimized/FastSpeech/fastspeech/trt/samples_fp16/To deliver interfaces that are significantly better suited to create and process RFC eight twenty one, RFC eight twenty two, RFC.wav deleted file mode 100644 index 040c87891..000000000 Binary files a/CUDA-Optimized/FastSpeech/fastspeech/trt/samples_fp16/To deliver interfaces that are significantly better suited to create and process RFC eight twenty one, RFC eight twenty two, RFC.wav and /dev/null differ diff --git a/CUDA-Optimized/FastSpeech/fastspeech/trt/samples_fp16/You can call me directly at four two five seven zero three seven three four four or my cell four two five four four four seven f.wav b/CUDA-Optimized/FastSpeech/fastspeech/trt/samples_fp16/You can call me directly at four two five seven zero three seven three four four or my cell four two five four four four seven f.wav deleted file mode 100644 index 860f52546..000000000 Binary files a/CUDA-Optimized/FastSpeech/fastspeech/trt/samples_fp16/You can call me directly at four two five seven zero three seven three four four or my cell four two five four four four seven f.wav and /dev/null differ diff --git a/CUDA-Optimized/FastSpeech/fastspeech/utils/optimizer.py b/CUDA-Optimized/FastSpeech/fastspeech/utils/optimizer.py index a653ac92b..73d675a4e 100644 --- a/CUDA-Optimized/FastSpeech/fastspeech/utils/optimizer.py +++ b/CUDA-Optimized/FastSpeech/fastspeech/utils/optimizer.py @@ -1,69 +1,69 @@ -# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the NVIDIA CORPORATION nor the -# names of its contributors may be used to endorse or promote products -# derived from this software without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import numpy as np - - -class ScheduledOptim(): - ''' A simple wrapper class for learning rate scheduling ''' - - def __init__(self, optimizer, d_model, n_warmup_steps, current_steps): - self._optimizer = optimizer - self.n_warmup_steps = n_warmup_steps - self.n_current_steps = current_steps - self.init_lr = np.power(d_model, -0.5) - - def step_and_update_lr_frozen(self, learning_rate_frozen): - for param_group in self._optimizer.param_groups: - param_group['lr'] = learning_rate_frozen - self._optimizer.step() - - def step_and_update_lr(self): - self._update_learning_rate() - self._optimizer.step() - - def get_learning_rate(self): - learning_rate = 0.0 - for param_group in self._optimizer.param_groups: - learning_rate = param_group['lr'] - - return learning_rate - - def zero_grad(self): - # print(self.init_lr) - self._optimizer.zero_grad() - - def _get_lr_scale(self): - return np.min([ - np.power(self.n_current_steps, -0.5), - np.power(self.n_warmup_steps, -1.5) * self.n_current_steps]) - - def _update_learning_rate(self): - ''' Learning rate scheduling per step ''' - - self.n_current_steps += 1 - lr = self.init_lr * self._get_lr_scale() - - for param_group in self._optimizer.param_groups: - param_group['lr'] = lr +# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the NVIDIA CORPORATION nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +import numpy as np + + +class ScheduledOptim(): + ''' A simple wrapper class for learning rate scheduling ''' + + def __init__(self, optimizer, d_model, n_warmup_steps, current_steps): + self._optimizer = optimizer + self.n_warmup_steps = n_warmup_steps + self.n_current_steps = current_steps + self.init_lr = np.power(d_model, -0.5) + + def step_and_update_lr_frozen(self, learning_rate_frozen): + for param_group in self._optimizer.param_groups: + param_group['lr'] = learning_rate_frozen + self._optimizer.step() + + def step_and_update_lr(self): + self._update_learning_rate() + self._optimizer.step() + + def get_learning_rate(self): + learning_rate = 0.0 + for param_group in self._optimizer.param_groups: + learning_rate = param_group['lr'] + + return learning_rate + + def zero_grad(self): + # print(self.init_lr) + self._optimizer.zero_grad() + + def _get_lr_scale(self): + return np.min([ + np.power(self.n_current_steps, -0.5), + np.power(self.n_warmup_steps, -1.5) * self.n_current_steps]) + + def _update_learning_rate(self): + ''' Learning rate scheduling per step ''' + + self.n_current_steps += 1 + lr = self.init_lr * self._get_lr_scale() + + for param_group in self._optimizer.param_groups: + param_group['lr'] = lr diff --git a/CUDA-Optimized/FastSpeech/tacotron2/__init__.py b/CUDA-Optimized/FastSpeech/tacotron2/__init__.py index 2d0994ab8..1d3c7bc56 100644 --- a/CUDA-Optimized/FastSpeech/tacotron2/__init__.py +++ b/CUDA-Optimized/FastSpeech/tacotron2/__init__.py @@ -1,33 +1,33 @@ -# BSD 3-Clause License - -# Copyright (c) 2018-2020, NVIDIA Corporation -# All rights reserved. - -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: - -# * Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. - -# * Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. - -# * Neither the name of the copyright holder nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. - -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -"""https://github.com/NVIDIA/tacotron2""" - -import tacotron2.model +# BSD 3-Clause License + +# Copyright (c) 2018-2020, NVIDIA Corporation +# All rights reserved. + +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: + +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. + +# * Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. + +# * Neither the name of the copyright holder nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. + +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"""https://github.com/NVIDIA/tacotron2""" + +import tacotron2.model diff --git a/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/benchmark_inference.sh b/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/benchmark_inference.sh old mode 100755 new mode 100644 diff --git a/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/benchmark_train.sh b/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/benchmark_train.sh old mode 100755 new mode 100644 diff --git a/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/benchmark_train_multi_gpu.sh b/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/benchmark_train_multi_gpu.sh old mode 100755 new mode 100644 diff --git a/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/predict.sh b/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/predict.sh old mode 100755 new mode 100644 diff --git a/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/train.sh b/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/train.sh old mode 100755 new mode 100644 diff --git a/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/train_multi_gpu.sh b/DGLPyTorch/DrugDiscovery/SE3Transformer/scripts/train_multi_gpu.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/compute_wer.sh b/Kaldi/SpeechRecognition/scripts/compute_wer.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/docker/build.sh b/Kaldi/SpeechRecognition/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/docker/dataset_setup.sh b/Kaldi/SpeechRecognition/scripts/docker/dataset_setup.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/docker/launch_client.sh b/Kaldi/SpeechRecognition/scripts/docker/launch_client.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/docker/launch_download.sh b/Kaldi/SpeechRecognition/scripts/docker/launch_download.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/docker/launch_server.sh b/Kaldi/SpeechRecognition/scripts/docker/launch_server.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/docker/prepare_data.sh b/Kaldi/SpeechRecognition/scripts/docker/prepare_data.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/docker/run_client.sh b/Kaldi/SpeechRecognition/scripts/docker/run_client.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/nvidia_kaldi_triton_entrypoint.sh b/Kaldi/SpeechRecognition/scripts/nvidia_kaldi_triton_entrypoint.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/run_inference_all_a100.sh b/Kaldi/SpeechRecognition/scripts/run_inference_all_a100.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/run_inference_all_t4.sh b/Kaldi/SpeechRecognition/scripts/run_inference_all_t4.sh old mode 100755 new mode 100644 diff --git a/Kaldi/SpeechRecognition/scripts/run_inference_all_v100.sh b/Kaldi/SpeechRecognition/scripts/run_inference_all_v100.sh old mode 100755 new mode 100644 diff --git a/MxNet/Classification/RN50v1.5/benchmark.py b/MxNet/Classification/RN50v1.5/benchmark.py old mode 100755 new mode 100644 diff --git a/MxNet/Classification/RN50v1.5/runner b/MxNet/Classification/RN50v1.5/runner old mode 100755 new mode 100644 diff --git a/MxNet/Classification/RN50v1.5/scripts/prepare_imagenet.sh b/MxNet/Classification/RN50v1.5/scripts/prepare_imagenet.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/image_classification/__pycache__/__init__.cpython-311.pyc b/PyTorch/Classification/ConvNets/image_classification/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 000000000..e2193f2c9 Binary files /dev/null and b/PyTorch/Classification/ConvNets/image_classification/__pycache__/__init__.cpython-311.pyc differ diff --git a/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/__init__.cpython-311.pyc b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/__init__.cpython-311.pyc new file mode 100644 index 000000000..bc39c6152 Binary files /dev/null and b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/__init__.cpython-311.pyc differ diff --git a/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/common.cpython-311.pyc b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/common.cpython-311.pyc new file mode 100644 index 000000000..382176f4e Binary files /dev/null and b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/common.cpython-311.pyc differ diff --git a/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/efficientnet.cpython-311.pyc b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/efficientnet.cpython-311.pyc new file mode 100644 index 000000000..046fa9758 Binary files /dev/null and b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/efficientnet.cpython-311.pyc differ diff --git a/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/entrypoints.cpython-311.pyc b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/entrypoints.cpython-311.pyc new file mode 100644 index 000000000..4b46b7db2 Binary files /dev/null and b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/entrypoints.cpython-311.pyc differ diff --git a/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/model.cpython-311.pyc b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/model.cpython-311.pyc new file mode 100644 index 000000000..60ed0cc57 Binary files /dev/null and b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/model.cpython-311.pyc differ diff --git a/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/resnet.cpython-311.pyc b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/resnet.cpython-311.pyc new file mode 100644 index 000000000..999543447 Binary files /dev/null and b/PyTorch/Classification/ConvNets/image_classification/models/__pycache__/resnet.cpython-311.pyc differ diff --git a/PyTorch/Classification/ConvNets/scripts/rn50_partial.sh b/PyTorch/Classification/ConvNets/scripts/rn50_partial.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/scripts/rnxt_partial.sh b/PyTorch/Classification/ConvNets/scripts/rnxt_partial.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/scripts/sernxt_partial.sh b/PyTorch/Classification/ConvNets/scripts/sernxt_partial.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/calculate_metrics.py b/PyTorch/Classification/ConvNets/triton/calculate_metrics.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/convert_model.py b/PyTorch/Classification/ConvNets/triton/convert_model.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/run_inference_on_fw.py b/PyTorch/Classification/ConvNets/triton/run_inference_on_fw.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/run_inference_on_triton.py b/PyTorch/Classification/ConvNets/triton/run_inference_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/run_offline_performance_test_on_triton.py b/PyTorch/Classification/ConvNets/triton/run_offline_performance_test_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/run_online_performance_test_on_triton.py b/PyTorch/Classification/ConvNets/triton/run_online_performance_test_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/scripts/docker/build.sh b/PyTorch/Classification/ConvNets/triton/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/scripts/docker/interactive.sh b/PyTorch/Classification/ConvNets/triton/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/scripts/docker/triton_inference_server.sh b/PyTorch/Classification/ConvNets/triton/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/scripts/download_data.sh b/PyTorch/Classification/ConvNets/triton/scripts/download_data.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/scripts/process_dataset.sh b/PyTorch/Classification/ConvNets/triton/scripts/process_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/scripts/setup_environment.sh b/PyTorch/Classification/ConvNets/triton/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/ConvNets/triton/scripts/setup_parameters.sh b/PyTorch/Classification/ConvNets/triton/scripts/setup_parameters.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/configs/batch1/GV100/0.5ms-D.json b/PyTorch/Classification/GPUNet/configs/batch1/GV100/0.5ms-D.json old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/configs/batch1/GV100/0.8ms-D.json b/PyTorch/Classification/GPUNet/configs/batch1/GV100/0.8ms-D.json old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/configs/gpunet_torchhub.py b/PyTorch/Classification/GPUNet/configs/gpunet_torchhub.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/configs/model_hub.py b/PyTorch/Classification/GPUNet/configs/model_hub.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/models/gpunet_builder.py b/PyTorch/Classification/GPUNet/models/gpunet_builder.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train.py b/PyTorch/Classification/GPUNet/train.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train.sh b/PyTorch/Classification/GPUNet/train.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train_params/GPUNet-0.train.params b/PyTorch/Classification/GPUNet/train_params/GPUNet-0.train.params old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train_params/GPUNet-1.train.params b/PyTorch/Classification/GPUNet/train_params/GPUNet-1.train.params old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train_params/GPUNet-2.train.params b/PyTorch/Classification/GPUNet/train_params/GPUNet-2.train.params old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train_params/GPUNet-D1.train.params b/PyTorch/Classification/GPUNet/train_params/GPUNet-D1.train.params old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train_params/GPUNet-D2.train.params b/PyTorch/Classification/GPUNet/train_params/GPUNet-D2.train.params old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train_params/GPUNet-P0.train.params b/PyTorch/Classification/GPUNet/train_params/GPUNet-P0.train.params old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/train_params/GPUNet-P1.train.params b/PyTorch/Classification/GPUNet/train_params/GPUNet-P1.train.params old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/05ms-D/runner/pipeline_impl.py b/PyTorch/Classification/GPUNet/triton/05ms-D/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/05ms-D/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/Classification/GPUNet/triton/05ms-D/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/05ms-D/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/Classification/GPUNet/triton/05ms-D/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/065ms/runner/pipeline_impl.py b/PyTorch/Classification/GPUNet/triton/065ms/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/065ms/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/Classification/GPUNet/triton/065ms/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/065ms/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/Classification/GPUNet/triton/065ms/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/085ms/runner/pipeline_impl.py b/PyTorch/Classification/GPUNet/triton/085ms/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/085ms/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/Classification/GPUNet/triton/085ms/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/085ms/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/Classification/GPUNet/triton/085ms/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/08ms-D/runner/pipeline_impl.py b/PyTorch/Classification/GPUNet/triton/08ms-D/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/08ms-D/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/Classification/GPUNet/triton/08ms-D/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/08ms-D/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/Classification/GPUNet/triton/08ms-D/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/125ms-D/runner/pipeline_impl.py b/PyTorch/Classification/GPUNet/triton/125ms-D/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/125ms-D/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/Classification/GPUNet/triton/125ms-D/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/125ms-D/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/Classification/GPUNet/triton/125ms-D/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/175ms/runner/pipeline_impl.py b/PyTorch/Classification/GPUNet/triton/175ms/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/175ms/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/Classification/GPUNet/triton/175ms/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/175ms/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/Classification/GPUNet/triton/175ms/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/225ms-D/runner/pipeline_impl.py b/PyTorch/Classification/GPUNet/triton/225ms-D/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/225ms-D/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/Classification/GPUNet/triton/225ms-D/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/225ms-D/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/Classification/GPUNet/triton/225ms-D/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/calculate_metrics.py b/PyTorch/Classification/GPUNet/triton/calculate_metrics.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/.version b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/.version old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/__init__.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/args.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/args.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/core.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/core.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/dump.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/dump.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/extensions.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/extensions.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/__init__.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/onnx.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/onnx.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/pyt.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/pyt.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/tensorrt.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/tensorrt.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/utils.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/library/utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/report.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/report.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/__init__.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/base.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/base.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/grpc.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/grpc.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/http.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/http.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/runner.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_inference_runner/runner.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/__init__.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/__init__.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/exceptions.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/exceptions.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/model_analyzer.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/model_analyzer.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/model_analyzer_config.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/model_analyzer_config.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/runner.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/model_analyzer/runner.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/__init__.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/exceptions.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/exceptions.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/perf_analyzer.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/perf_analyzer.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/perf_config.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/perf_config.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/runner.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/runner.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/warmup.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/perf_analyzer/warmup.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/runner.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/triton_performance_runner/runner.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/deployment_toolkit/utils.py b/PyTorch/Classification/GPUNet/triton/deployment_toolkit/utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/export_model.py b/PyTorch/Classification/GPUNet/triton/export_model.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/requirements.txt b/PyTorch/Classification/GPUNet/triton/requirements.txt old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/run_inference_on_fw.py b/PyTorch/Classification/GPUNet/triton/run_inference_on_fw.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/run_inference_on_triton.py b/PyTorch/Classification/GPUNet/triton/run_inference_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/run_performance_on_fw.py b/PyTorch/Classification/GPUNet/triton/run_performance_on_fw.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/run_performance_on_triton.py b/PyTorch/Classification/GPUNet/triton/run_performance_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/runner/downloader.py b/PyTorch/Classification/GPUNet/triton/runner/downloader.py old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/scripts/docker/build.sh b/PyTorch/Classification/GPUNet/triton/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/scripts/docker/interactive.sh b/PyTorch/Classification/GPUNet/triton/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/scripts/docker/triton_inference_server.sh b/PyTorch/Classification/GPUNet/triton/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/triton/scripts/setup_environment.sh b/PyTorch/Classification/GPUNet/triton/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Classification/GPUNet/validate.py b/PyTorch/Classification/GPUNet/validate.py old mode 100755 new mode 100644 diff --git a/PyTorch/Detection/Efficientdet/distributed_train.sh b/PyTorch/Detection/Efficientdet/distributed_train.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Detection/Efficientdet/train.py b/PyTorch/Detection/Efficientdet/train.py old mode 100755 new mode 100644 diff --git a/PyTorch/Detection/SSD/Dockerfile b/PyTorch/Detection/SSD/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/Detection/SSD/download_dataset.sh b/PyTorch/Detection/SSD/download_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/DrugDiscovery/MoFlow/scripts/benchmark_inference.sh b/PyTorch/DrugDiscovery/MoFlow/scripts/benchmark_inference.sh old mode 100755 new mode 100644 diff --git a/PyTorch/DrugDiscovery/MoFlow/scripts/benchmark_training.sh b/PyTorch/DrugDiscovery/MoFlow/scripts/benchmark_training.sh old mode 100755 new mode 100644 diff --git a/PyTorch/DrugDiscovery/MoFlow/scripts/predict.sh b/PyTorch/DrugDiscovery/MoFlow/scripts/predict.sh old mode 100755 new mode 100644 diff --git a/PyTorch/DrugDiscovery/MoFlow/scripts/prepare_datasets.sh b/PyTorch/DrugDiscovery/MoFlow/scripts/prepare_datasets.sh old mode 100755 new mode 100644 diff --git a/PyTorch/DrugDiscovery/MoFlow/scripts/train.sh b/PyTorch/DrugDiscovery/MoFlow/scripts/train.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Forecasting/TFT/Dockerfile b/PyTorch/Forecasting/TFT/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/Forecasting/TFT/__pycache__/tft_torchhub.cpython-311.pyc b/PyTorch/Forecasting/TFT/__pycache__/tft_torchhub.cpython-311.pyc new file mode 100644 index 000000000..6189a888b Binary files /dev/null and b/PyTorch/Forecasting/TFT/__pycache__/tft_torchhub.cpython-311.pyc differ diff --git a/PyTorch/Forecasting/TFT/modeling.py b/PyTorch/Forecasting/TFT/modeling.py old mode 100755 new mode 100644 diff --git a/PyTorch/Forecasting/TFT/train.py b/PyTorch/Forecasting/TFT/train.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/Dockerfile b/PyTorch/LanguageModeling/BART/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/README.md b/PyTorch/LanguageModeling/BART/README.md old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/__init__.py b/PyTorch/LanguageModeling/BART/bart/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/configuration/__init__.py b/PyTorch/LanguageModeling/BART/bart/configuration/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/configuration/configuration_bart.py b/PyTorch/LanguageModeling/BART/bart/configuration/configuration_bart.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/configuration/configuration_t5.py b/PyTorch/LanguageModeling/BART/bart/configuration/configuration_t5.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/configuration/configuration_utils.py b/PyTorch/LanguageModeling/BART/bart/configuration/configuration_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/lamb.py b/PyTorch/LanguageModeling/BART/bart/lamb.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/modeling/__init__.py b/PyTorch/LanguageModeling/BART/bart/modeling/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/modeling/modeling_bart.py b/PyTorch/LanguageModeling/BART/bart/modeling/modeling_bart.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/modeling/modeling_outputs.py b/PyTorch/LanguageModeling/BART/bart/modeling/modeling_outputs.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/modeling/modeling_t5.py b/PyTorch/LanguageModeling/BART/bart/modeling/modeling_t5.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/modeling/modeling_utils.py b/PyTorch/LanguageModeling/BART/bart/modeling/modeling_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/__init__.py b/PyTorch/LanguageModeling/BART/bart/tokenization/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_bart.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_bart.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_gpt2.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_gpt2.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_mbart.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_mbart.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_roberta.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_roberta.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_utils.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_utils_base.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_utils_base.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_utils_fast.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_utils_fast.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_xlm_roberta.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_xlm_roberta.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_xlnet.py b/PyTorch/LanguageModeling/BART/bart/tokenization/tokenization_xlnet.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/configs/config.json b/PyTorch/LanguageModeling/BART/configs/config.json old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/configs/config_hf.json b/PyTorch/LanguageModeling/BART/configs/config_hf.json old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/configs/config_hf_xsum.json b/PyTorch/LanguageModeling/BART/configs/config_hf_xsum.json old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/configs/config_xsum.json b/PyTorch/LanguageModeling/BART/configs/config_xsum.json old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/finetune.py b/PyTorch/LanguageModeling/BART/finetune.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/run_eval.py b/PyTorch/LanguageModeling/BART/run_eval.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/docker/build.sh b/PyTorch/LanguageModeling/BART/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/docker/launch.sh b/PyTorch/LanguageModeling/BART/scripts/docker/launch.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/get_data.sh b/PyTorch/LanguageModeling/BART/scripts/get_data.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/get_pretraining_data.sh b/PyTorch/LanguageModeling/BART/scripts/get_pretraining_data.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/params/cnn_dm_params.sh b/PyTorch/LanguageModeling/BART/scripts/params/cnn_dm_params.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/params/xsum_params.sh b/PyTorch/LanguageModeling/BART/scripts/params/xsum_params.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/preprocess_pretrain_data.sh b/PyTorch/LanguageModeling/BART/scripts/preprocess_pretrain_data.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/run_eval_summarization.sh b/PyTorch/LanguageModeling/BART/scripts/run_eval_summarization.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/run_inference_benchmark.sh b/PyTorch/LanguageModeling/BART/scripts/run_inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/run_summarization.sh b/PyTorch/LanguageModeling/BART/scripts/run_summarization.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/scripts/run_training_benchmark.sh b/PyTorch/LanguageModeling/BART/scripts/run_training_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/training_base.py b/PyTorch/LanguageModeling/BART/training_base.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/__init__.py b/PyTorch/LanguageModeling/BART/utils/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/activations.py b/PyTorch/LanguageModeling/BART/utils/activations.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/callbacks.py b/PyTorch/LanguageModeling/BART/utils/callbacks.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/data_utils.py b/PyTorch/LanguageModeling/BART/utils/data_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/distributed_utils.py b/PyTorch/LanguageModeling/BART/utils/distributed_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/file_utils.py b/PyTorch/LanguageModeling/BART/utils/file_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/generation_utils.py b/PyTorch/LanguageModeling/BART/utils/generation_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/gpu_affinity.py b/PyTorch/LanguageModeling/BART/utils/gpu_affinity.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/logging.py b/PyTorch/LanguageModeling/BART/utils/logging.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/optimization.py b/PyTorch/LanguageModeling/BART/utils/optimization.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BART/utils/utils.py b/PyTorch/LanguageModeling/BART/utils/utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/Dockerfile b/PyTorch/LanguageModeling/BERT/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/NOTICE b/PyTorch/LanguageModeling/BERT/NOTICE old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/README.md b/PyTorch/LanguageModeling/BERT/README.md old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/bind.sh b/PyTorch/LanguageModeling/BERT/bind.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/bind_pyt.py b/PyTorch/LanguageModeling/BERT/bind_pyt.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/checkpoints/.keep b/PyTorch/LanguageModeling/BERT/checkpoints/.keep deleted file mode 100644 index 8b1378917..000000000 --- a/PyTorch/LanguageModeling/BERT/checkpoints/.keep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/PyTorch/LanguageModeling/BERT/create_pretraining_data.py b/PyTorch/LanguageModeling/BERT/create_pretraining_data.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/data/create_datasets_from_start.sh b/PyTorch/LanguageModeling/BERT/data/create_datasets_from_start.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/data/squad/squad_download.sh b/PyTorch/LanguageModeling/BERT/data/squad/squad_download.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/distillation/run_e2e_distillation.sh b/PyTorch/LanguageModeling/BERT/distillation/run_e2e_distillation.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/distillation/utils/utils.py b/PyTorch/LanguageModeling/BERT/distillation/utils/utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/extract_features.py b/PyTorch/LanguageModeling/BERT/extract_features.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/file_utils.py b/PyTorch/LanguageModeling/BERT/file_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/modeling.py b/PyTorch/LanguageModeling/BERT/modeling.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/optimization.py b/PyTorch/LanguageModeling/BERT/optimization.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/requirements.txt b/PyTorch/LanguageModeling/BERT/requirements.txt old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/results/.keep b/PyTorch/LanguageModeling/BERT/results/.keep deleted file mode 100755 index e69de29bb..000000000 diff --git a/PyTorch/LanguageModeling/BERT/run_glue.py b/PyTorch/LanguageModeling/BERT/run_glue.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/run_pretraining.py b/PyTorch/LanguageModeling/BERT/run_pretraining.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/run_squad.py b/PyTorch/LanguageModeling/BERT/run_squad.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/run_swag.py b/PyTorch/LanguageModeling/BERT/run_swag.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/schedulers.py b/PyTorch/LanguageModeling/BERT/schedulers.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/scripts/data_download.sh b/PyTorch/LanguageModeling/BERT/scripts/data_download.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/scripts/run_glue.sh b/PyTorch/LanguageModeling/BERT/scripts/run_glue.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/scripts/run_squad.sh b/PyTorch/LanguageModeling/BERT/scripts/run_squad.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/scripts/run_swag.sh b/PyTorch/LanguageModeling/BERT/scripts/run_swag.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/tokenization.py b/PyTorch/LanguageModeling/BERT/tokenization.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/calculate_metrics.py b/PyTorch/LanguageModeling/BERT/triton/calculate_metrics.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/pipeline_impl.py b/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/prepare_datasets.sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/prepare_datasets.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/start_NVIDIA-A30.sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/start_NVIDIA-A30.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/start_NVIDIA-T4.sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/runner/start_NVIDIA-T4.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/docker/build.sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/docker/interactive.sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/docker/triton_inference_server.sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/setup_environment.sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/setup_parameters.sh b/PyTorch/LanguageModeling/BERT/triton/dist4l/scripts/setup_parameters.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/pipeline_impl.py b/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/prepare_datasets.sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/prepare_datasets.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/start_NVIDIA-A30.sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/start_NVIDIA-A30.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/start_NVIDIA-T4.sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/runner/start_NVIDIA-T4.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/docker/build.sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/docker/interactive.sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/docker/triton_inference_server.sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/setup_environment.sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/setup_parameters.sh b/PyTorch/LanguageModeling/BERT/triton/dist6l/scripts/setup_parameters.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/export_model.py b/PyTorch/LanguageModeling/BERT/triton/export_model.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/runner/pipeline_impl.py b/PyTorch/LanguageModeling/BERT/triton/large/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/runner/prepare_datasets.sh b/PyTorch/LanguageModeling/BERT/triton/large/runner/prepare_datasets.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/runner/start_NVIDIA-A30.sh b/PyTorch/LanguageModeling/BERT/triton/large/runner/start_NVIDIA-A30.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/PyTorch/LanguageModeling/BERT/triton/large/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/PyTorch/LanguageModeling/BERT/triton/large/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/runner/start_NVIDIA-T4.sh b/PyTorch/LanguageModeling/BERT/triton/large/runner/start_NVIDIA-T4.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/scripts/docker/build.sh b/PyTorch/LanguageModeling/BERT/triton/large/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/scripts/docker/interactive.sh b/PyTorch/LanguageModeling/BERT/triton/large/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/scripts/docker/triton_inference_server.sh b/PyTorch/LanguageModeling/BERT/triton/large/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/scripts/setup_environment.sh b/PyTorch/LanguageModeling/BERT/triton/large/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/large/scripts/setup_parameters.sh b/PyTorch/LanguageModeling/BERT/triton/large/scripts/setup_parameters.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/run_inference_on_fw.py b/PyTorch/LanguageModeling/BERT/triton/run_inference_on_fw.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/run_inference_on_triton.py b/PyTorch/LanguageModeling/BERT/triton/run_inference_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/run_performance_on_triton.py b/PyTorch/LanguageModeling/BERT/triton/run_performance_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/triton/runner/downloader.py b/PyTorch/LanguageModeling/BERT/triton/runner/downloader.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/BERT/utils.py b/PyTorch/LanguageModeling/BERT/utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/getdata.sh b/PyTorch/LanguageModeling/Transformer-XL/getdata.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_enwik8_base.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_enwik8_base.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_enwik8_large.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_enwik8_large.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_lm1b_base.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_lm1b_base.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_lm1b_large.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_lm1b_large.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_text8_base.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_text8_base.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_text8_large.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_text8_large.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_wt103_base.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_wt103_base.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_wt103_large.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/run_wt103_large.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/docker/build.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/docker/interactive.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/inference_benchmark.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/infer_bench.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/infer_bench.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/train_bench.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/train_bench.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/train_full.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/train_full.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/train_long.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/train_long.sh old mode 100755 new mode 100644 diff --git a/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/train_short.sh b/PyTorch/LanguageModeling/Transformer-XL/pytorch/scripts/tests/train_short.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Recommendation/DLRM/dlrm/cuda_ext/__init__.py b/PyTorch/Recommendation/DLRM/dlrm/cuda_ext/__init__.py index cc31f23c5..bcc211492 100644 --- a/PyTorch/Recommendation/DLRM/dlrm/cuda_ext/__init__.py +++ b/PyTorch/Recommendation/DLRM/dlrm/cuda_ext/__init__.py @@ -1,3 +1,3 @@ -from .dot_based_interact import dotBasedInteract -from .fused_gather_embedding import buckle_embedding_fused_gather -from .sparse_embedding import JointSparseEmbedding +from .dot_based_interact import dotBasedInteract +from .fused_gather_embedding import buckle_embedding_fused_gather +from .sparse_embedding import JointSparseEmbedding diff --git a/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/common.h b/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/common.h index d95fdd36a..274c439e2 100644 --- a/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/common.h +++ b/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/common.h @@ -1,21 +1,21 @@ -// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. - -#ifndef COMMON_H_ -#define COMMON_H_ - -using ULLInt = unsigned long long int; - -// Use to compute things like number of blocks -#define CEIL_DIV_INT(a, b) ((a + b - 1) / b) - -#define CUDA_CHECK(cmd) \ - do { \ - cudaError_t e = cmd; \ - if (e != cudaSuccess) { \ - printf("Failed: Cuda error %s:%d '%s'\n", __FILE__, __LINE__, cudaGetErrorString(e)); \ - exit(EXIT_FAILURE); \ - } \ - } while (0) - - -#endif // COMMON_H_ +// Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + +#ifndef COMMON_H_ +#define COMMON_H_ + +using ULLInt = unsigned long long int; + +// Use to compute things like number of blocks +#define CEIL_DIV_INT(a, b) ((a + b - 1) / b) + +#define CUDA_CHECK(cmd) \ + do { \ + cudaError_t e = cmd; \ + if (e != cudaSuccess) { \ + printf("Failed: Cuda error %s:%d '%s'\n", __FILE__, __LINE__, cudaGetErrorString(e)); \ + exit(EXIT_FAILURE); \ + } \ + } while (0) + + +#endif // COMMON_H_ diff --git a/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/gather_gpu.cu b/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/gather_gpu.cu index ec564bcec..1184d68e2 100644 --- a/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/gather_gpu.cu +++ b/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/gather_gpu.cu @@ -1,171 +1,171 @@ -#include -#include -#include -#include - -#include -#include - -#include -#include - -// For simplicity reason, boundry checks are removed -// All the kernels MUST be launched with grid size = batch size and block size = embedding size - -__global__ void GatherKernel(const float* params, - int64_t num_features, - int embed_size, - int batch_size, - int query_nnz, - const int64_t* indices, - float* ret) { - int tid = threadIdx.x, bid = blockIdx.x; - - extern __shared__ int shmem_indices[]; - - // each CTA load one row of indices in the mini batch into shared memory - for (int i = tid; i < query_nnz; i += blockDim.x) { - shmem_indices[i] = indices[query_nnz * bid + i]; - } - __syncthreads(); - -#pragma unroll - for (int i = 0; i < query_nnz; ++i) { - // printf("%d, %d, %d\n", bid, i, shmem_indices[i]); - ret[(bid * query_nnz + i) * embed_size + tid] = - params[(int64_t)shmem_indices[i] * embed_size + tid]; - } -} - -__global__ void OneHotKernel(const float* params, - int64_t num_features, - int embed_size, - int batch_size, - const int64_t* indices, - float* ret) { - int tid = threadIdx.x, bid = blockIdx.x; - - ret[bid * embed_size + tid] = params[(int64_t)indices[bid] * embed_size + tid]; -} - -// grads is used to update params directly by atomic instead of forming wgrad -// Only SGD without momentum and without weight decay is supported -__global__ void GatherBackwardFuseSgdKernel(const float* grads, - int64_t num_features, - int embed_size, - int batch_size, - int query_nnz, - const int64_t* indices, - float lr, - float* params) { - int tid = threadIdx.x, bid = blockIdx.x; - - extern __shared__ int shmem_indices[]; - - for (int i = tid; i < query_nnz; i += blockDim.x) { - shmem_indices[i] = indices[query_nnz * bid + i]; - } - __syncthreads(); - -#pragma unroll - for (int i = 0; i < query_nnz; ++i) { - atomicAdd(¶ms[(int64_t)shmem_indices[i] * embed_size + tid], - -lr * grads[(bid * query_nnz + i) * embed_size + tid]); - } -} - -// Keep the interface and argument name as torch.embedding() -// input is indices, and weight is embedding table -torch::Tensor gather_gpu_fwd(const torch::Tensor weight, const torch::Tensor indices) { - AT_ASSERT(indices.is_cuda()); - AT_ASSERT(weight.is_cuda()); - AT_ASSERT(indices.scalar_type() == torch::ScalarType::Long); - AT_ASSERT(weight.scalar_type() == torch::ScalarType::Float); - AT_ASSERT(weight.is_contiguous()); - - int batch_size = indices.size(0); - int query_nnz = 1; - if (indices.dim() > 1) { - query_nnz = indices.size(1); - } - - // Shared memory size limit. Larger nnz can also be supported by skipping shared memory if necessary - TORCH_CHECK(query_nnz <= 12288, "Embedding width must be smaller than 48k"); - - int num_features = weight.size(0); - int embed_size = weight.size(1); - - // Block dimension limit. Large than 1024 width can be easily supported by letting each block read - // from different strides if necessary. - TORCH_CHECK(embed_size <= 1024, "Embedding width must be smaller than 1024"); - - auto outputs = - torch::empty(batch_size * query_nnz * embed_size, at::device(at::kCUDA).dtype(at::kFloat)); - - if (query_nnz != 1) { - GatherKernel<<>>(weight.data_ptr(), - num_features, - embed_size, - batch_size, - query_nnz, - indices.contiguous().data_ptr(), - outputs.data_ptr()); - } else { - OneHotKernel<<>>( - weight.data_ptr(), - num_features, - embed_size, - batch_size, - indices.contiguous().data_ptr(), - outputs.data_ptr()); - } - - return outputs.reshape({batch_size, query_nnz, embed_size}); -} - -// Because complication of handling sparse tensor, use the native backward function is still faster -// TODO(haow): Figure out a way to write out sparse tensor directly to avoid addintional copy which makes -// customized implementation slower than Pytorch's own desipte kernels are more efficient -torch::Tensor gather_gpu_bwd(const torch::Tensor grad, - const torch::Tensor indices, - const int num_features) { - return at::embedding_sparse_backward(grad, indices, num_features, /*padding_idx=*/-1, /*scale_grad_by_freq=*/false); -} - -// Backward gather with fused plain SGD (no weight decay nor momentum) -void gather_gpu_bwd_fuse_sgd(const torch::Tensor grad, - const torch::Tensor indices, - float lr, - torch::Tensor weight) { - AT_ASSERT(grad.is_cuda()); - AT_ASSERT(indices.is_cuda()); - AT_ASSERT(weight.is_cuda()); - AT_ASSERT(grad.scalar_type() == torch::ScalarType::Float); - AT_ASSERT(indices.scalar_type() == torch::ScalarType::Long); - AT_ASSERT(weight.scalar_type() == torch::ScalarType::Float); - AT_ASSERT(weight.is_contiguous()); - - int batch_size = indices.size(0); - int query_nnz = 1; - if (indices.dim() > 1) { - query_nnz = indices.size(1); - } - int num_features = weight.size(0); - int embed_size = weight.size(1); - - GatherBackwardFuseSgdKernel<<>>( - grad.contiguous().data_ptr(), - num_features, - embed_size, - batch_size, - query_nnz, - indices.contiguous().data_ptr(), - lr, - weight.data_ptr()); -} +#include +#include +#include +#include + +#include +#include + +#include +#include + +// For simplicity reason, boundry checks are removed +// All the kernels MUST be launched with grid size = batch size and block size = embedding size + +__global__ void GatherKernel(const float* params, + int64_t num_features, + int embed_size, + int batch_size, + int query_nnz, + const int64_t* indices, + float* ret) { + int tid = threadIdx.x, bid = blockIdx.x; + + extern __shared__ int shmem_indices[]; + + // each CTA load one row of indices in the mini batch into shared memory + for (int i = tid; i < query_nnz; i += blockDim.x) { + shmem_indices[i] = indices[query_nnz * bid + i]; + } + __syncthreads(); + +#pragma unroll + for (int i = 0; i < query_nnz; ++i) { + // printf("%d, %d, %d\n", bid, i, shmem_indices[i]); + ret[(bid * query_nnz + i) * embed_size + tid] = + params[(int64_t)shmem_indices[i] * embed_size + tid]; + } +} + +__global__ void OneHotKernel(const float* params, + int64_t num_features, + int embed_size, + int batch_size, + const int64_t* indices, + float* ret) { + int tid = threadIdx.x, bid = blockIdx.x; + + ret[bid * embed_size + tid] = params[(int64_t)indices[bid] * embed_size + tid]; +} + +// grads is used to update params directly by atomic instead of forming wgrad +// Only SGD without momentum and without weight decay is supported +__global__ void GatherBackwardFuseSgdKernel(const float* grads, + int64_t num_features, + int embed_size, + int batch_size, + int query_nnz, + const int64_t* indices, + float lr, + float* params) { + int tid = threadIdx.x, bid = blockIdx.x; + + extern __shared__ int shmem_indices[]; + + for (int i = tid; i < query_nnz; i += blockDim.x) { + shmem_indices[i] = indices[query_nnz * bid + i]; + } + __syncthreads(); + +#pragma unroll + for (int i = 0; i < query_nnz; ++i) { + atomicAdd(¶ms[(int64_t)shmem_indices[i] * embed_size + tid], + -lr * grads[(bid * query_nnz + i) * embed_size + tid]); + } +} + +// Keep the interface and argument name as torch.embedding() +// input is indices, and weight is embedding table +torch::Tensor gather_gpu_fwd(const torch::Tensor weight, const torch::Tensor indices) { + AT_ASSERT(indices.is_cuda()); + AT_ASSERT(weight.is_cuda()); + AT_ASSERT(indices.scalar_type() == torch::ScalarType::Long); + AT_ASSERT(weight.scalar_type() == torch::ScalarType::Float); + AT_ASSERT(weight.is_contiguous()); + + int batch_size = indices.size(0); + int query_nnz = 1; + if (indices.dim() > 1) { + query_nnz = indices.size(1); + } + + // Shared memory size limit. Larger nnz can also be supported by skipping shared memory if necessary + TORCH_CHECK(query_nnz <= 12288, "Embedding width must be smaller than 48k"); + + int num_features = weight.size(0); + int embed_size = weight.size(1); + + // Block dimension limit. Large than 1024 width can be easily supported by letting each block read + // from different strides if necessary. + TORCH_CHECK(embed_size <= 1024, "Embedding width must be smaller than 1024"); + + auto outputs = + torch::empty(batch_size * query_nnz * embed_size, at::device(at::kCUDA).dtype(at::kFloat)); + + if (query_nnz != 1) { + GatherKernel<<>>(weight.data_ptr(), + num_features, + embed_size, + batch_size, + query_nnz, + indices.contiguous().data_ptr(), + outputs.data_ptr()); + } else { + OneHotKernel<<>>( + weight.data_ptr(), + num_features, + embed_size, + batch_size, + indices.contiguous().data_ptr(), + outputs.data_ptr()); + } + + return outputs.reshape({batch_size, query_nnz, embed_size}); +} + +// Because complication of handling sparse tensor, use the native backward function is still faster +// TODO(haow): Figure out a way to write out sparse tensor directly to avoid addintional copy which makes +// customized implementation slower than Pytorch's own desipte kernels are more efficient +torch::Tensor gather_gpu_bwd(const torch::Tensor grad, + const torch::Tensor indices, + const int num_features) { + return at::embedding_sparse_backward(grad, indices, num_features, /*padding_idx=*/-1, /*scale_grad_by_freq=*/false); +} + +// Backward gather with fused plain SGD (no weight decay nor momentum) +void gather_gpu_bwd_fuse_sgd(const torch::Tensor grad, + const torch::Tensor indices, + float lr, + torch::Tensor weight) { + AT_ASSERT(grad.is_cuda()); + AT_ASSERT(indices.is_cuda()); + AT_ASSERT(weight.is_cuda()); + AT_ASSERT(grad.scalar_type() == torch::ScalarType::Float); + AT_ASSERT(indices.scalar_type() == torch::ScalarType::Long); + AT_ASSERT(weight.scalar_type() == torch::ScalarType::Float); + AT_ASSERT(weight.is_contiguous()); + + int batch_size = indices.size(0); + int query_nnz = 1; + if (indices.dim() > 1) { + query_nnz = indices.size(1); + } + int num_features = weight.size(0); + int embed_size = weight.size(1); + + GatherBackwardFuseSgdKernel<<>>( + grad.contiguous().data_ptr(), + num_features, + embed_size, + batch_size, + query_nnz, + indices.contiguous().data_ptr(), + lr, + weight.data_ptr()); +} diff --git a/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/sparse_pytorch_ops.cpp b/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/sparse_pytorch_ops.cpp index 55fa87569..0189f2ff0 100644 --- a/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/sparse_pytorch_ops.cpp +++ b/PyTorch/Recommendation/DLRM/dlrm/cuda_src/sparse_gather/sparse_pytorch_ops.cpp @@ -1,14 +1,14 @@ -#include - -torch::Tensor gather_gpu_fwd(torch::Tensor input, torch::Tensor weight); -void gather_gpu_bwd_fuse_sgd(const torch::Tensor grad, const torch::Tensor indices, float lr, torch::Tensor weight); -torch::Tensor gather_gpu_bwd(const torch::Tensor grad, const torch::Tensor indices, const int num_features); - - -PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { - m.def("gather_gpu_fwd", &gather_gpu_fwd, "Embedding gather", py::arg("indices"), py::arg("weight")); - m.def("gather_gpu_bwd_fuse_sgd", &gather_gpu_bwd_fuse_sgd, "Embedding gather backward with fused plain SGD", - py::arg("grad"), py::arg("indices"), py::arg("lr"), py::arg("weight")); - m.def("gather_gpu_bwd", &gather_gpu_bwd, "Embedding gather backward", - py::arg("grad"), py::arg("indices"), py::arg("num_features")); -} +#include + +torch::Tensor gather_gpu_fwd(torch::Tensor input, torch::Tensor weight); +void gather_gpu_bwd_fuse_sgd(const torch::Tensor grad, const torch::Tensor indices, float lr, torch::Tensor weight); +torch::Tensor gather_gpu_bwd(const torch::Tensor grad, const torch::Tensor indices, const int num_features); + + +PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { + m.def("gather_gpu_fwd", &gather_gpu_fwd, "Embedding gather", py::arg("indices"), py::arg("weight")); + m.def("gather_gpu_bwd_fuse_sgd", &gather_gpu_bwd_fuse_sgd, "Embedding gather backward with fused plain SGD", + py::arg("grad"), py::arg("indices"), py::arg("lr"), py::arg("weight")); + m.def("gather_gpu_bwd", &gather_gpu_bwd, "Embedding gather backward", + py::arg("grad"), py::arg("indices"), py::arg("num_features")); +} diff --git a/PyTorch/Recommendation/DLRM/img/learning_curve_FL15.svg b/PyTorch/Recommendation/DLRM/img/learning_curve_FL15.svg index 288b1541c..cebbaa68c 100644 --- a/PyTorch/Recommendation/DLRM/img/learning_curve_FL15.svg +++ b/PyTorch/Recommendation/DLRM/img/learning_curve_FL15.svg @@ -1,1695 +1,1695 @@ - - - - - - - - - 2021-05-28T14:41:18.314293 - image/svg+xml - - - Matplotlib v3.3.4, https://matplotlib.org/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + 2021-05-28T14:41:18.314293 + image/svg+xml + + + Matplotlib v3.3.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PyTorch/Recommendation/DLRM/img/learning_curve_FL3.svg b/PyTorch/Recommendation/DLRM/img/learning_curve_FL3.svg index 58a971379..8058c4f56 100644 --- a/PyTorch/Recommendation/DLRM/img/learning_curve_FL3.svg +++ b/PyTorch/Recommendation/DLRM/img/learning_curve_FL3.svg @@ -1,1891 +1,1891 @@ - - - - - - - - - 2021-06-08T23:29:09.398505 - image/svg+xml - - - Matplotlib v3.3.4, https://matplotlib.org/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + 2021-06-08T23:29:09.398505 + image/svg+xml + + + Matplotlib v3.3.4, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PyTorch/Recommendation/DLRM/preproc/run_spark.sh b/PyTorch/Recommendation/DLRM/preproc/run_spark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Recommendation/DLRM/preproc/run_spark_cpu.sh b/PyTorch/Recommendation/DLRM/preproc/run_spark_cpu.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Recommendation/DLRM/preproc/verify_criteo_downloaded.sh b/PyTorch/Recommendation/DLRM/preproc/verify_criteo_downloaded.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Recommendation/NCF/prepare_dataset.sh b/PyTorch/Recommendation/NCF/prepare_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Recommendation/NCF/verify_dataset.sh b/PyTorch/Recommendation/NCF/verify_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/README.md b/PyTorch/Segmentation/MaskRCNN/README.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/download_dataset.sh b/PyTorch/Segmentation/MaskRCNN/download_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/download_weights.sh b/PyTorch/Segmentation/MaskRCNN/download_weights.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/hashes.md5 b/PyTorch/Segmentation/MaskRCNN/hashes.md5 old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/ABSTRACTIONS.md b/PyTorch/Segmentation/MaskRCNN/pytorch/ABSTRACTIONS.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/CODE_OF_CONDUCT.md b/PyTorch/Segmentation/MaskRCNN/pytorch/CODE_OF_CONDUCT.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/CONTRIBUTING.md b/PyTorch/Segmentation/MaskRCNN/pytorch/CONTRIBUTING.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/Dockerfile b/PyTorch/Segmentation/MaskRCNN/pytorch/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/INSTALL.md b/PyTorch/Segmentation/MaskRCNN/pytorch/INSTALL.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/LICENSE b/PyTorch/Segmentation/MaskRCNN/pytorch/LICENSE old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/MODEL_ZOO.md b/PyTorch/Segmentation/MaskRCNN/pytorch/MODEL_ZOO.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/TROUBLESHOOTING.md b/PyTorch/Segmentation/MaskRCNN/pytorch/TROUBLESHOOTING.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_faster_rcnn_R_101_FPN_1x_caffe2.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_faster_rcnn_R_101_FPN_1x_caffe2.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_faster_rcnn_R_50_C4_1x_caffe2.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_faster_rcnn_R_50_C4_1x_caffe2.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_faster_rcnn_R_50_FPN_1x_caffe2.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_faster_rcnn_R_50_FPN_1x_caffe2.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_faster_rcnn_X_101_32x8d_FPN_1x_caffe2.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_faster_rcnn_X_101_32x8d_FPN_1x_caffe2.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_mask_rcnn_R_101_FPN_1x_caffe2.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_mask_rcnn_R_101_FPN_1x_caffe2.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_mask_rcnn_R_50_C4_1x_caffe2.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_mask_rcnn_R_50_C4_1x_caffe2.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_mask_rcnn_X_101_32x8d_FPN_1x_caffe2.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/caffe2/e2e_mask_rcnn_X_101_32x8d_FPN_1x_caffe2.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/ci/e2e_mask_rcnn_R_50_FPN_1x.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/ci/e2e_mask_rcnn_R_50_FPN_1x.yaml index 1ed8b60e2..289f3f31e 100644 --- a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/ci/e2e_mask_rcnn_R_50_FPN_1x.yaml +++ b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/ci/e2e_mask_rcnn_R_50_FPN_1x.yaml @@ -1,49 +1,49 @@ -MODEL: - META_ARCHITECTURE: "GeneralizedRCNN" - WEIGHT: "/data3/joc_checkpoints/pytorch/maskrcnn/R-50.pkl" - BACKBONE: - CONV_BODY: "R-50-FPN" - OUT_CHANNELS: 256 - RPN: - USE_FPN: True - ANCHOR_STRIDE: (4, 8, 16, 32, 64) - PRE_NMS_TOP_N_TRAIN: 2000 - PRE_NMS_TOP_N_TEST: 1000 - POST_NMS_TOP_N_TEST: 1000 - FPN_POST_NMS_TOP_N_TEST: 1000 - FPN_POST_NMS_TOP_N_TRAIN: 12000 - ROI_HEADS: - USE_FPN: True - ROI_BOX_HEAD: - POOLER_RESOLUTION: 7 - POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125) - POOLER_SAMPLING_RATIO: 2 - FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor" - PREDICTOR: "FPNPredictor" - ROI_MASK_HEAD: - POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125) - FEATURE_EXTRACTOR: "MaskRCNNFPNFeatureExtractor" - PREDICTOR: "MaskRCNNC4Predictor" - POOLER_RESOLUTION: 14 - POOLER_SAMPLING_RATIO: 2 - RESOLUTION: 28 - SHARE_BOX_FEATURE_EXTRACTOR: False - MASK_ON: True -DATASETS: - TRAIN: ("coco_2017_train",) - TEST: ("coco_2017_val",) -DATALOADER: - SIZE_DIVISIBILITY: 32 -SOLVER: - BASE_LR: 0.12 - WEIGHT_DECAY: 0.0001 - STEPS: (12000, 16000) - MAX_ITER: 16667 - IMS_PER_BATCH: 96 - WARMUP_FACTOR: 0.0001 - WARMUP_ITERS: 800 - WARMUP_METHOD: "mlperf_linear" -TEST: - IMS_PER_BATCH: 8 -PATHS_CATALOG: "maskrcnn_benchmark/config/paths_catalog_ci.py" -OUTPUT_DIR: "." +MODEL: + META_ARCHITECTURE: "GeneralizedRCNN" + WEIGHT: "/data3/joc_checkpoints/pytorch/maskrcnn/R-50.pkl" + BACKBONE: + CONV_BODY: "R-50-FPN" + OUT_CHANNELS: 256 + RPN: + USE_FPN: True + ANCHOR_STRIDE: (4, 8, 16, 32, 64) + PRE_NMS_TOP_N_TRAIN: 2000 + PRE_NMS_TOP_N_TEST: 1000 + POST_NMS_TOP_N_TEST: 1000 + FPN_POST_NMS_TOP_N_TEST: 1000 + FPN_POST_NMS_TOP_N_TRAIN: 12000 + ROI_HEADS: + USE_FPN: True + ROI_BOX_HEAD: + POOLER_RESOLUTION: 7 + POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125) + POOLER_SAMPLING_RATIO: 2 + FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor" + PREDICTOR: "FPNPredictor" + ROI_MASK_HEAD: + POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125) + FEATURE_EXTRACTOR: "MaskRCNNFPNFeatureExtractor" + PREDICTOR: "MaskRCNNC4Predictor" + POOLER_RESOLUTION: 14 + POOLER_SAMPLING_RATIO: 2 + RESOLUTION: 28 + SHARE_BOX_FEATURE_EXTRACTOR: False + MASK_ON: True +DATASETS: + TRAIN: ("coco_2017_train",) + TEST: ("coco_2017_val",) +DATALOADER: + SIZE_DIVISIBILITY: 32 +SOLVER: + BASE_LR: 0.12 + WEIGHT_DECAY: 0.0001 + STEPS: (12000, 16000) + MAX_ITER: 16667 + IMS_PER_BATCH: 96 + WARMUP_FACTOR: 0.0001 + WARMUP_ITERS: 800 + WARMUP_METHOD: "mlperf_linear" +TEST: + IMS_PER_BATCH: 8 +PATHS_CATALOG: "maskrcnn_benchmark/config/paths_catalog_ci.py" +OUTPUT_DIR: "." diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/cityscapes/e2e_faster_rcnn_R_50_FPN_1x_cocostyle.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/cityscapes/e2e_faster_rcnn_R_50_FPN_1x_cocostyle.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/cityscapes/e2e_mask_rcnn_R_50_FPN_1x_cocostyle.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/cityscapes/e2e_mask_rcnn_R_50_FPN_1x_cocostyle.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_faster_rcnn_R_101_FPN_1x.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_faster_rcnn_R_101_FPN_1x.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_faster_rcnn_R_50_C4_1x.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_faster_rcnn_R_50_C4_1x.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_faster_rcnn_R_50_FPN_1x.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_faster_rcnn_R_50_FPN_1x.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_faster_rcnn_X_101_32x8d_FPN_1x.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_faster_rcnn_X_101_32x8d_FPN_1x.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_mask_rcnn_R_101_FPN_1x.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_mask_rcnn_R_101_FPN_1x.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_mask_rcnn_R_50_C4_1x.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_mask_rcnn_R_50_C4_1x.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_mask_rcnn_R_50_FPN_1x_bs32.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_mask_rcnn_R_50_FPN_1x_bs32.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_mask_rcnn_X_101_32x8d_FPN_1x.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/e2e_mask_rcnn_X_101_32x8d_FPN_1x.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/e2e_faster_rcnn_R_50_FPN_1x_gn.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/e2e_faster_rcnn_R_50_FPN_1x_gn.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/e2e_faster_rcnn_R_50_FPN_Xconv1fc_1x_gn.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/e2e_faster_rcnn_R_50_FPN_Xconv1fc_1x_gn.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/e2e_mask_rcnn_R_50_FPN_1x_gn.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/e2e_mask_rcnn_R_50_FPN_1x_gn.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/e2e_mask_rcnn_R_50_FPN_Xconv1fc_1x_gn.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/e2e_mask_rcnn_R_50_FPN_Xconv1fc_1x_gn.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/scratch_e2e_faster_rcnn_R_50_FPN_3x_gn.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/scratch_e2e_faster_rcnn_R_50_FPN_3x_gn.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/scratch_e2e_faster_rcnn_R_50_FPN_Xconv1fc_3x_gn.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/scratch_e2e_faster_rcnn_R_50_FPN_Xconv1fc_3x_gn.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/scratch_e2e_mask_rcnn_R_50_FPN_3x_gn.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/scratch_e2e_mask_rcnn_R_50_FPN_3x_gn.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/scratch_e2e_mask_rcnn_R_50_FPN_Xconv1fc_3x_gn.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/gn_baselines/scratch_e2e_mask_rcnn_R_50_FPN_Xconv1fc_3x_gn.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/pascal_voc/e2e_faster_rcnn_R_50_C4_1x_1_gpu_voc.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/pascal_voc/e2e_faster_rcnn_R_50_C4_1x_1_gpu_voc.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/pascal_voc/e2e_faster_rcnn_R_50_C4_1x_4_gpu_voc.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/pascal_voc/e2e_faster_rcnn_R_50_C4_1x_4_gpu_voc.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/pascal_voc/e2e_mask_rcnn_R_50_FPN_1x_cocostyle.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/pascal_voc/e2e_mask_rcnn_R_50_FPN_1x_cocostyle.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_faster_rcnn_R_50_C4_quick.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_faster_rcnn_R_50_C4_quick.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_faster_rcnn_R_50_FPN_quick.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_faster_rcnn_R_50_FPN_quick.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_faster_rcnn_X_101_32x8d_FPN_quick.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_faster_rcnn_X_101_32x8d_FPN_quick.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_mask_rcnn_R_50_C4_quick.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_mask_rcnn_R_50_C4_quick.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_mask_rcnn_R_50_FPN_quick.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_mask_rcnn_R_50_FPN_quick.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_mask_rcnn_X_101_32x8d_FPN_quick.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/e2e_mask_rcnn_X_101_32x8d_FPN_quick.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/rpn_R_50_C4_quick.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/rpn_R_50_C4_quick.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/rpn_R_50_FPN_quick.yaml b/PyTorch/Segmentation/MaskRCNN/pytorch/configs/quick_schedules/rpn_R_50_FPN_quick.yaml old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/demo/Mask_R-CNN_demo.ipynb b/PyTorch/Segmentation/MaskRCNN/pytorch/demo/Mask_R-CNN_demo.ipynb old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/demo/README.md b/PyTorch/Segmentation/MaskRCNN/pytorch/demo/README.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/demo/demo_e2e_mask_rcnn_R_50_FPN_1x.png b/PyTorch/Segmentation/MaskRCNN/pytorch/demo/demo_e2e_mask_rcnn_R_50_FPN_1x.png old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/demo/demo_e2e_mask_rcnn_X_101_32x8d_FPN_1x.png b/PyTorch/Segmentation/MaskRCNN/pytorch/demo/demo_e2e_mask_rcnn_X_101_32x8d_FPN_1x.png old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/demo/predictor.py b/PyTorch/Segmentation/MaskRCNN/pytorch/demo/predictor.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/demo/webcam.py b/PyTorch/Segmentation/MaskRCNN/pytorch/demo/webcam.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/docker/Dockerfile b/PyTorch/Segmentation/MaskRCNN/pytorch/docker/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/docker/docker-jupyter/Dockerfile b/PyTorch/Segmentation/MaskRCNN/pytorch/docker/docker-jupyter/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/docker/docker-jupyter/jupyter_notebook_config.py b/PyTorch/Segmentation/MaskRCNN/pytorch/docker/docker-jupyter/jupyter_notebook_config.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/defaults.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/defaults.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/paths_catalog.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/config/paths_catalog.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/ROIAlign.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/ROIAlign.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/ROIPool.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/ROIPool.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/box_encode.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/box_encode.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/box_iou.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/box_iou.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cpu/ROIAlign_cpu.cpp b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cpu/ROIAlign_cpu.cpp old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cpu/nms_cpu.cpp b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cpu/nms_cpu.cpp old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cpu/vision.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cpu/vision.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/ROIAlign_cuda.cu b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/ROIAlign_cuda.cu old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/ROIPool_cuda.cu old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/box_encode.cu b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/box_encode.cu old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/box_iou.cu b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/box_iou.cu old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/generate_mask_targets.cu b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/generate_mask_targets.cu old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/match_proposals.cu b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/match_proposals.cu old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/nms.cu b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/nms.cu old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/rpn_generate_proposals.cu b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/rpn_generate_proposals.cu old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/rpn_generate_proposals.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/rpn_generate_proposals.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/vision.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/cuda/vision.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/generate_mask_targets.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/generate_mask_targets.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/match_proposals.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/match_proposals.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/nms.h b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/nms.h old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/vision.cpp b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/csrc/vision.cpp old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/README.md b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/README.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/build.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/build.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/collate_batch.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/collate_batch.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/coco.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/coco.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/concat_dataset.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/concat_dataset.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/coco/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/coco/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/coco/coco_eval.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/evaluation/voc/voc_eval.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/list_dataset.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/list_dataset.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/voc.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/datasets/voc.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/samplers/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/samplers/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/samplers/distributed.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/samplers/distributed.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/samplers/grouped_batch_sampler.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/samplers/grouped_batch_sampler.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/samplers/iteration_based_batch_sampler.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/samplers/iteration_based_batch_sampler.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/transforms/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/transforms/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/transforms/build.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/transforms/build.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/transforms/transforms.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/data/transforms/transforms.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/engine/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/engine/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/engine/inference.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/engine/inference.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/engine/trainer.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/engine/trainer.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/_utils.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/_utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/batch_norm.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/batch_norm.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/misc.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/misc.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/nms.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/nms.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/roi_align.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/roi_align.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/roi_pool.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/roi_pool.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/smooth_l1_loss.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/layers/smooth_l1_loss.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/backbone/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/backbone/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/backbone/backbone.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/backbone/backbone.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/backbone/fpn.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/backbone/fpn.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/backbone/resnet.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/backbone/resnet.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/balanced_positive_negative_sampler.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/balanced_positive_negative_sampler.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/box_coder.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/box_coder.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/detector/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/detector/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/detector/detectors.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/detector/detectors.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/detector/generalized_rcnn.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/make_layers.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/make_layers.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/matcher.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/matcher.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/poolers.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/poolers.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/registry.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/registry.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/box_head.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/inference.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/inference.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/loss.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/loss.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/roi_box_feature_extractors.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/roi_box_feature_extractors.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/roi_box_predictors.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/box_head/roi_box_predictors.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/inference.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/inference.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/loss.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/loss.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/mask_head.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/mask_head.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/roi_mask_feature_extractors.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/roi_mask_feature_extractors.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/roi_mask_predictors.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/mask_head/roi_mask_predictors.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/roi_heads.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/roi_heads/roi_heads.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/anchor_generator.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/anchor_generator.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/inference.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/loss.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/loss.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/rpn.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/rpn/rpn.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/utils.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/modeling/utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/solver/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/solver/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/solver/build.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/solver/build.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/solver/lr_scheduler.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/solver/lr_scheduler.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/bounding_box.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/bounding_box.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/boxlist_ops.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/boxlist_ops.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/image_list.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/image_list.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/segmentation_mask.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/structures/segmentation_mask.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/README.md b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/README.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/__init__.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/__init__.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/c2_model_loading.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/c2_model_loading.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/checkpoint.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/checkpoint.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/collect_env.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/collect_env.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/comm.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/comm.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/cv2_util.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/cv2_util.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/env.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/env.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/imports.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/imports.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/logger.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/logger.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/metric_logger.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/metric_logger.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/miscellaneous.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/miscellaneous.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/model_serialization.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/model_serialization.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/model_zoo.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/model_zoo.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/registry.py b/PyTorch/Segmentation/MaskRCNN/pytorch/maskrcnn_benchmark/utils/registry.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/docker/build.sh b/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/docker/interactive.sh b/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/eval.sh b/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/eval.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/train.sh b/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/train.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/train_benchmark.sh b/PyTorch/Segmentation/MaskRCNN/pytorch/scripts/train_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/setup.py b/PyTorch/Segmentation/MaskRCNN/pytorch/setup.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/test_fp16.sh b/PyTorch/Segmentation/MaskRCNN/pytorch/test_fp16.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/test_fp32.sh b/PyTorch/Segmentation/MaskRCNN/pytorch/test_fp32.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/tests/checkpoint.py b/PyTorch/Segmentation/MaskRCNN/pytorch/tests/checkpoint.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/tests/test_data_samplers.py b/PyTorch/Segmentation/MaskRCNN/pytorch/tests/test_data_samplers.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/tests/test_metric_logger.py b/PyTorch/Segmentation/MaskRCNN/pytorch/tests/test_metric_logger.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/tools/cityscapes/convert_cityscapes_to_coco.py b/PyTorch/Segmentation/MaskRCNN/pytorch/tools/cityscapes/convert_cityscapes_to_coco.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/tools/cityscapes/instances2dict_with_polygons.py b/PyTorch/Segmentation/MaskRCNN/pytorch/tools/cityscapes/instances2dict_with_polygons.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/tools/test_net.py b/PyTorch/Segmentation/MaskRCNN/pytorch/tools/test_net.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/tools/train_net.py b/PyTorch/Segmentation/MaskRCNN/pytorch/tools/train_net.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/pytorch/train.sh b/PyTorch/Segmentation/MaskRCNN/pytorch/train.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/MaskRCNN/weights.md5 b/PyTorch/Segmentation/MaskRCNN/weights.md5 old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/README.md b/PyTorch/Segmentation/README.md index 1fcb15f65..8c66962d3 100644 --- a/PyTorch/Segmentation/README.md +++ b/PyTorch/Segmentation/README.md @@ -1,97 +1,97 @@ -# Segmentation - -Image Segmentation is the field of image processing that deals with separating the image into multiple subgroups or regions (such as pixels set, also known as image segments) representing distinctive objects or its subparts. - -Nowadays, we are constantly making interpretations of the world around us through cameras and other devices. Therefore image segmentation has become an integral part of our lives, since it's an indispensable technique for teaching the devices how to process this interpretation, how to understand the world around them. - -In this collection, we will cover: -- What is image segmentation? -- Types of image segmentation -- How does image segmentation work? -- Use-cases and applications -- Where to get started - ---- -## What is image segmentation? - -Image segmentation is a computer vision process by which a digital image is divided into various categories or segments. We use this method to understand what is depicted using a pixel-wise classification of the image. It is very much distinct from image classification, which allots labels to an entire image; object detection identifies and locates objects within an image by drawing bounding boxes around them. Image segmentation presents more pixel-level knowledge about the image content. - -Consider a road side scenario with pedestrians, cars and lights: -![](img/3_image-segmentation-figure-1.png) - -This photo is made up of an immense number of individual pixels, and image segmentation aims to assign each of those pixels to the object to which it belongs. Segmentation of an image enables us to segregate the foreground from the background, identify a road or a car's precise location, and mark the margins that separate a pedestrian from a car or road. - ---- -## Types of image segmentation - -Image segmentation tasks can be broken down into two broad categories: semantic segmentation and instance segmentation. - -1. Semantic segmentation:- This is the process of classifying each pixel belonging to a particular label. It doesn't different across different instances of the same object. For example if there are 2 cats in an image, semantic segmentation gives same label to all the pixels of both cats - -2. Instance segmentation:- This differs from semantic segmentation in the sense that it gives a unique label to every instance of a particular object in the image. As can be seen in the image above all 3 dogs are assigned different colours i.e different labels. With semantic segmentation all of them would have been assigned the same colour. - ---- -## How does image segmentation work? -Let's consider image segmentation as a function. -An image is given as input to the function and it gives a matrix or a mask as the output, where each element tells us which class or instance that pixel belongs to. - -Machine learning moves towards image segmentation train models to recognize which features of an image are crucial, rather than designing bespoke heuristics by hand. - -Although deep neural networks architectures for image segmentation may differ in implementation, most follows similar basis structure: - -![](img/3_image-segmentation-figure-2.png) - -Source - [SegNet Paper](https://arxiv.org/pdf/1511.00561.pdf) - -- The encoder: A set of layers that extract features of an image through a sequence of progressively narrower and deeper filters. Oftentimes, the encoder is pre-trained on a different task (like image recognition), where it learns statistical correlations from many images and may transfer that knowledge for the purposes of segmentation. -- The Decoder: A set of layers that progressively grows the output of the encoder into a segmentation mask resembling the pixel resolution of the input image. -- Skip connections: Long range connections in the neural network that allow the model to draw on features at varying spatial scales to improve model accuracy. - -Most of the architectures used for segmentation tasks are built on the technique of Fully Convolutional Network (FCN) i.e., the architecture contains convolution layers instead of any Dense or Max Pool layers. Though various models support the FCN technique, a few handpicked models generally used in production are - UNet, MaskRCNN, and DeepLabv3. - ---- -## Use-cases and applications - -Image Segmentation can be useful for a lot of different use-cases - handwriting recognition, virtual try-on, visual image search, road scene segmentation, organ segmentation and much more. Here are the few applications explained in detail: - -### Autonomous vehicles: - -There are a lot of things that needs your attention while driving- the road, other vehicles, pedestrians, sidewalks, and (potentially) a plethora of other potential obstacles/safety hazards. - -If you’ve been driving for a long time, noticing and reacting to this environment might seem automatic or like second nature. In case of a self driving car, it would be a quick observation that this car needs to see, interpret, and respond to a scene in real-time. This implies the need to create pixel-level map of the world through the camera system in this vehicle in order to navigate it safely and efficiently. - -Even though the field of autonomous machines/automobiles is much more complex than performing segmentation, this pixel-level understanding is a essential ingredient in a step towards reality. - -![](img/3_image-segmentation-figure-3.png) - -### Medical imaging and diagnostics: - -In the initial steps of a diagnostic and treatment pipeline for many conditions that require medical images, such as CT or MRI scans, image segmentation can be used as a powerful technique. - -Essentially, segmentation can effectively distinguish and separate homogeneous areas that may include particularly important pixels of organs, lesions, etc. However, there are significant challenges, including low contrast, noise, and various other imaging ambiguities. - -![](img/3_image-segmentation-figure-4.png) - -### Virtual try-on: - -Virtual try on clothes is quite a fascinating feature which was available in stores using specialized hardware which creates a 3d model. But interestingly with deep learning and image segmentation the same can be obtained using just a 2d image. - -![](img/3_image-segmentation-figure-5.png) ---- -## Where to get started -NVIDIA provides Deep Learning Examples for Image Segmentation on its GitHub repository. These examples provide you with easy to consume and highly optimized scripts for both training and inferencing. The quick start guide at our GitHub repository will help you in setting up the environment using NGC Docker Images, download pre-trained models from NGC and adapt the model training and inference for your application/use-case. -Here are the examples relevant for image segmentation, directly from [Deep Learning Examples](https://github.com/NVIDIA/DeepLearningExamples): - -1. 3D UNet for Medical Image Segmentation using Tensorflow 1.x -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_3D_Medical) -- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) - - -2. 2D UNet for Industrial Defect Segmentation using Tensorflow 1.x -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_Industrial) -- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) - - -3. MaskRCNN for Common Objects Segmentation using PyTorch -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmentation/MaskRCNN) -- Uses PyTorch 20.06-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-pytorch) +# Segmentation + +Image Segmentation is the field of image processing that deals with separating the image into multiple subgroups or regions (such as pixels set, also known as image segments) representing distinctive objects or its subparts. + +Nowadays, we are constantly making interpretations of the world around us through cameras and other devices. Therefore image segmentation has become an integral part of our lives, since it's an indispensable technique for teaching the devices how to process this interpretation, how to understand the world around them. + +In this collection, we will cover: +- What is image segmentation? +- Types of image segmentation +- How does image segmentation work? +- Use-cases and applications +- Where to get started + +--- +## What is image segmentation? + +Image segmentation is a computer vision process by which a digital image is divided into various categories or segments. We use this method to understand what is depicted using a pixel-wise classification of the image. It is very much distinct from image classification, which allots labels to an entire image; object detection identifies and locates objects within an image by drawing bounding boxes around them. Image segmentation presents more pixel-level knowledge about the image content. + +Consider a road side scenario with pedestrians, cars and lights: +![](img/3_image-segmentation-figure-1.png) + +This photo is made up of an immense number of individual pixels, and image segmentation aims to assign each of those pixels to the object to which it belongs. Segmentation of an image enables us to segregate the foreground from the background, identify a road or a car's precise location, and mark the margins that separate a pedestrian from a car or road. + +--- +## Types of image segmentation + +Image segmentation tasks can be broken down into two broad categories: semantic segmentation and instance segmentation. + +1. Semantic segmentation:- This is the process of classifying each pixel belonging to a particular label. It doesn't different across different instances of the same object. For example if there are 2 cats in an image, semantic segmentation gives same label to all the pixels of both cats + +2. Instance segmentation:- This differs from semantic segmentation in the sense that it gives a unique label to every instance of a particular object in the image. As can be seen in the image above all 3 dogs are assigned different colours i.e different labels. With semantic segmentation all of them would have been assigned the same colour. + +--- +## How does image segmentation work? +Let's consider image segmentation as a function. +An image is given as input to the function and it gives a matrix or a mask as the output, where each element tells us which class or instance that pixel belongs to. + +Machine learning moves towards image segmentation train models to recognize which features of an image are crucial, rather than designing bespoke heuristics by hand. + +Although deep neural networks architectures for image segmentation may differ in implementation, most follows similar basis structure: + +![](img/3_image-segmentation-figure-2.png) + +Source - [SegNet Paper](https://arxiv.org/pdf/1511.00561.pdf) + +- The encoder: A set of layers that extract features of an image through a sequence of progressively narrower and deeper filters. Oftentimes, the encoder is pre-trained on a different task (like image recognition), where it learns statistical correlations from many images and may transfer that knowledge for the purposes of segmentation. +- The Decoder: A set of layers that progressively grows the output of the encoder into a segmentation mask resembling the pixel resolution of the input image. +- Skip connections: Long range connections in the neural network that allow the model to draw on features at varying spatial scales to improve model accuracy. + +Most of the architectures used for segmentation tasks are built on the technique of Fully Convolutional Network (FCN) i.e., the architecture contains convolution layers instead of any Dense or Max Pool layers. Though various models support the FCN technique, a few handpicked models generally used in production are - UNet, MaskRCNN, and DeepLabv3. + +--- +## Use-cases and applications + +Image Segmentation can be useful for a lot of different use-cases - handwriting recognition, virtual try-on, visual image search, road scene segmentation, organ segmentation and much more. Here are the few applications explained in detail: + +### Autonomous vehicles: + +There are a lot of things that needs your attention while driving- the road, other vehicles, pedestrians, sidewalks, and (potentially) a plethora of other potential obstacles/safety hazards. + +If you’ve been driving for a long time, noticing and reacting to this environment might seem automatic or like second nature. In case of a self driving car, it would be a quick observation that this car needs to see, interpret, and respond to a scene in real-time. This implies the need to create pixel-level map of the world through the camera system in this vehicle in order to navigate it safely and efficiently. + +Even though the field of autonomous machines/automobiles is much more complex than performing segmentation, this pixel-level understanding is a essential ingredient in a step towards reality. + +![](img/3_image-segmentation-figure-3.png) + +### Medical imaging and diagnostics: + +In the initial steps of a diagnostic and treatment pipeline for many conditions that require medical images, such as CT or MRI scans, image segmentation can be used as a powerful technique. + +Essentially, segmentation can effectively distinguish and separate homogeneous areas that may include particularly important pixels of organs, lesions, etc. However, there are significant challenges, including low contrast, noise, and various other imaging ambiguities. + +![](img/3_image-segmentation-figure-4.png) + +### Virtual try-on: + +Virtual try on clothes is quite a fascinating feature which was available in stores using specialized hardware which creates a 3d model. But interestingly with deep learning and image segmentation the same can be obtained using just a 2d image. + +![](img/3_image-segmentation-figure-5.png) +--- +## Where to get started +NVIDIA provides Deep Learning Examples for Image Segmentation on its GitHub repository. These examples provide you with easy to consume and highly optimized scripts for both training and inferencing. The quick start guide at our GitHub repository will help you in setting up the environment using NGC Docker Images, download pre-trained models from NGC and adapt the model training and inference for your application/use-case. +Here are the examples relevant for image segmentation, directly from [Deep Learning Examples](https://github.com/NVIDIA/DeepLearningExamples): + +1. 3D UNet for Medical Image Segmentation using Tensorflow 1.x +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_3D_Medical) +- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) + + +2. 2D UNet for Industrial Defect Segmentation using Tensorflow 1.x +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_Industrial) +- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) + + +3. MaskRCNN for Common Objects Segmentation using PyTorch +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmentation/MaskRCNN) +- Uses PyTorch 20.06-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-pytorch) diff --git a/PyTorch/Segmentation/nnUNet/Dockerfile b/PyTorch/Segmentation/nnUNet/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/README.md b/PyTorch/Segmentation/nnUNet/README.md old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/download.py b/PyTorch/Segmentation/nnUNet/download.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/main.py b/PyTorch/Segmentation/nnUNet/main.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/preprocess.py b/PyTorch/Segmentation/nnUNet/preprocess.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/requirements.txt b/PyTorch/Segmentation/nnUNet/requirements.txt old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/calculate_metrics.py b/PyTorch/Segmentation/nnUNet/triton/calculate_metrics.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/config_model_on_triton.py b/PyTorch/Segmentation/nnUNet/triton/config_model_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/convert_model.py b/PyTorch/Segmentation/nnUNet/triton/convert_model.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/preprocess.py b/PyTorch/Segmentation/nnUNet/triton/preprocess.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/run_inference_on_fw.py b/PyTorch/Segmentation/nnUNet/triton/run_inference_on_fw.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/run_inference_on_triton.py b/PyTorch/Segmentation/nnUNet/triton/run_inference_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/run_offline_performance_test_on_triton.py b/PyTorch/Segmentation/nnUNet/triton/run_offline_performance_test_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/run_online_performance_test_on_triton.py b/PyTorch/Segmentation/nnUNet/triton/run_online_performance_test_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/scripts/docker/build.sh b/PyTorch/Segmentation/nnUNet/triton/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/scripts/docker/triton_inference_server.sh b/PyTorch/Segmentation/nnUNet/triton/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/scripts/download_data.sh b/PyTorch/Segmentation/nnUNet/triton/scripts/download_data.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/scripts/process_dataset.sh b/PyTorch/Segmentation/nnUNet/triton/scripts/process_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/scripts/setup_environment.sh b/PyTorch/Segmentation/nnUNet/triton/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/triton/scripts/setup_parameters.sh b/PyTorch/Segmentation/nnUNet/triton/scripts/setup_parameters.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Segmentation/nnUNet/utils/utils.py b/PyTorch/Segmentation/nnUNet/utils/utils.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/.dockerignore b/PyTorch/SpeechRecognition/Jasper/.dockerignore old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/.gitignore b/PyTorch/SpeechRecognition/Jasper/.gitignore old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/Dockerfile b/PyTorch/SpeechRecognition/Jasper/Dockerfile old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/requirements.txt b/PyTorch/SpeechRecognition/Jasper/requirements.txt old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/docker/build.sh b/PyTorch/SpeechRecognition/Jasper/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/docker/launch.sh b/PyTorch/SpeechRecognition/Jasper/scripts/docker/launch.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/download_librispeech.sh b/PyTorch/SpeechRecognition/Jasper/scripts/download_librispeech.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/evaluation.sh b/PyTorch/SpeechRecognition/Jasper/scripts/evaluation.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/inference.sh b/PyTorch/SpeechRecognition/Jasper/scripts/inference.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/inference_benchmark.sh b/PyTorch/SpeechRecognition/Jasper/scripts/inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/preprocess_librispeech.sh b/PyTorch/SpeechRecognition/Jasper/scripts/preprocess_librispeech.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/train.sh b/PyTorch/SpeechRecognition/Jasper/scripts/train.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/scripts/train_benchmark.sh b/PyTorch/SpeechRecognition/Jasper/scripts/train_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/jasper-client.py b/PyTorch/SpeechRecognition/Jasper/triton/jasper-client.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/docker/build_triton_client.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/docker/build_triton_client.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/download_triton_librispeech.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/download_triton_librispeech.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/execute_all_perf_runs.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/execute_all_perf_runs.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/export_model.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/export_model.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/generate_perf_results.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/generate_perf_results.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/prepare_model_repository.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/prepare_model_repository.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/preprocess_triton_librispeech.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/preprocess_triton_librispeech.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/run_client.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/run_client.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/run_perf_client.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/run_perf_client.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/run_server.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/run_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/Jasper/triton/scripts/wait_for_triton_server.sh b/PyTorch/SpeechRecognition/Jasper/triton/scripts/wait_for_triton_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/.gitignore b/PyTorch/SpeechRecognition/QuartzNet/.gitignore old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/docker/build.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/docker/launch.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/docker/launch.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/download_librispeech.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/download_librispeech.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/download_quartznet.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/download_quartznet.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/evaluation.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/evaluation.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/inference.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/inference.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/inference_benchmark.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/preprocess_librispeech.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/preprocess_librispeech.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/train.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/train.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/QuartzNet/scripts/train_benchmark.sh b/PyTorch/SpeechRecognition/QuartzNet/scripts/train_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/docker/build.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/docker/run.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/docker/run.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/download_data.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/download_data.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_100h.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_100h.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_10h.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_10h.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_1h.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_1h.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_960h.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_960h.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_benchmark.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_base_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_vox_100h.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_vox_100h.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_vox_960h.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_vox_960h.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_vox_960h_cv.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/finetune_vox_960h_cv.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/generate_filelists.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/generate_filelists.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/inference.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/inference.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/inference_benchmark.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/pretrain_base.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/pretrain_base.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/pretrain_base_benchmark.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/pretrain_base_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechRecognition/wav2vec2/scripts/pretrain_large.sh b/PyTorch/SpeechRecognition/wav2vec2/scripts/pretrain_large.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/scripts/download_cmudict.sh b/PyTorch/SpeechSynthesis/FastPitch/scripts/download_cmudict.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/scripts/download_dataset.sh b/PyTorch/SpeechSynthesis/FastPitch/scripts/download_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/scripts/download_models.sh b/PyTorch/SpeechSynthesis/FastPitch/scripts/download_models.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/scripts/inference_benchmark.sh b/PyTorch/SpeechSynthesis/FastPitch/scripts/inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/scripts/inference_example.sh b/PyTorch/SpeechSynthesis/FastPitch/scripts/inference_example.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/scripts/prepare_dataset.sh b/PyTorch/SpeechSynthesis/FastPitch/scripts/prepare_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/scripts/train.sh b/PyTorch/SpeechSynthesis/FastPitch/scripts/train.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/scripts/train_benchmark.sh b/PyTorch/SpeechSynthesis/FastPitch/scripts/train_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/calculate_metrics.py b/PyTorch/SpeechSynthesis/FastPitch/triton/calculate_metrics.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/config_model_on_triton.py b/PyTorch/SpeechSynthesis/FastPitch/triton/config_model_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/convert_model.py b/PyTorch/SpeechSynthesis/FastPitch/triton/convert_model.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/run_inference_on_fw.py b/PyTorch/SpeechSynthesis/FastPitch/triton/run_inference_on_fw.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/run_inference_on_triton.py b/PyTorch/SpeechSynthesis/FastPitch/triton/run_inference_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/run_offline_performance_test_on_triton.py b/PyTorch/SpeechSynthesis/FastPitch/triton/run_offline_performance_test_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/run_online_performance_test_on_triton.py b/PyTorch/SpeechSynthesis/FastPitch/triton/run_online_performance_test_on_triton.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/docker/build.sh b/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/docker/interactive.sh b/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/docker/triton_inference_server.sh b/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/download_data.sh b/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/download_data.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/process_dataset.sh b/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/process_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/setup_environment.sh b/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/setup_parameters.sh b/PyTorch/SpeechSynthesis/FastPitch/triton/scripts/setup_parameters.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/download_cmudict.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/download_cmudict.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/download_dataset.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/download_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/download_models.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/download_models.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/extract_fine_tune_mels.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/extract_fine_tune_mels.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/fine_tune.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/fine_tune.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/generate_filelists.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/generate_filelists.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/inference_benchmark.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/inference_example.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/inference_example.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/prepare_dataset.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/prepare_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/train_benchmark.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/train_benchmark.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/HiFiGAN/scripts/train_lj22khz.sh b/PyTorch/SpeechSynthesis/HiFiGAN/scripts/train_lj22khz.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/filelists/ljs_audio_text_test_filelist.txt b/PyTorch/SpeechSynthesis/Tacotron2/filelists/ljs_audio_text_test_filelist.txt old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/filelists/ljs_audio_text_train_filelist.txt b/PyTorch/SpeechSynthesis/Tacotron2/filelists/ljs_audio_text_train_filelist.txt old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/filelists/ljs_audio_text_val_filelist.txt b/PyTorch/SpeechSynthesis/Tacotron2/filelists/ljs_audio_text_val_filelist.txt old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/scripts/prepare_dataset.sh b/PyTorch/SpeechSynthesis/Tacotron2/scripts/prepare_dataset.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/build_trtis.sh b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/build_trtis.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/configure b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/configure old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/export_weights.sh b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/export_weights.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/run_trtis_server.sh b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/run_trtis_server.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/build_benchmark_engines.sh b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/build_benchmark_engines.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/build_engines.sh b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/build_engines.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/denoiser_to_json.py b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/denoiser_to_json.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/export_symbols.py b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/export_symbols.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/tacotron2_to_json.py b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/tacotron2_to_json.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/waveglow_to_onnx.py b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/scripts/waveglow_to_onnx.py old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/trtis_client/build_trtis_client.sh b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/trtis_client/build_trtis_client.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/trtis_client/configure b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/trtis_client/configure old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/trtis_client/run_trtis_benchmark_client.sh b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/trtis_client/run_trtis_benchmark_client.sh old mode 100755 new mode 100644 diff --git a/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/trtis_client/run_trtis_client.sh b/PyTorch/SpeechSynthesis/Tacotron2/trtis_cpp/trtis_client/run_trtis_client.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/GNMT/scripts/docker/build.sh b/PyTorch/Translation/GNMT/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/GNMT/scripts/docker/interactive.sh b/PyTorch/Translation/GNMT/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/Transformer/scripts/run_DGX1_AMP.sh b/PyTorch/Translation/Transformer/scripts/run_DGX1_AMP.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/Transformer/scripts/run_DGX1_FP32.sh b/PyTorch/Translation/Transformer/scripts/run_DGX1_FP32.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/Transformer/scripts/run_DGX2_AMP.sh b/PyTorch/Translation/Transformer/scripts/run_DGX2_AMP.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/Transformer/scripts/run_DGX2_FP32.sh b/PyTorch/Translation/Transformer/scripts/run_DGX2_FP32.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/Transformer/scripts/run_DGXA100_AMP.sh b/PyTorch/Translation/Transformer/scripts/run_DGXA100_AMP.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/Transformer/scripts/run_DGXA100_TF32.sh b/PyTorch/Translation/Transformer/scripts/run_DGXA100_TF32.sh old mode 100755 new mode 100644 diff --git a/PyTorch/Translation/Transformer/scripts/run_training.sh b/PyTorch/Translation/Transformer/scripts/run_training.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/dataprep/build_image_data.py b/TensorFlow/Classification/ConvNets/dataprep/build_image_data.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/dataprep/preprocess_imagenet.sh b/TensorFlow/Classification/ConvNets/dataprep/preprocess_imagenet.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/dataprep/preprocess_imagenet_validation_data.py b/TensorFlow/Classification/ConvNets/dataprep/preprocess_imagenet_validation_data.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/dataprep/process_bounding_boxes.py b/TensorFlow/Classification/ConvNets/dataprep/process_bounding_boxes.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/export_frozen_graph.py b/TensorFlow/Classification/ConvNets/export_frozen_graph.py index 64c9ffd34..459b20bd9 100644 --- a/TensorFlow/Classification/ConvNets/export_frozen_graph.py +++ b/TensorFlow/Classification/ConvNets/export_frozen_graph.py @@ -1,128 +1,128 @@ -#!/usr/bin/env python -# -*- 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. - -from __future__ import absolute_import -from __future__ import division -from __future__ import print_function -import os - -import tensorflow as tf - -from utils import hvd_wrapper as hvd -from model import resnet - -tf.app.flags.DEFINE_string( - 'model_name', 'resnet50', 'The name of the architecture to save. The default name was being ' - 'used to train the model') - -tf.app.flags.DEFINE_integer( - 'image_size', 224, - 'The image size to use, otherwise use the model default_image_size.') - -tf.app.flags.DEFINE_integer( - 'num_classes', 1001, - 'The number of classes to predict.') - -tf.app.flags.DEFINE_integer( - 'batch_size', None, - 'Batch size for the exported model. Defaulted to "None" so batch size can ' - 'be specified at model runtime.') - - -tf.app.flags.DEFINE_string('input_format', 'NCHW', - 'The dataformat used by the layers in the model') - -tf.app.flags.DEFINE_string('compute_format', 'NCHW', - 'The dataformat used by the layers in the model') - -tf.app.flags.DEFINE_string('checkpoint', '', - 'The trained model checkpoint.') - -tf.app.flags.DEFINE_string( - 'output_file', '', 'Where to save the resulting file to.') - -tf.app.flags.DEFINE_bool( - 'quantize', False, 'whether to use quantized graph or not.') - -tf.app.flags.DEFINE_bool( - 'symmetric', False, 'Using symmetric quantization or not.') - - -tf.app.flags.DEFINE_bool( - 'use_qdq', False, 'Use quantize and dequantize op instead of fake quant op') - -tf.app.flags.DEFINE_bool( - 'use_final_conv', False, 'whether to use quantized graph or not.') - -tf.app.flags.DEFINE_bool('write_text_graphdef', False, - 'Whether to write a text version of graphdef.') - -FLAGS = tf.app.flags.FLAGS - - -def main(_): - hvd.init() - - if not FLAGS.output_file: - raise ValueError('You must supply the path to save to with --output_file') - - tf.logging.set_verbosity(tf.logging.INFO) - with tf.Graph().as_default() as graph: - if FLAGS.input_format=='NCHW': - input_shape = [FLAGS.batch_size, 3, FLAGS.image_size, FLAGS.image_size] - else: - input_shape = [FLAGS.batch_size, FLAGS.image_size, FLAGS.image_size, 3] - input_images = tf.placeholder(name='input', dtype=tf.float32, shape=input_shape) - - resnet50_config = resnet.model_architectures[FLAGS.model_name] - network = resnet.ResnetModel(FLAGS.model_name, - FLAGS.num_classes, - resnet50_config['layers'], - resnet50_config['widths'], - resnet50_config['expansions'], - FLAGS.compute_format, - FLAGS.input_format) - probs, logits = network.build_model( - input_images, - training=False, - reuse=False, - use_final_conv=FLAGS.use_final_conv) - - if FLAGS.quantize: - tf.contrib.quantize.experimental_create_eval_graph(symmetric=FLAGS.symmetric, - use_qdq=FLAGS.use_qdq) - - # Define the saver and restore the checkpoint - saver = tf.train.Saver() - with tf.Session() as sess: - if FLAGS.checkpoint: - saver.restore(sess, FLAGS.checkpoint) - else: - sess.run(tf.global_variables_initializer()) - graph_def = graph.as_graph_def() - frozen_graph_def = tf.graph_util.convert_variables_to_constants(sess, graph_def, [probs.op.name]) - - # Write out the frozen graph - tf.io.write_graph( - frozen_graph_def, - os.path.dirname(FLAGS.output_file), - os.path.basename(FLAGS.output_file), - as_text=FLAGS.write_text_graphdef) - - -if __name__ == '__main__': - tf.app.run() +#!/usr/bin/env python +# -*- 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. + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +import os + +import tensorflow as tf + +from utils import hvd_wrapper as hvd +from model import resnet + +tf.app.flags.DEFINE_string( + 'model_name', 'resnet50', 'The name of the architecture to save. The default name was being ' + 'used to train the model') + +tf.app.flags.DEFINE_integer( + 'image_size', 224, + 'The image size to use, otherwise use the model default_image_size.') + +tf.app.flags.DEFINE_integer( + 'num_classes', 1001, + 'The number of classes to predict.') + +tf.app.flags.DEFINE_integer( + 'batch_size', None, + 'Batch size for the exported model. Defaulted to "None" so batch size can ' + 'be specified at model runtime.') + + +tf.app.flags.DEFINE_string('input_format', 'NCHW', + 'The dataformat used by the layers in the model') + +tf.app.flags.DEFINE_string('compute_format', 'NCHW', + 'The dataformat used by the layers in the model') + +tf.app.flags.DEFINE_string('checkpoint', '', + 'The trained model checkpoint.') + +tf.app.flags.DEFINE_string( + 'output_file', '', 'Where to save the resulting file to.') + +tf.app.flags.DEFINE_bool( + 'quantize', False, 'whether to use quantized graph or not.') + +tf.app.flags.DEFINE_bool( + 'symmetric', False, 'Using symmetric quantization or not.') + + +tf.app.flags.DEFINE_bool( + 'use_qdq', False, 'Use quantize and dequantize op instead of fake quant op') + +tf.app.flags.DEFINE_bool( + 'use_final_conv', False, 'whether to use quantized graph or not.') + +tf.app.flags.DEFINE_bool('write_text_graphdef', False, + 'Whether to write a text version of graphdef.') + +FLAGS = tf.app.flags.FLAGS + + +def main(_): + hvd.init() + + if not FLAGS.output_file: + raise ValueError('You must supply the path to save to with --output_file') + + tf.logging.set_verbosity(tf.logging.INFO) + with tf.Graph().as_default() as graph: + if FLAGS.input_format=='NCHW': + input_shape = [FLAGS.batch_size, 3, FLAGS.image_size, FLAGS.image_size] + else: + input_shape = [FLAGS.batch_size, FLAGS.image_size, FLAGS.image_size, 3] + input_images = tf.placeholder(name='input', dtype=tf.float32, shape=input_shape) + + resnet50_config = resnet.model_architectures[FLAGS.model_name] + network = resnet.ResnetModel(FLAGS.model_name, + FLAGS.num_classes, + resnet50_config['layers'], + resnet50_config['widths'], + resnet50_config['expansions'], + FLAGS.compute_format, + FLAGS.input_format) + probs, logits = network.build_model( + input_images, + training=False, + reuse=False, + use_final_conv=FLAGS.use_final_conv) + + if FLAGS.quantize: + tf.contrib.quantize.experimental_create_eval_graph(symmetric=FLAGS.symmetric, + use_qdq=FLAGS.use_qdq) + + # Define the saver and restore the checkpoint + saver = tf.train.Saver() + with tf.Session() as sess: + if FLAGS.checkpoint: + saver.restore(sess, FLAGS.checkpoint) + else: + sess.run(tf.global_variables_initializer()) + graph_def = graph.as_graph_def() + frozen_graph_def = tf.graph_util.convert_variables_to_constants(sess, graph_def, [probs.op.name]) + + # Write out the frozen graph + tf.io.write_graph( + frozen_graph_def, + os.path.dirname(FLAGS.output_file), + os.path.basename(FLAGS.output_file), + as_text=FLAGS.write_text_graphdef) + + +if __name__ == '__main__': + tf.app.run() diff --git a/TensorFlow/Classification/ConvNets/main.py b/TensorFlow/Classification/ConvNets/main.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/model/resnet.py b/TensorFlow/Classification/ConvNets/model/resnet.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/postprocess_ckpt.py b/TensorFlow/Classification/ConvNets/postprocess_ckpt.py index 235bb62dc..e44c6fa5f 100644 --- a/TensorFlow/Classification/ConvNets/postprocess_ckpt.py +++ b/TensorFlow/Classification/ConvNets/postprocess_ckpt.py @@ -1,74 +1,74 @@ -#!/usr/bin/env python -# -*- 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. - -import tensorflow as tf -import numpy as np -import argparse -import os - -def process_checkpoint(input_ckpt, output_ckpt_path, dense_layer): - """ - This function loads a RN50 checkpoint with Dense layer as the final layer - and transforms the final dense layer into a 1x1 convolution layer. The weights - of the dense layer are reshaped into weights of 1x1 conv layer. - Args: - input_ckpt: Path to the input RN50 ckpt which has dense layer as classification layer. - Returns: - None. New checkpoint with 1x1 conv layer as classification layer is generated. - """ - with tf.Session() as sess: - # Load all the variables - all_vars = tf.train.list_variables(input_ckpt) - # Capture the dense layer weights and reshape them to a 4D tensor which would be - # the weights of a 1x1 convolution layer. This code replaces the dense (FC) layer - # to a 1x1 conv layer. - dense_layer_value=0. - new_var_list=[] - for var in all_vars: - curr_var = tf.train.load_variable(input_ckpt, var[0]) - if var[0]==dense_layer: - dense_layer_value = curr_var - else: - new_var_list.append(tf.Variable(curr_var, name=var[0])) - - dense_layer_shape = [1, 1, 2048, 1001] - new_var_value = np.reshape(dense_layer_value, dense_layer_shape) - new_var = tf.Variable(new_var_value, name=dense_layer) - new_var_list.append(new_var) - - sess.run(tf.global_variables_initializer()) - tf.train.Saver(var_list=new_var_list).save(sess, output_ckpt_path, write_meta_graph=False, write_state=False) - print ("Rewriting checkpoint completed") - -if __name__=='__main__': - parser = argparse.ArgumentParser() - parser.add_argument('--input', type=str, required=True, help='Path to pretrained RN50 checkpoint with dense layer') - parser.add_argument('--dense_layer', type=str, default='resnet50/output/dense/kernel') - parser.add_argument('--output', type=str, default='output_dir', help="Output directory to store new checkpoint") - args = parser.parse_args() - - input_ckpt = args.input - # Create an output directory - os.mkdir(args.output) - - new_ckpt='new.ckpt' - new_ckpt_path = os.path.join(args.output, new_ckpt) - with open(os.path.join(args.output, "checkpoint"), 'w') as file: - file.write("model_checkpoint_path: "+ "\"" + new_ckpt + "\"") - - # Process the input checkpoint, apply transforms and generate a new checkpoint. - process_checkpoint(input_ckpt, new_ckpt_path, args.dense_layer) +#!/usr/bin/env python +# -*- 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. + +import tensorflow as tf +import numpy as np +import argparse +import os + +def process_checkpoint(input_ckpt, output_ckpt_path, dense_layer): + """ + This function loads a RN50 checkpoint with Dense layer as the final layer + and transforms the final dense layer into a 1x1 convolution layer. The weights + of the dense layer are reshaped into weights of 1x1 conv layer. + Args: + input_ckpt: Path to the input RN50 ckpt which has dense layer as classification layer. + Returns: + None. New checkpoint with 1x1 conv layer as classification layer is generated. + """ + with tf.Session() as sess: + # Load all the variables + all_vars = tf.train.list_variables(input_ckpt) + # Capture the dense layer weights and reshape them to a 4D tensor which would be + # the weights of a 1x1 convolution layer. This code replaces the dense (FC) layer + # to a 1x1 conv layer. + dense_layer_value=0. + new_var_list=[] + for var in all_vars: + curr_var = tf.train.load_variable(input_ckpt, var[0]) + if var[0]==dense_layer: + dense_layer_value = curr_var + else: + new_var_list.append(tf.Variable(curr_var, name=var[0])) + + dense_layer_shape = [1, 1, 2048, 1001] + new_var_value = np.reshape(dense_layer_value, dense_layer_shape) + new_var = tf.Variable(new_var_value, name=dense_layer) + new_var_list.append(new_var) + + sess.run(tf.global_variables_initializer()) + tf.train.Saver(var_list=new_var_list).save(sess, output_ckpt_path, write_meta_graph=False, write_state=False) + print ("Rewriting checkpoint completed") + +if __name__=='__main__': + parser = argparse.ArgumentParser() + parser.add_argument('--input', type=str, required=True, help='Path to pretrained RN50 checkpoint with dense layer') + parser.add_argument('--dense_layer', type=str, default='resnet50/output/dense/kernel') + parser.add_argument('--output', type=str, default='output_dir', help="Output directory to store new checkpoint") + args = parser.parse_args() + + input_ckpt = args.input + # Create an output directory + os.mkdir(args.output) + + new_ckpt='new.ckpt' + new_ckpt_path = os.path.join(args.output, new_ckpt) + with open(os.path.join(args.output, "checkpoint"), 'w') as file: + file.write("model_checkpoint_path: "+ "\"" + new_ckpt + "\"") + + # Process the input checkpoint, apply transforms and generate a new checkpoint. + process_checkpoint(input_ckpt, new_ckpt_path, args.dense_layer) diff --git a/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX1_RN50_AMP_250E.sh b/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX1_RN50_AMP_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX1_RN50_FP32_250E.sh b/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX1_RN50_FP32_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX2_RN50_AMP_250E.sh b/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX2_RN50_AMP_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX2_RN50_FP32_250E.sh b/TensorFlow/Classification/ConvNets/resnet50v1.5/training/DGX2_RN50_FP32_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/resnext101-32x4d/training/DGX1_RNxt101-32x4d_AMP_250E.sh b/TensorFlow/Classification/ConvNets/resnext101-32x4d/training/DGX1_RNxt101-32x4d_AMP_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/resnext101-32x4d/training/DGX1_RNxt101-32x4d_FP32_250E.sh b/TensorFlow/Classification/ConvNets/resnext101-32x4d/training/DGX1_RNxt101-32x4d_FP32_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/resnext101-32x4d/training/DGX2_RNxt101-32x4d_AMP_250E.sh b/TensorFlow/Classification/ConvNets/resnext101-32x4d/training/DGX2_RNxt101-32x4d_AMP_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/resnext101-32x4d/training/DGX2_RNxt101-32x4d_FP32_250E.sh b/TensorFlow/Classification/ConvNets/resnext101-32x4d/training/DGX2_RNxt101-32x4d_FP32_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/runtime/runner.py b/TensorFlow/Classification/ConvNets/runtime/runner.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/se-resnext101-32x4d/training/DGX1_SE-RNxt101-32x4d_AMP_250E.sh b/TensorFlow/Classification/ConvNets/se-resnext101-32x4d/training/DGX1_SE-RNxt101-32x4d_AMP_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/se-resnext101-32x4d/training/DGX1_SE-RNxt101-32x4d_FP32_250E.sh b/TensorFlow/Classification/ConvNets/se-resnext101-32x4d/training/DGX1_SE-RNxt101-32x4d_FP32_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/se-resnext101-32x4d/training/DGX2_SE-RNxt101-32x4d_AMP_250E.sh b/TensorFlow/Classification/ConvNets/se-resnext101-32x4d/training/DGX2_SE-RNxt101-32x4d_AMP_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/se-resnext101-32x4d/training/DGX2_SE-RNxt101-32x4d_FP32_250E.sh b/TensorFlow/Classification/ConvNets/se-resnext101-32x4d/training/DGX2_SE-RNxt101-32x4d_FP32_250E.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/calculate_metrics.py b/TensorFlow/Classification/ConvNets/triton/calculate_metrics.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/convert_model.py b/TensorFlow/Classification/ConvNets/triton/convert_model.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/run_inference_on_fw.py b/TensorFlow/Classification/ConvNets/triton/run_inference_on_fw.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/run_inference_on_triton.py b/TensorFlow/Classification/ConvNets/triton/run_inference_on_triton.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/run_offline_performance_test_on_triton.py b/TensorFlow/Classification/ConvNets/triton/run_offline_performance_test_on_triton.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/run_online_performance_test_on_triton.py b/TensorFlow/Classification/ConvNets/triton/run_online_performance_test_on_triton.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/scripts/docker/build.sh b/TensorFlow/Classification/ConvNets/triton/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/scripts/docker/interactive.sh b/TensorFlow/Classification/ConvNets/triton/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/scripts/docker/triton_inference_server.sh b/TensorFlow/Classification/ConvNets/triton/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/scripts/download_data.sh b/TensorFlow/Classification/ConvNets/triton/scripts/download_data.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/scripts/process_dataset.sh b/TensorFlow/Classification/ConvNets/triton/scripts/process_dataset.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/scripts/setup_environment.sh b/TensorFlow/Classification/ConvNets/triton/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/triton/scripts/setup_parameters.sh b/TensorFlow/Classification/ConvNets/triton/scripts/setup_parameters.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/utils/cmdline_helper.py b/TensorFlow/Classification/ConvNets/utils/cmdline_helper.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/utils/hooks/training_hooks.py b/TensorFlow/Classification/ConvNets/utils/hooks/training_hooks.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Classification/ConvNets/utils/optimizers.py b/TensorFlow/Classification/ConvNets/utils/optimizers.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Detection/SSD/download_all.sh b/TensorFlow/Detection/SSD/download_all.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Detection/SSD/models/research/object_detection/utils/exp_utils.py b/TensorFlow/Detection/SSD/models/research/object_detection/utils/exp_utils.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Detection/SSD/models/research/slim/datasets/download_and_convert_imagenet.sh b/TensorFlow/Detection/SSD/models/research/slim/datasets/download_and_convert_imagenet.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Detection/SSD/models/research/slim/datasets/download_imagenet.sh b/TensorFlow/Detection/SSD/models/research/slim/datasets/download_imagenet.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Detection/SSD/models/research/slim/datasets/preprocess_imagenet_validation_data.py b/TensorFlow/Detection/SSD/models/research/slim/datasets/preprocess_imagenet_validation_data.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Detection/SSD/models/research/slim/datasets/process_bounding_boxes.py b/TensorFlow/Detection/SSD/models/research/slim/datasets/process_bounding_boxes.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Detection/SSD/models/research/slim/scripts/export_mobilenet.sh b/TensorFlow/Detection/SSD/models/research/slim/scripts/export_mobilenet.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/biobert/scripts/ner_bc5cdr-chem.sh b/TensorFlow/LanguageModeling/BERT/biobert/scripts/ner_bc5cdr-chem.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/biobert/scripts/ner_bc5cdr-disease.sh b/TensorFlow/LanguageModeling/BERT/biobert/scripts/ner_bc5cdr-disease.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/biobert/scripts/rel_chemprot.sh b/TensorFlow/LanguageModeling/BERT/biobert/scripts/rel_chemprot.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/data/BooksDownloader.py b/TensorFlow/LanguageModeling/BERT/data/BooksDownloader.py deleted file mode 100644 index 53ee6c435..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/BooksDownloader.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2019 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. - -import subprocess - -class BooksDownloader: - def __init__(self, save_path): - self.save_path = save_path - pass - - - def download(self): - bookscorpus_download_command = 'python3 /workspace/bookcorpus/download_files.py --list /workspace/bookcorpus/url_list.jsonl --out' - bookscorpus_download_command += ' ' + self.save_path + '/bookscorpus' - bookscorpus_download_command += ' --trash-bad-count' - bookscorpus_download_process = subprocess.run(bookscorpus_download_command, shell=True, check=True) \ No newline at end of file diff --git a/TensorFlow/LanguageModeling/BERT/data/BookscorpusTextFormatting.py b/TensorFlow/LanguageModeling/BERT/data/BookscorpusTextFormatting.py deleted file mode 100644 index 22e48d4b2..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/BookscorpusTextFormatting.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2019 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. - -import glob -import os - -class BookscorpusTextFormatting: - def __init__(self, books_path, output_filename, recursive = False): - self.books_path = books_path - self.recursive = recursive - self.output_filename = output_filename - - - # This puts one book per line - def merge(self): - with open(self.output_filename, mode='w', newline='\n') as ofile: - for filename in glob.glob(self.books_path + '/' + '*.txt', recursive=True): - with open(filename, mode='r', encoding='utf-8-sig', newline='\n') as file: - for line in file: - if line.strip() != '': - ofile.write(line.strip() + ' ') - ofile.write("\n\n") \ No newline at end of file diff --git a/TensorFlow/LanguageModeling/BERT/data/ChemProtTextFormatting.py b/TensorFlow/LanguageModeling/BERT/data/ChemProtTextFormatting.py deleted file mode 100644 index 44c80505d..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/ChemProtTextFormatting.py +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright (c) 2019 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. - -import os -import csv -import zipfile -import argparse -import re - -class ChemProtTextFormatting: - """A basic formatter to preprocess the chemprot dataset. - """ - - def __init__(self, input_folder, output_folder): - - chemprot_folder = input_folder - with zipfile.ZipFile(os.path.join(chemprot_folder, "ChemProt_Corpus.zip"), "r") as zip: - zip.extractall(chemprot_folder) - - chemprot_folder = os.path.join(input_folder, "ChemProt_Corpus") - - with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_development.zip")) as zip: - zip.extractall(chemprot_folder) - - if not os.path.exists(output_folder): - os.makedirs(output_folder) - - self.format(os.path.join(chemprot_folder, "chemprot_development"), - "chemprot_development_entities.tsv", "chemprot_development_relations.tsv", - "chemprot_development_abstracts.tsv", os.path.join(output_folder, "dev.tsv")) - - with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_test_gs.zip")) as zip: - zip.extractall(chemprot_folder) - self.format(os.path.join(chemprot_folder, "chemprot_test_gs"), - "chemprot_test_entities_gs.tsv", "chemprot_test_relations_gs.tsv", - "chemprot_test_abstracts_gs.tsv", os.path.join(output_folder, "test.tsv")) - - with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_training.zip")) as zip: - zip.extractall(chemprot_folder) - self.format(os.path.join(chemprot_folder, "chemprot_training"), - "chemprot_training_entities.tsv", "chemprot_training_relations.tsv", - "chemprot_training_abstracts.tsv", os.path.join(output_folder, "train.tsv")) - - - - def format(self, chemprot_path, entity_filename, relations_filename, abstracts_filename, output_filename): - """ - Constructs ChemProt dataset for Relation Extraction. - - Args: - chemprot_path: Path to files - entity_filename: Contains labelled mention annotations of chemical compounds and genes/proteins. - - relations_filename: Contains a subset of chemical-protein relations annotations for the Chemprot dataset - - abstracts_filename: Contains plain text CHEMPROT PubMed Data - <Abstract of the Article> - output_filename: Path to output file that will contain preprocessed data - <PMID.EntityNumber1.EntityNumber2> <Preprocessed Sentence> <CPR Group> - """ - - data = {} - train_entities = csv.reader(open(os.path.join(chemprot_path, entity_filename), - mode="r"), delimiter="\t") - for entity in train_entities: - id = entity[0] - if data.get(id, None) is None: - data[id] = {"relations":{}, "entities":{"CHEMICAL":{}, "GENE":{}}} - data[id]["entities"]["CHEMICAL" if entity[2] == "CHEMICAL" else "GENE"][entity[1]] = (int(entity[3]), int(entity[4]), entity[2]) - - train_relations=csv.reader(open(os.path.join(chemprot_path, relations_filename), - mode="r"), delimiter="\t") - for relation in train_relations: - try: - id = relation[0] - data[id]["relations"][(relation[4].split("Arg1:")[-1], relation[5].split("Arg2:")[-1])] = relation[1] if relation[2] == "Y " else "false" - except: - print("invalid id") - raise ValueError - # print(data[list(data.keys())[0]]) - - with open(output_filename, 'w') as ofile: - train_abstracts = csv.reader(open(os.path.join(chemprot_path, abstracts_filename), - mode="r"), delimiter="\t") - owriter = csv.writer(ofile, delimiter='\t', lineterminator=os.linesep) - owriter.writerow(["index", "sentence", "label"]) - - num_sentences = 0 - rejected = 0 - for abstract in train_abstracts: - id = abstract[0] - line = abstract[1] + "\n" + abstract[2] - - for tag1 in data[id]["entities"]["CHEMICAL"].keys(): - for tag2 in data[id]["entities"]["GENE"].keys(): - tag1_details = data[id]["entities"]["CHEMICAL"][tag1] - tag2_details = data[id]["entities"]["GENE"][tag2] - if ((tag1_details[0] <= tag2_details[0] and tag2_details[0] <= tag1_details[1]) # x1 <= y1 <= x2 - or (tag1_details[0] <= tag2_details[1] and tag2_details[0] <= tag1_details[1])): # x1 <= y2 <= x2 - continue - - relation = data[id]["relations"].get((tag2, tag1), None) - relation = data[id]["relations"].get((tag1, tag2), None) if relation is None else relation - if relation is None: - relation = "false" - - start = 0 - line_protected = re.sub(r"(.)\.(?=[\d])", r"\1[PROTECTED_DOT]", line) - for sentence in re.split(r'\.|\?', line_protected): - sentence = sentence.replace("[PROTECTED_DOT]", ".") - original_sentence = sentence - end = start + len(sentence) - - if (tag1_details[0] >= start and tag1_details[1] <= end) and \ - (tag2_details[0] >= start and tag2_details[1] <= end): - for offset_start, offset_end, value in sorted(list(data[id]["entities"]["CHEMICAL"].values()) + list(data[id]["entities"]["GENE"].values()), - reverse=True): - if (offset_start, offset_end) == (tag1_details[0], tag1_details[1]) or (offset_start, offset_end) == (tag2_details[0], tag2_details[1]): - if sentence[offset_start - start] == "@": - offset_end = start + sentence.find('$',offset_start - start) + 1 - word = value - elif offset_start < start or offset_end > end or sentence[offset_start - start] == "@": - continue - else: - word = "OTHER" - sentence = sentence[:offset_start-start] + "@" + word + "$" + sentence[offset_end-start:] - sentence = sentence.strip() - owriter.writerow([id+"."+tag1+"."+tag2, sentence, relation]) - num_sentences += 1 - if id == "23538201" and start == 1048: - print("Accepted", tag1, tag2) - - else: - rejected += 1 - - start = end + 1 - print("Succesfully written {} samples to {}".format(num_sentences, output_filename)) - print("Rejected are", rejected) - - -if __name__=="__main__": - parser = argparse.ArgumentParser( - description='Preprocessing Application for ChemProt' - ) - - parser.add_argument( - '--input_folder', - type=str, - help='Specify the input files in a comma-separated list (no spaces)' - ) - parser.add_argument( - '--output_folder', - type=str, - help='Specify the input files in a comma-separated list (no spaces)' - ) - - - args = parser.parse_args() - preprocess_chemprot = ChemProtTextFormatting(args.input_folder, args.output_folder) \ No newline at end of file diff --git a/TensorFlow/LanguageModeling/BERT/data/Downloader.py b/TensorFlow/LanguageModeling/BERT/data/Downloader.py deleted file mode 100644 index bb5c62874..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/Downloader.py +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright (c) 2019 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. - -from GooglePretrainedWeightDownloader import GooglePretrainedWeightDownloader -from NVIDIAPretrainedWeightDownloader import NVIDIAPretrainedWeightDownloader -from WikiDownloader import WikiDownloader -from BooksDownloader import BooksDownloader -from GLUEDownloader import GLUEDownloader -from SquadDownloader import SquadDownloader -from PubMedDownloader import PubMedDownloader - -class Downloader: - def __init__(self, dataset_name, save_path): - self.dataset_name = dataset_name - self.save_path = save_path - - - def download(self): - if self.dataset_name == 'bookscorpus': - self.download_bookscorpus() - - elif self.dataset_name == 'wikicorpus_en': - self.download_wikicorpus('en') - - elif self.dataset_name == 'wikicorpus_zh': - self.download_wikicorpus('zh') - - elif self.dataset_name == 'pubmed_baseline': - self.download_pubmed('baseline') - - elif self.dataset_name == 'pubmed_daily_update': - self.download_pubmed('daily_update') - - elif self.dataset_name == 'pubmed_fulltext': - self.download_pubmed('fulltext') - - elif self.dataset_name == 'pubmed_open_access': - self.download_pubmed('open_access') - - elif self.dataset_name == 'google_pretrained_weights': - self.download_google_pretrained_weights() - - elif self.dataset_name == 'nvidia_pretrained_weights': - self.download_nvidia_pretrained_weights() - - elif self.dataset_name == 'mrpc': - self.download_glue(self.dataset_name) - - elif self.dataset_name == 'mnli': - self.download_glue(self.dataset_name) - - elif self.dataset_name == 'cola': - self.download_glue(self.dataset_name) - elif self.dataset_name == 'sst-2': - self.download_glue(self.dataset_name) - - elif self.dataset_name == 'squad': - self.download_squad() - - elif self.dataset_name == 'all': - self.download_bookscorpus() - self.download_wikicorpus('en') - self.download_wikicorpus('zh') - self.download_pubmed('baseline') - self.download_pubmed('daily_update') - self.download_pubmed('fulltext') - self.download_pubmed('open_access') - self.download_google_pretrained_weights() - self.download_nvidia_pretrained_weights() - self.download_glue("cola") - self.download_glue("mnli") - self.download_glue("mrpc") - self.download_glue("sst-2") - self.download_squad() - - else: - print(self.dataset_name) - assert False, 'Unknown dataset_name provided to downloader' - - - def download_bookscorpus(self): - downloader = BooksDownloader(self.save_path) - downloader.download() - - - def download_wikicorpus(self, language): - downloader = WikiDownloader(language, self.save_path) - downloader.download() - - - def download_pubmed(self, subset): - downloader = PubMedDownloader(subset, self.save_path) - downloader.download() - - - def download_google_pretrained_weights(self): - downloader = GooglePretrainedWeightDownloader(self.save_path) - downloader.download() - - - def download_nvidia_pretrained_weights(self): - downloader = NVIDIAPretrainedWeightDownloader(self.save_path) - downloader.download() - - - def download_glue(self, glue_task_name): - downloader = GLUEDownloader(self.save_path) - downloader.download(glue_task_name) - - - def download_squad(self): - downloader = SquadDownloader(self.save_path) - downloader.download() diff --git a/TensorFlow/LanguageModeling/BERT/data/GLUEDownloader.py b/TensorFlow/LanguageModeling/BERT/data/GLUEDownloader.py deleted file mode 100644 index abff16594..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/GLUEDownloader.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2019 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. - -import sys -import wget - -from pathlib import Path - - -def mkdir(path): - Path(path).mkdir(parents=True, exist_ok=True) - - -class GLUEDownloader: - - def __init__(self, save_path): - self.save_path = save_path + '/glue' - - def download(self, task_name): - mkdir(self.save_path) - if task_name in {'mrpc', 'mnli'}: - task_name = task_name.upper() - elif task_name == 'cola': - task_name = 'CoLA' - else: # SST-2 - assert task_name == 'sst-2' - task_name = 'SST' - wget.download( - 'https://gist.githubusercontent.com/W4ngatang/60c2bdb54d156a41194446737ce03e2e/raw/1502038877f6a88c225a34450793fbc3ea87eaba/download_glue_data.py', - out=self.save_path, - ) - sys.path.append(self.save_path) - import download_glue_data - download_glue_data.main( - ['--data_dir', self.save_path, '--tasks', task_name]) - sys.path.pop() diff --git a/TensorFlow/LanguageModeling/BERT/data/GooglePretrainedWeightDownloader.py b/TensorFlow/LanguageModeling/BERT/data/GooglePretrainedWeightDownloader.py deleted file mode 100644 index bb0684d34..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/GooglePretrainedWeightDownloader.py +++ /dev/null @@ -1,158 +0,0 @@ -# Copyright (c) 2019 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. - -import hashlib -import os -import urllib.request -import zipfile - -class GooglePretrainedWeightDownloader: - def __init__(self, save_path): - self.save_path = save_path + '/google_pretrained_weights' - - if not os.path.exists(self.save_path): - os.makedirs(self.save_path) - - # Download urls - self.model_urls = { - 'bert_base_uncased': ('https://storage.googleapis.com/bert_models/2018_10_18/uncased_L-12_H-768_A-12.zip', 'uncased_L-12_H-768_A-12.zip'), - 'bert_large_uncased': ('https://storage.googleapis.com/bert_models/2018_10_18/uncased_L-24_H-1024_A-16.zip', 'uncased_L-24_H-1024_A-16.zip'), - 'bert_base_cased': ('https://storage.googleapis.com/bert_models/2018_10_18/cased_L-12_H-768_A-12.zip', 'cased_L-12_H-768_A-12.zip'), - 'bert_large_cased': ('https://storage.googleapis.com/bert_models/2018_10_18/cased_L-24_H-1024_A-16.zip', 'cased_L-24_H-1024_A-16.zip'), - 'bert_base_multilingual_cased': ('https://storage.googleapis.com/bert_models/2018_11_23/multi_cased_L-12_H-768_A-12.zip', 'multi_cased_L-12_H-768_A-12.zip'), - 'bert_large_multilingual_uncased': ('https://storage.googleapis.com/bert_models/2018_11_03/multilingual_L-12_H-768_A-12.zip', 'multilingual_L-12_H-768_A-12.zip'), - 'bert_base_chinese': ('https://storage.googleapis.com/bert_models/2018_11_03/chinese_L-12_H-768_A-12.zip', 'chinese_L-12_H-768_A-12.zip') - } - - # SHA256sum verification for file download integrity (and checking for changes from the download source over time) - self.bert_base_uncased_sha = { - 'bert_config.json': '7b4e5f53efbd058c67cda0aacfafb340113ea1b5797d9ce6ee411704ba21fcbc', - 'bert_model.ckpt.data-00000-of-00001': '58580dc5e0bf0ae0d2efd51d0e8272b2f808857f0a43a88aaf7549da6d7a8a84', - 'bert_model.ckpt.index': '04c1323086e2f1c5b7c0759d8d3e484afbb0ab45f51793daab9f647113a0117b', - 'bert_model.ckpt.meta': 'dd5682170a10c3ea0280c2e9b9a45fee894eb62da649bbdea37b38b0ded5f60e', - 'vocab.txt': '07eced375cec144d27c900241f3e339478dec958f92fddbc551f295c992038a3', - } - - self.bert_large_uncased_sha = { - 'bert_config.json': 'bfa42236d269e2aeb3a6d30412a33d15dbe8ea597e2b01dc9518c63cc6efafcb', - 'bert_model.ckpt.data-00000-of-00001': 'bc6b3363e3be458c99ecf64b7f472d2b7c67534fd8f564c0556a678f90f4eea1', - 'bert_model.ckpt.index': '68b52f2205ffc64dc627d1120cf399c1ef1cbc35ea5021d1afc889ffe2ce2093', - 'bert_model.ckpt.meta': '6fcce8ff7628f229a885a593625e3d5ff9687542d5ef128d9beb1b0c05edc4a1', - 'vocab.txt': '07eced375cec144d27c900241f3e339478dec958f92fddbc551f295c992038a3', - } - - self.bert_base_cased_sha = { - 'bert_config.json': 'f11dfb757bea16339a33e1bf327b0aade6e57fd9c29dc6b84f7ddb20682f48bc', - 'bert_model.ckpt.data-00000-of-00001': '734d5a1b68bf98d4e9cb6b6692725d00842a1937af73902e51776905d8f760ea', - 'bert_model.ckpt.index': '517d6ef5c41fc2ca1f595276d6fccf5521810d57f5a74e32616151557790f7b1', - 'bert_model.ckpt.meta': '5f8a9771ff25dadd61582abb4e3a748215a10a6b55947cbb66d0f0ba1694be98', - 'vocab.txt': 'eeaa9875b23b04b4c54ef759d03db9d1ba1554838f8fb26c5d96fa551df93d02', - } - - self.bert_large_cased_sha = { - 'bert_config.json': '7adb2125c8225da495656c982fd1c5f64ba8f20ad020838571a3f8a954c2df57', - 'bert_model.ckpt.data-00000-of-00001': '6ff33640f40d472f7a16af0c17b1179ca9dcc0373155fb05335b6a4dd1657ef0', - 'bert_model.ckpt.index': 'ef42a53f577fbe07381f4161b13c7cab4f4fc3b167cec6a9ae382c53d18049cf', - 'bert_model.ckpt.meta': 'd2ddff3ed33b80091eac95171e94149736ea74eb645e575d942ec4a5e01a40a1', - 'vocab.txt': 'eeaa9875b23b04b4c54ef759d03db9d1ba1554838f8fb26c5d96fa551df93d02', - } - - self.bert_base_multilingual_cased_sha = { - 'bert_config.json': 'e76c3964bc14a8bb37a5530cdc802699d2f4a6fddfab0611e153aa2528f234f0', - 'bert_model.ckpt.data-00000-of-00001': '55b8a2df41f69c60c5180e50a7c31b7cdf6238909390c4ddf05fbc0d37aa1ac5', - 'bert_model.ckpt.index': '7d8509c2a62b4e300feb55f8e5f1eef41638f4998dd4d887736f42d4f6a34b37', - 'bert_model.ckpt.meta': '95e5f1997e8831f1c31e5cf530f1a2e99f121e9cd20887f2dce6fe9e3343e3fa', - 'vocab.txt': 'fe0fda7c425b48c516fc8f160d594c8022a0808447475c1a7c6d6479763f310c', - } - - self.bert_large_multilingual_uncased_sha = { - 'bert_config.json': '49063bb061390211d2fdd108cada1ed86faa5f90b80c8f6fdddf406afa4c4624', - 'bert_model.ckpt.data-00000-of-00001': '3cd83912ebeb0efe2abf35c9f1d5a515d8e80295e61c49b75c8853f756658429', - 'bert_model.ckpt.index': '87c372c1a3b1dc7effaaa9103c80a81b3cbab04c7933ced224eec3b8ad2cc8e7', - 'bert_model.ckpt.meta': '27f504f34f02acaa6b0f60d65195ec3e3f9505ac14601c6a32b421d0c8413a29', - 'vocab.txt': '87b44292b452f6c05afa49b2e488e7eedf79ea4f4c39db6f2f4b37764228ef3f', - } - - self.bert_base_chinese_sha = { - 'bert_config.json': '7aaad0335058e2640bcb2c2e9a932b1cd9da200c46ea7b8957d54431f201c015', - 'bert_model.ckpt.data-00000-of-00001': '756699356b78ad0ef1ca9ba6528297bcb3dd1aef5feadd31f4775d7c7fc989ba', - 'bert_model.ckpt.index': '46315546e05ce62327b3e2cd1bed22836adcb2ff29735ec87721396edb21b82e', - 'bert_model.ckpt.meta': 'c0f8d51e1ab986604bc2b25d6ec0af7fd21ff94cf67081996ec3f3bf5d823047', - 'vocab.txt': '45bbac6b341c319adc98a532532882e91a9cefc0329aa57bac9ae761c27b291c', - } - - # Relate SHA to urls for loop below - self.model_sha = { - 'bert_base_uncased': self.bert_base_uncased_sha, - 'bert_large_uncased': self.bert_large_uncased_sha, - 'bert_base_cased': self.bert_base_cased_sha, - 'bert_large_cased': self.bert_large_cased_sha, - 'bert_base_multilingual_cased': self.bert_base_multilingual_cased_sha, - 'bert_large_multilingual_uncased': self.bert_large_multilingual_uncased_sha, - 'bert_base_chinese': self.bert_base_chinese_sha - } - - # Helper to get sha256sum of a file - def sha256sum(self, filename): - h = hashlib.sha256() - b = bytearray(128*1024) - mv = memoryview(b) - with open(filename, 'rb', buffering=0) as f: - for n in iter(lambda : f.readinto(mv), 0): - h.update(mv[:n]) - - return h.hexdigest() - - def download(self): - # Iterate over urls: download, unzip, verify sha256sum - found_mismatch_sha = False - for model in self.model_urls: - url = self.model_urls[model][0] - file = self.save_path + '/' + self.model_urls[model][1] - - print('Downloading', url) - response = urllib.request.urlopen(url) - with open(file, 'wb') as handle: - handle.write(response.read()) - - print('Unzipping', file) - zip = zipfile.ZipFile(file, 'r') - zip.extractall(self.save_path) - zip.close() - - sha_dict = self.model_sha[model] - for extracted_file in sha_dict: - sha = sha_dict[extracted_file] - if sha != self.sha256sum(file[:-4] + '/' + extracted_file): - found_mismatch_sha = True - print('SHA256sum does not match on file:', extracted_file, 'from download url:', url) - else: - print(file[:-4] + '/' + extracted_file, '\t', 'verified') - - if not found_mismatch_sha: - print("All downloads pass sha256sum verification.") - - def serialize(self): - pass - - def deserialize(self): - pass - - def listAvailableWeights(self): - print("Available Weight Datasets") - for item in self.model_urls: - print(item) - - def listLocallyStoredWeights(self): - pass - diff --git a/TensorFlow/LanguageModeling/BERT/data/NVIDIAPretrainedWeightDownloader.py b/TensorFlow/LanguageModeling/BERT/data/NVIDIAPretrainedWeightDownloader.py deleted file mode 100644 index 13c9a3204..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/NVIDIAPretrainedWeightDownloader.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2019 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. - -import os - -class NVIDIAPretrainedWeightDownloader: - def __init__(self, save_path): - self.save_path = save_path + '/nvidia_pretrained_weights' - - if not os.path.exists(self.save_path): - os.makedirs(self.save_path) - - pass - - - def download(self): - assert False, 'NVIDIAPretrainedWeightDownloader not implemented yet.' \ No newline at end of file diff --git a/TensorFlow/LanguageModeling/BERT/data/PubMedDownloader.py b/TensorFlow/LanguageModeling/BERT/data/PubMedDownloader.py deleted file mode 100644 index a2aef07ab..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/PubMedDownloader.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) 2019 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. - -import bz2 -import glob -import gzip -import os -import urllib.request -import shutil -import sys - -class PubMedDownloader: - def __init__(self, subset, save_path): - self.subset = subset - # Modifying self.save_path in two steps to handle creation of subdirectories - self.save_path = save_path + '/pubmed' + '/' - - if not os.path.exists(self.save_path): - os.makedirs(self.save_path) - - self.save_path = self.save_path + '/' + subset - - if not os.path.exists(self.save_path): - os.makedirs(self.save_path) - - self.download_urls = { - 'baseline' : 'ftp://ftp.ncbi.nlm.nih.gov/pubmed/baseline/', - 'daily_update' : 'ftp://ftp.ncbi.nlm.nih.gov/pubmed/updatefiles/', - 'fulltext' : 'ftp://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_bulk/', - 'open_access' : 'ftp://ftp.ncbi.nlm.nih.gov/pub/pmc/oa_bulk/' - } - - - def download(self): - print('subset:', self.subset) - url = self.download_urls[self.subset] - self.download_files(url) - self.extract_files() - - - def download_files(self, url): - url = self.download_urls[self.subset] - output = os.popen('curl ' + url).read() - - if self.subset == 'fulltext' or self.subset == 'open_access': - line_split = 'comm_use' if self.subset == 'fulltext' else 'non_comm_use' - for line in output.splitlines(): - if line[-10:] == 'xml.tar.gz' and \ - line.split(' ')[-1].split('.')[0] == line_split: - file = os.path.join(self.save_path, line.split(' ')[-1]) - if not os.path.isfile(file): - print('Downloading', file) - response = urllib.request.urlopen(url + line.split(' ')[-1]) - with open(file, "wb") as handle: - handle.write(response.read()) - - elif self.subset == 'baseline' or self.subset == 'daily_update': - for line in output.splitlines(): - if line[-3:] == '.gz': - file = os.path.join(self.save_path, line.split(' ')[-1]) - if not os.path.isfile(file): - print('Downloading', file) - response = urllib.request.urlopen(url + line.split(' ')[-1]) - with open(file, "wb") as handle: - handle.write(response.read()) - else: - assert False, 'Invalid PubMed dataset/subset specified.' - - def extract_files(self): - files = glob.glob(self.save_path + '/*.xml.gz') - - for file in files: - print('file:', file) - input = gzip.GzipFile(file, mode='rb') - s = input.read() - input.close() - - out = open(file[:-3], mode='wb') - out.write(s) - out.close() - - - diff --git a/TensorFlow/LanguageModeling/BERT/data/PubMedTextFormatting.py b/TensorFlow/LanguageModeling/BERT/data/PubMedTextFormatting.py deleted file mode 100644 index df8517896..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/PubMedTextFormatting.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2019 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. - -import glob -import os -import pubmed_parser as pmp - -class PubMedTextFormatting: - def __init__(self, pubmed_path, output_filename, recursive = False): - self.pubmed_path = pubmed_path - self.recursive = recursive - self.output_filename = output_filename - - - # This puts one article per line - def merge(self): - print('PubMed path:', self.pubmed_path) - - with open(self.output_filename, mode='w', newline='\n') as ofile: - for filename in glob.glob(self.pubmed_path + '/*.xml*', recursive=self.recursive): - print('file:', filename) - dicts_out = pmp.parse_medline_xml(filename) - for dict_out in dicts_out: - if not dict_out['abstract']: - continue - try: - for line in dict_out['abstract'].splitlines(): - if len(line) < 30: - continue - ofile.write(line.strip() + " ") - ofile.write("\n\n") - except: - ofile.write("\n\n") - continue diff --git a/TensorFlow/LanguageModeling/BERT/data/README.md b/TensorFlow/LanguageModeling/BERT/data/README.md deleted file mode 100644 index d7544daaf..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/README.md +++ /dev/null @@ -1,32 +0,0 @@ -Steps to reproduce datasets from web - -1) Build the container - * docker build -t bert_tf . -2) Run the container interactively - * nvidia-docker run -it --ipc=host bert_tf - * Optional: Mount data volumes - * -v yourpath:/workspace/bert/data/wikipedia_corpus/download - * -v yourpath:/workspace/bert/data/wikipedia_corpus/extracted_articles - * -v yourpath:/workspace/bert/data/wikipedia_corpus/raw_data - * -v yourpath:/workspace/bert/data/wikipedia_corpus/intermediate_files - * -v yourpath:/workspace/bert/data/wikipedia_corpus/final_text_file_single - * -v yourpath:/workspace/bert/data/wikipedia_corpus/final_text_files_sharded - * -v yourpath:/workspace/bert/data/wikipedia_corpus/final_tfrecords_sharded - * -v yourpath:/workspace/bert/data/bookcorpus/download - * -v yourpath:/workspace/bert/data/bookcorpus/final_text_file_single - * -v yourpath:/workspace/bert/data/bookcorpus/final_text_files_sharded - * -v yourpath:/workspace/bert/data/bookcorpus/final_tfrecords_sharded - * Optional: Select visible GPUs - * -e CUDA_VISIBLE_DEVICES=0 - -** Inside of the container starting here** -3) Download pretrained weights (they contain vocab files for preprocessing) - * cd data/pretrained_models_google && python3 download_models.py -4) "One-click" SQuAD download - * cd /workspace/bert/data/squad && . squad_download.sh -5) "One-click" Wikipedia data download and prep (provides tfrecords) - * Set your configuration in data/wikipedia_corpus/config.sh - * cd /data/wikipedia_corpus && ./run_preprocessing.sh -6) "One-click" BookCorpus data download and prep (provided tfrecords) - * Set your configuration in data/wikipedia_corpus/config.sh - * cd /data/bookcorpus && ./run_preprocessing.sh diff --git a/TensorFlow/LanguageModeling/BERT/data/SquadDownloader.py b/TensorFlow/LanguageModeling/BERT/data/SquadDownloader.py deleted file mode 100644 index 6d64ffc69..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/SquadDownloader.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2019 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. - -import bz2 -import os -import urllib.request -import sys - -class SquadDownloader: - def __init__(self, save_path): - self.save_path = save_path + '/squad' - - if not os.path.exists(self.save_path): - os.makedirs(self.save_path) - - if not os.path.exists(self.save_path + '/v1.1'): - os.makedirs(self.save_path + '/v1.1') - - if not os.path.exists(self.save_path + '/v2.0'): - os.makedirs(self.save_path + '/v2.0') - - self.download_urls = { - 'https://rajpurkar.github.io/SQuAD-explorer/dataset/train-v1.1.json' : 'v1.1/train-v1.1.json', - 'https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v1.1.json' : 'v1.1/dev-v1.1.json', - 'https://worksheets.codalab.org/rest/bundles/0xbcd57bee090b421c982906709c8c27e1/contents/blob/' : 'v1.1/evaluate-v1.1.py', - 'https://rajpurkar.github.io/SQuAD-explorer/dataset/train-v2.0.json' : 'v2.0/train-v2.0.json', - 'https://rajpurkar.github.io/SQuAD-explorer/dataset/dev-v2.0.json' : 'v2.0/dev-v2.0.json', - 'https://worksheets.codalab.org/rest/bundles/0x6b567e1cf2e041ec80d7098f031c5c9e/contents/blob/' : 'v2.0/evaluate-v2.0.py', - } - - def download(self): - for item in self.download_urls: - url = item - file = self.download_urls[item] - - print('Downloading:', url) - if os.path.isfile(self.save_path + '/' + file): - print('** Download file already exists, skipping download') - else: - response = urllib.request.urlopen(url) - with open(self.save_path + '/' + file, "wb") as handle: - handle.write(response.read()) - - diff --git a/TensorFlow/LanguageModeling/BERT/data/TextSharding.py b/TensorFlow/LanguageModeling/BERT/data/TextSharding.py deleted file mode 100644 index 85012a53c..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/TextSharding.py +++ /dev/null @@ -1,331 +0,0 @@ -# Copyright (c) 2019 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. - -from collections import defaultdict -from itertools import islice - -import multiprocessing -import os -import statistics - -class Sharding: - def __init__(self, input_files, output_name_prefix, n_training_shards, n_test_shards, fraction_test_set): - assert len(input_files) > 0, 'The input file list must contain at least one file.' - assert n_training_shards > 0, 'There must be at least one output shard.' - assert n_test_shards > 0, 'There must be at least one output shard.' - - self.n_training_shards = n_training_shards - self.n_test_shards = n_test_shards - self.fraction_test_set = fraction_test_set - - self.input_files = input_files - - self.output_name_prefix = output_name_prefix - self.output_training_identifier = '_training' - self.output_test_identifier = '_test' - self.output_file_extension = '.txt' - - self.articles = {} # key: integer identifier, value: list of articles - self.sentences = {} # key: integer identifier, value: list of sentences - self.output_training_files = {} # key: filename, value: list of articles to go into file - self.output_test_files = {} # key: filename, value: list of articles to go into file - - self.init_output_files() - - - # Remember, the input files contain one article per line (the whitespace check is to skip extraneous blank lines) - def load_articles(self): - print('Start: Loading Articles') - - global_article_count = 0 - for input_file in self.input_files: - print('input file:', input_file) - with open(input_file, mode='r', newline='\n') as f: - for i, line in enumerate(f): - if line.strip(): - self.articles[global_article_count] = line.rstrip() - global_article_count += 1 - - print('End: Loading Articles: There are', len(self.articles), 'articles.') - - - def segment_articles_into_sentences(self, segmenter): - print('Start: Sentence Segmentation') - if len(self.articles) is 0: - self.load_articles() - - assert len(self.articles) is not 0, 'Please check that input files are present and contain data.' - - # TODO: WIP: multiprocessing (create independent ranges and spawn processes) - use_multiprocessing = 'serial' - - def chunks(data, size=len(self.articles)): - it = iter(data) - for i in range(0, len(data), size): - yield {k: data[k] for k in islice(it, size)} - - if use_multiprocessing == 'manager': - manager = multiprocessing.Manager() - return_dict = manager.dict() - jobs = [] - n_processes = 7 # in addition to the main process, total = n_proc+1 - - def work(articles, return_dict): - sentences = {} - for i, article in enumerate(articles): - sentences[i] = segmenter.segment_string(articles[article]) - - if i % 5000 == 0: - print('Segmenting article', i) - - return_dict.update(sentences) - - for item in chunks(self.articles, len(self.articles)): - p = multiprocessing.Process(target=work, args=(item, return_dict)) - - # Busy wait - while len(jobs) >= n_processes: - pass - - jobs.append(p) - p.start() - - for proc in jobs: - proc.join() - - elif use_multiprocessing == 'queue': - work_queue = multiprocessing.Queue() - jobs = [] - - for item in chunks(self.articles, len(self.articles)): - pass - - else: # serial option - for i, article in enumerate(self.articles): - self.sentences[i] = segmenter.segment_string(self.articles[article]) - - if i % 5000 == 0: - print('Segmenting article', i) - - print('End: Sentence Segmentation') - - - def init_output_files(self): - print('Start: Init Output Files') - assert len(self.output_training_files) is 0, 'Internal storage self.output_files already contains data. This function is intended to be used by the constructor only.' - assert len(self.output_test_files) is 0, 'Internal storage self.output_files already contains data. This function is intended to be used by the constructor only.' - - for i in range(self.n_training_shards): - name = self.output_name_prefix + self.output_training_identifier + '_' + str(i) + self.output_file_extension - self.output_training_files[name] = [] - - for i in range(self.n_test_shards): - name = self.output_name_prefix + self.output_test_identifier + '_' + str(i) + self.output_file_extension - self.output_test_files[name] = [] - - print('End: Init Output Files') - - - def get_sentences_per_shard(self, shard): - result = 0 - for article_id in shard: - result += len(self.sentences[article_id]) - - return result - - - def distribute_articles_over_shards(self): - print('Start: Distribute Articles Over Shards') - assert len(self.articles) >= self.n_training_shards + self.n_test_shards, 'There are fewer articles than shards. Please add more data or reduce the number of shards requested.' - - # Create dictionary with - key: sentence count per article, value: article id number - sentence_counts = defaultdict(lambda: []) - - max_sentences = 0 - total_sentences = 0 - - for article_id in self.sentences: - current_length = len(self.sentences[article_id]) - sentence_counts[current_length].append(article_id) - max_sentences = max(max_sentences, current_length) - total_sentences += current_length - - n_sentences_assigned_to_training = int((1 - self.fraction_test_set) * total_sentences) - nominal_sentences_per_training_shard = n_sentences_assigned_to_training // self.n_training_shards - nominal_sentences_per_test_shard = (total_sentences - n_sentences_assigned_to_training) // self.n_test_shards - - consumed_article_set = set({}) - unused_article_set = set(self.articles.keys()) - - # Make first pass and add one article worth of lines per file - for file in self.output_training_files: - current_article_id = sentence_counts[max_sentences][-1] - sentence_counts[max_sentences].pop(-1) - self.output_training_files[file].append(current_article_id) - consumed_article_set.add(current_article_id) - unused_article_set.remove(current_article_id) - - # Maintain the max sentence count - while len(sentence_counts[max_sentences]) == 0 and max_sentences > 0: - max_sentences -= 1 - - if len(self.sentences[current_article_id]) > nominal_sentences_per_training_shard: - nominal_sentences_per_training_shard = len(self.sentences[current_article_id]) - print('Warning: A single article contains more than the nominal number of sentences per training shard.') - - for file in self.output_test_files: - current_article_id = sentence_counts[max_sentences][-1] - sentence_counts[max_sentences].pop(-1) - self.output_test_files[file].append(current_article_id) - consumed_article_set.add(current_article_id) - unused_article_set.remove(current_article_id) - - # Maintain the max sentence count - while len(sentence_counts[max_sentences]) == 0 and max_sentences > 0: - max_sentences -= 1 - - if len(self.sentences[current_article_id]) > nominal_sentences_per_test_shard: - nominal_sentences_per_test_shard = len(self.sentences[current_article_id]) - print('Warning: A single article contains more than the nominal number of sentences per test shard.') - - training_counts = [] - test_counts = [] - - for shard in self.output_training_files: - training_counts.append(self.get_sentences_per_shard(self.output_training_files[shard])) - - for shard in self.output_test_files: - test_counts.append(self.get_sentences_per_shard(self.output_test_files[shard])) - - training_median = statistics.median(training_counts) - test_median = statistics.median(test_counts) - - # Make subsequent passes over files to find articles to add without going over limit - history_remaining = [] - n_history_remaining = 4 - - while len(consumed_article_set) < len(self.articles): - for fidx, file in enumerate(self.output_training_files): - nominal_next_article_size = min(nominal_sentences_per_training_shard - training_counts[fidx], max_sentences) - - # Maintain the max sentence count - while len(sentence_counts[max_sentences]) == 0 and max_sentences > 0: - max_sentences -= 1 - - while len(sentence_counts[nominal_next_article_size]) == 0 and nominal_next_article_size > 0: - nominal_next_article_size -= 1 - - if nominal_next_article_size not in sentence_counts or nominal_next_article_size is 0 or training_counts[fidx] > training_median: - continue # skip adding to this file, will come back later if no file can accept unused articles - - current_article_id = sentence_counts[nominal_next_article_size][-1] - sentence_counts[nominal_next_article_size].pop(-1) - - self.output_training_files[file].append(current_article_id) - consumed_article_set.add(current_article_id) - unused_article_set.remove(current_article_id) - - for fidx, file in enumerate(self.output_test_files): - nominal_next_article_size = min(nominal_sentences_per_test_shard - test_counts[fidx], max_sentences) - - # Maintain the max sentence count - while len(sentence_counts[max_sentences]) == 0 and max_sentences > 0: - max_sentences -= 1 - - while len(sentence_counts[nominal_next_article_size]) == 0 and nominal_next_article_size > 0: - nominal_next_article_size -= 1 - - if nominal_next_article_size not in sentence_counts or nominal_next_article_size is 0 or test_counts[fidx] > test_median: - continue # skip adding to this file, will come back later if no file can accept unused articles - - current_article_id = sentence_counts[nominal_next_article_size][-1] - sentence_counts[nominal_next_article_size].pop(-1) - - self.output_test_files[file].append(current_article_id) - consumed_article_set.add(current_article_id) - unused_article_set.remove(current_article_id) - - # If unable to place articles a few times, bump up nominal sizes by fraction until articles get placed - if len(history_remaining) == n_history_remaining: - history_remaining.pop(0) - history_remaining.append(len(unused_article_set)) - - history_same = True - for i in range(1, len(history_remaining)): - history_same = history_same and (history_remaining[i-1] == history_remaining[i]) - - if history_same: - nominal_sentences_per_training_shard += 1 - # nominal_sentences_per_test_shard += 1 - - training_counts = [] - test_counts = [] - for shard in self.output_training_files: - training_counts.append(self.get_sentences_per_shard(self.output_training_files[shard])) - - for shard in self.output_test_files: - test_counts.append(self.get_sentences_per_shard(self.output_test_files[shard])) - - training_median = statistics.median(training_counts) - test_median = statistics.median(test_counts) - - print('Distributing data over shards:', len(unused_article_set), 'articles remaining.') - - - if len(unused_article_set) != 0: - print('Warning: Some articles did not make it into output files.') - - - for shard in self.output_training_files: - print('Training shard:', self.get_sentences_per_shard(self.output_training_files[shard])) - - for shard in self.output_test_files: - print('Test shard:', self.get_sentences_per_shard(self.output_test_files[shard])) - - print('End: Distribute Articles Over Shards') - - - def write_shards_to_disk(self): - print('Start: Write Shards to Disk') - for shard in self.output_training_files: - self.write_single_shard(shard, self.output_training_files[shard], 'training') - - for shard in self.output_test_files: - self.write_single_shard(shard, self.output_test_files[shard], 'test') - - print('End: Write Shards to Disk') - - - def write_single_shard(self, shard_name, shard, split): - shard_split = os.path.split(shard_name) - shard_name = shard_split[0] + '/' + split + '/' + shard_split[1] - - with open(shard_name, mode='w', newline='\n') as f: - for article_id in shard: - for line in self.sentences[article_id]: - f.write(line + '\n') - - f.write('\n') # Line break between articles - - -import nltk - -nltk.download('punkt') - -class NLTKSegmenter: - def __init(self): - pass - - def segment_string(self, article): - return nltk.tokenize.sent_tokenize(article) - diff --git a/TensorFlow/LanguageModeling/BERT/data/WikiDownloader.py b/TensorFlow/LanguageModeling/BERT/data/WikiDownloader.py deleted file mode 100644 index bdc6e31a9..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/WikiDownloader.py +++ /dev/null @@ -1,60 +0,0 @@ -# Copyright (c) 2019 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. - -import bz2 -import os -import urllib.request -import sys -import subprocess - -class WikiDownloader: - def __init__(self, language, save_path): - self.save_path = save_path + '/wikicorpus_' + language - - if not os.path.exists(self.save_path): - os.makedirs(self.save_path) - - self.language = language - self.download_urls = { - 'en' : 'https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-pages-articles.xml.bz2', - 'zh' : 'https://dumps.wikimedia.org/zhwiki/latest/zhwiki-latest-pages-articles.xml.bz2' - } - - self.output_files = { - 'en' : 'wikicorpus_en.xml.bz2', - 'zh' : 'wikicorpus_zh.xml.bz2' - } - - - def download(self): - if self.language in self.download_urls: - url = self.download_urls[self.language] - filename = self.output_files[self.language] - - print('Downloading:', url) - if os.path.isfile(self.save_path + '/' + filename): - print('** Download file already exists, skipping download') - else: - cmd = ['wget', url, '--output-document={}'.format(self.save_path + '/' + filename)] - print('Running:', cmd) - status = subprocess.run(cmd) - if status.returncode != 0: - raise RuntimeError('Wiki download not successful') - - # Always unzipping since this is relatively fast and will overwrite - print('Unzipping:', self.output_files[self.language]) - subprocess.run('bzip2 -dk ' + self.save_path + '/' + filename, shell=True, check=True) - - else: - assert False, 'WikiDownloader not implemented for this language yet.' - diff --git a/TensorFlow/LanguageModeling/BERT/data/WikicorpusTextFormatting.py b/TensorFlow/LanguageModeling/BERT/data/WikicorpusTextFormatting.py deleted file mode 100644 index 9d356b136..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/WikicorpusTextFormatting.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2019 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. - -import glob -import os - -class WikicorpusTextFormatting: - def __init__(self, wiki_path, output_filename, recursive = False): - self.wiki_path = wiki_path - self.recursive = recursive - self.output_filename = output_filename - - - # This puts one article per line - def merge(self): - with open(self.output_filename, mode='w', newline='\n') as ofile: - for dirname in glob.glob(self.wiki_path + '/*/', recursive=False): - for filename in glob.glob(dirname + 'wiki_*', recursive=self.recursive): - print(filename) - article_lines = [] - article_open = False - - with open(filename, mode='r', newline='\n') as file: - for line in file: - if '<doc id=' in line: - article_open = True - elif '</doc>' in line: - article_open = False - for oline in article_lines[1:]: - if oline != '\n': - ofile.write(oline.rstrip() + " ") - ofile.write("\n\n") - article_lines = [] - else: - if article_open: - article_lines.append(line) \ No newline at end of file diff --git a/TensorFlow/LanguageModeling/BERT/data/__init__.py b/TensorFlow/LanguageModeling/BERT/data/__init__.py deleted file mode 100644 index d49f0d053..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/__init__.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2019 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. \ No newline at end of file diff --git a/TensorFlow/LanguageModeling/BERT/data/bertPrep.py b/TensorFlow/LanguageModeling/BERT/data/bertPrep.py deleted file mode 100644 index 9ca066a90..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/bertPrep.py +++ /dev/null @@ -1,388 +0,0 @@ -# Copyright (c) 2019 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. - -import BookscorpusTextFormatting -import Downloader -import TextSharding -import WikicorpusTextFormatting -import PubMedTextFormatting - -import argparse -import itertools -import multiprocessing -import os -import pprint -import subprocess - - -def main(args): - working_dir = os.environ['BERT_PREP_WORKING_DIR'] - - print('Working Directory:', working_dir) - print('Action:', args.action) - print('Dataset Name:', args.dataset) - - if args.input_files: - args.input_files = args.input_files.split(',') - - hdf5_tfrecord_folder_prefix = "/lower_case_" + str(args.do_lower_case) + "_seq_len_" + str(args.max_seq_length) \ - + "_max_pred_" + str(args.max_predictions_per_seq) + "_masked_lm_prob_" + str(args.masked_lm_prob) \ - + "_random_seed_" + str(args.random_seed) + "_dupe_factor_" + str(args.dupe_factor) \ - + "_shard_" + str(args.n_training_shards) + "_test_split_" + str(int(args.fraction_test_set * 100)) - directory_structure = { - 'download' : working_dir + '/download', # Downloaded and decompressed - 'extracted' : working_dir +'/extracted', # Extracted from whatever the initial format is (e.g., wikiextractor) - 'formatted' : working_dir + '/formatted_one_article_per_line', # This is the level where all sources should look the same - 'sharded' : working_dir + '/sharded', - 'tfrecord' : working_dir + '/tfrecord' + hdf5_tfrecord_folder_prefix, - 'hdf5': working_dir + '/hdf5'+ hdf5_tfrecord_folder_prefix, - } - - print('\nDirectory Structure:') - pp = pprint.PrettyPrinter(indent=2) - pp.pprint(directory_structure) - print('') - - if args.action == 'download': - if not os.path.exists(directory_structure['download']): - os.makedirs(directory_structure['download']) - - downloader = Downloader.Downloader(args.dataset, directory_structure['download']) - downloader.download() - - elif args.action == 'text_formatting': - assert args.dataset != 'google_pretrained_weights' and args.dataset != 'nvidia_pretrained_weights' \ - and args.dataset != 'squad' and args.dataset != 'mrpc' and args.dataset != 'cola' and \ - args.dataset != 'mnli' and args.dataset != 'sst-2', 'Cannot perform text_formatting on pretrained weights' - - if not os.path.exists(directory_structure['extracted']): - os.makedirs(directory_structure['extracted']) - - if not os.path.exists(directory_structure['formatted']): - os.makedirs(directory_structure['formatted']) - - if args.dataset == 'bookscorpus': - books_path = directory_structure['download'] + '/bookscorpus' - #books_path = directory_structure['download'] - output_filename = directory_structure['formatted'] + '/bookscorpus_one_book_per_line.txt' - books_formatter = BookscorpusTextFormatting.BookscorpusTextFormatting(books_path, output_filename, recursive=True) - books_formatter.merge() - - elif args.dataset == 'wikicorpus_en': - if args.skip_wikiextractor == 0: - path_to_wikiextractor_in_container = '/workspace/wikiextractor/WikiExtractor.py' - wikiextractor_command = path_to_wikiextractor_in_container + ' ' + directory_structure['download'] + '/' + args.dataset + '/wikicorpus_en.xml ' + '-b 100M --processes ' + str(args.n_processes) + ' -o ' + directory_structure['extracted'] + '/' + args.dataset - print('WikiExtractor Command:', wikiextractor_command) - wikiextractor_process = subprocess.run(wikiextractor_command, shell=True, check=True) - - wiki_path = directory_structure['extracted'] + '/wikicorpus_en' - output_filename = directory_structure['formatted'] + '/wikicorpus_en_one_article_per_line.txt' - wiki_formatter = WikicorpusTextFormatting.WikicorpusTextFormatting(wiki_path, output_filename, recursive=True) - wiki_formatter.merge() - - elif args.dataset == 'wikicorpus_zh': - assert False, 'wikicorpus_zh not fully supported at this time. The simplified/tradition Chinese data needs to be translated and properly segmented still, and should work once this step is added.' - if args.skip_wikiextractor == 0: - path_to_wikiextractor_in_container = '/workspace/wikiextractor/WikiExtractor.py' - wikiextractor_command = path_to_wikiextractor_in_container + ' ' + directory_structure['download'] + '/' + args.dataset + '/wikicorpus_zh.xml ' + '-b 100M --processes ' + str(args.n_processes) + ' -o ' + directory_structure['extracted'] + '/' + args.dataset - print('WikiExtractor Command:', wikiextractor_command) - wikiextractor_process = subprocess.run(wikiextractor_command, shell=True, check=True) - - wiki_path = directory_structure['extracted'] + '/wikicorpus_zh' - output_filename = directory_structure['formatted'] + '/wikicorpus_zh_one_article_per_line.txt' - wiki_formatter = WikicorpusTextFormatting.WikicorpusTextFormatting(wiki_path, output_filename, recursive=True) - wiki_formatter.merge() - - elif args.dataset == 'pubmed_baseline': - pubmed_path = directory_structure['download'] + '/pubmed' + '/baseline' - output_filename = directory_structure['formatted'] + '/pubmed_baseline_one_article_per_line.txt' - pubmed_formatter = PubMedTextFormatting.PubMedTextFormatting(pubmed_path, output_filename, recursive=True) - pubmed_formatter.merge() - - elif args.action == 'sharding': - # Note: books+wiki requires user to provide list of input_files (comma-separated with no spaces) - if args.dataset == 'bookscorpus' or 'wikicorpus' in args.dataset or 'books_wiki' in args.dataset or 'pubmed' in args.dataset: - if args.input_files is None: - if args.dataset == 'bookscorpus': - args.input_files = [directory_structure['formatted'] + '/bookscorpus_one_book_per_line.txt'] - elif args.dataset == 'wikicorpus_en': - args.input_files = [directory_structure['formatted'] + '/wikicorpus_en_one_article_per_line.txt'] - elif args.dataset == 'wikicorpus_zh': - args.input_files = [directory_structure['formatted'] + '/wikicorpus_zh_one_article_per_line.txt'] - elif args.dataset == 'books_wiki_en_corpus': - args.input_files = [directory_structure['formatted'] + '/bookscorpus_one_book_per_line.txt', directory_structure['formatted'] + '/wikicorpus_en_one_article_per_line.txt'] - elif args.dataset == 'pubmed_baseline': - args.input_files = [directory_structure['formatted'] + '/pubmed_baseline_one_article_per_line.txt'] - - output_file_prefix = directory_structure['sharded'] + '/' + args.dataset + '/' + args.dataset - - if not os.path.exists(directory_structure['sharded']): - os.makedirs(directory_structure['sharded']) - - if not os.path.exists(directory_structure['sharded'] + '/' + args.dataset): - os.makedirs(directory_structure['sharded'] + '/' + args.dataset) - - if not os.path.exists(directory_structure['sharded'] + '/' + args.dataset + '/training'): - os.makedirs(directory_structure['sharded'] + '/' + args.dataset + '/training') - - if not os.path.exists(directory_structure['sharded'] + '/' + args.dataset + '/test'): - os.makedirs(directory_structure['sharded'] + '/' + args.dataset + '/test') - - # Segmentation is here because all datasets look the same in one article/book/whatever per line format, and - # it seemed unnecessarily complicated to add an additional preprocessing step to call just for this. - # Different languages (e.g., Chinese simplified/traditional) may require translation and - # other packages to be called from here -- just add a conditional branch for those extra steps - segmenter = TextSharding.NLTKSegmenter() - sharding = TextSharding.Sharding(args.input_files, output_file_prefix, args.n_training_shards, args.n_test_shards, args.fraction_test_set) - - sharding.load_articles() - sharding.segment_articles_into_sentences(segmenter) - sharding.distribute_articles_over_shards() - sharding.write_shards_to_disk() - - else: - assert False, 'Unsupported dataset for sharding' - - elif args.action == 'create_tfrecord_files': - if not os.path.exists(directory_structure['tfrecord'] + "/" + args.dataset): - os.makedirs(directory_structure['tfrecord'] + "/" + args.dataset) - - if not os.path.exists(directory_structure['tfrecord'] + "/" + args.dataset + '/training'): - os.makedirs(directory_structure['tfrecord'] + "/" + args.dataset + '/training') - - if not os.path.exists(directory_structure['tfrecord'] + "/" + args.dataset + '/test'): - os.makedirs(directory_structure['tfrecord'] + "/" + args.dataset + '/test') - - last_process = None - - def create_record_worker(filename_prefix, shard_id, output_format='tfrecord', split='training'): - bert_preprocessing_command = 'python /workspace/bert/utils/create_pretraining_data.py' - bert_preprocessing_command += ' --input_file=' + directory_structure['sharded'] + '/' + args.dataset + '/' + split + '/' + filename_prefix + '_' + str(shard_id) + '.txt' - bert_preprocessing_command += ' --output_file=' + directory_structure['tfrecord'] + '/' + args.dataset + '/' + split + '/' + filename_prefix + '_' + str(shard_id) + '.' + output_format - bert_preprocessing_command += ' --vocab_file=' + args.vocab_file - bert_preprocessing_command += ' --do_lower_case' if args.do_lower_case else '' - bert_preprocessing_command += ' --max_seq_length=' + str(args.max_seq_length) - bert_preprocessing_command += ' --max_predictions_per_seq=' + str(args.max_predictions_per_seq) - bert_preprocessing_command += ' --masked_lm_prob=' + str(args.masked_lm_prob) - bert_preprocessing_command += ' --random_seed=' + str(args.random_seed) - bert_preprocessing_command += ' --dupe_factor=' + str(args.dupe_factor) - bert_preprocessing_process = subprocess.Popen(bert_preprocessing_command, shell=True) - - last_process = bert_preprocessing_process - - # This could be better optimized (fine if all take equal time) - if shard_id % args.n_processes == 0 and shard_id > 0: - bert_preprocessing_process.wait() - - return last_process - - output_file_prefix = args.dataset - - for i in range(args.n_training_shards): - last_process = create_record_worker(output_file_prefix + '_training', i, 'tfrecord', 'training') - - last_process.wait() - - for i in range(args.n_test_shards): - last_process = create_record_worker(output_file_prefix + '_test', i, 'tfrecord', 'test') - - last_process.wait() - - - elif args.action == 'create_hdf5_files': - assert False, 'HDF5 format not fully supported in this release.' - - if not os.path.exists(directory_structure['hdf5'] + "/" + args.dataset): - os.makedirs(directory_structure['hdf5'] + "/" + args.dataset) - - last_process = None - - def create_record_worker(filename_prefix, shard_id, output_format='hdf5'): - bert_preprocessing_command = 'python /workspace/bert/utils/create_pretraining_data.py' - bert_preprocessing_command += ' --input_file=' + directory_structure['sharded'] + '/' + args.dataset + '/' + filename_prefix + '_' + str(shard_id) + '.txt' - bert_preprocessing_command += ' --output_file=' + directory_structure['hdf5'] + '/' + args.dataset + '/' + filename_prefix + '_' + str(shard_id) + '.' + output_format - bert_preprocessing_command += ' --vocab_file=' + args.vocab_file - bert_preprocessing_command += ' --do_lower_case' if args.do_lower_case else '' - bert_preprocessing_command += ' --max_seq_length=' + args.max_seq_length - bert_preprocessing_command += ' --max_predictions_per_seq=' + args.max_predictions_per_seq - bert_preprocessing_command += ' --masked_lm_prob=' + args.masked_lm_prob - bert_preprocessing_command += ' --random_seed=' + args.random_seed - bert_preprocessing_command += ' --dupe_factor=' + args.dupe_factor - bert_preprocessing_process = subprocess.Popen(bert_preprocessing_command, shell=True) - - last_process = bert_preprocessing_process - - # This could be better optimized (fine if all take equal time) - if shard_id % args.n_processes == 0 and shard_id > 0: - bert_preprocessing_process.wait() - - for i in range(args.n_training_shards): - create_record_worker(args.output_file_prefix + '_training', i) - - last_process.wait() - - for i in range(args.n_test_shards): - create_record_worker(args.output_file_prefix + '_test', i) - - last_process.wait() - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description='Preprocessing Application for Everything BERT-related' - ) - - parser.add_argument( - '--action', - type=str, - help='Specify the action you want the app to take. e.g., generate vocab, segment, create tfrecords', - choices={ - 'download', # Download and verify mdf5/sha sums - 'text_formatting', # Convert into a file that contains one article/book per line - 'sharding', # Convert previous formatted text into shards containing one sentence per line - 'create_tfrecord_files', # Turn each shard into a TFrecord with masking and next sentence prediction info - 'create_hdf5_files' # Turn each shard into a HDF5 file with masking and next sentence prediction info - } - ) - - parser.add_argument( - '--dataset', - type=str, - help='Specify the dataset to perform --action on', - choices={ - 'bookscorpus', - 'wikicorpus_en', - 'wikicorpus_zh', - 'books_wiki_en_corpus', - 'pubmed_baseline', - 'pubmed_daily_update', - 'pubmed_fulltext', - 'pubmed_open_access', - 'google_pretrained_weights', - 'nvidia_pretrained_weights', - 'squad', - 'mrpc', - 'sst-2', - 'mnli', - 'cola', - 'all' - } - ) - - parser.add_argument( - '--input_files', - type=str, - help='Specify the input files in a comma-separated list (no spaces)' - ) - - parser.add_argument( - '--n_training_shards', - type=int, - help='Specify the number of training shards to generate', - default=1472 - ) - - parser.add_argument( - '--n_test_shards', - type=int, - help='Specify the number of test shards to generate', - default=1472 - ) - - parser.add_argument( - '--fraction_test_set', - type=float, - help='Specify the fraction (0..1) of the data to withhold for the test data split (based on number of sequences)', - default=0.1 - ) - - parser.add_argument( - '--segmentation_method', - type=str, - help='Specify your choice of sentence segmentation', - choices={ - 'nltk' - }, - default='nltk' - ) - - parser.add_argument( - '--n_processes', - type=int, - help='Specify the max number of processes to allow at one time', - default=4 - ) - - parser.add_argument( - '--random_seed', - type=int, - help='Specify the base seed to use for any random number generation', - default=12345 - ) - - parser.add_argument( - '--dupe_factor', - type=int, - help='Specify the duplication factor', - default=5 - ) - - parser.add_argument( - '--masked_lm_prob', - type=float, - help='Specify the probability for masked lm', - default=0.15 - ) - - parser.add_argument( - '--max_seq_length', - type=int, - help='Specify the maximum sequence length', - default=512 - ) - - parser.add_argument( - '--max_predictions_per_seq', - type=int, - help='Specify the maximum number of masked words per sequence', - default=20 - ) - - parser.add_argument( - '--do_lower_case', - type=int, - help='Specify whether it is cased (0) or uncased (1) (any number greater than 0 will be treated as uncased)', - default=1 - ) - - parser.add_argument( - '--vocab_file', - type=str, - help='Specify absolute path to vocab file to use)' - ) - - parser.add_argument( - '--skip_wikiextractor', - type=int, - help='Specify whether to skip wikiextractor step 0=False, 1=True', - default=0 - ) - - parser.add_argument( - '--interactive_json_config_generator', - type=str, - help='Specify the action you want the app to take. e.g., generate vocab, segment, create tfrecords' - ) - - args = parser.parse_args() - main(args) diff --git a/TensorFlow/LanguageModeling/BERT/data/check.py b/TensorFlow/LanguageModeling/BERT/data/check.py deleted file mode 100644 index 1a25c2edc..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/check.py +++ /dev/null @@ -1,340 +0,0 @@ -# Copyright (c) 2019 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. - - -import csv - - -o = csv.reader(open("data/biobert/chemprot-data_treeLSTM/dev.tsv", "r"), delimiter="\t") -nv = csv.reader(open("data/biobert/ChemProt_NV/dev.tsv", "r"), delimiter="\t") - -count = {} -for l, i in enumerate(nv): - if l == 0: - continue - if count.get(i[0].split(".")[0], None) is None: - count[i[0].split(".")[0]] = 0 - count[i[0].split(".")[0]] += 1 - -count_1 = {} -for i in o: - if count_1.get(i[0], None) is None: - count_1[i[0]] = 0 - count_1[i[0]] += 1 - -for k in count.keys(): - if count[k] != count_1[k]: - print(k, count[k], count_1[k]) - - -# import os -# import csv -# import zipfile -# import argparse - - -# class ChemProtTextFormatting: -# """A basic formatter to preprocess the chemprot dataset. -# """ - -# def __init__(self, input_folder, output_folder): - -# chemprot_folder = input_folder -# with zipfile.ZipFile(os.path.join(chemprot_folder, "ChemProt_Corpus.zip"), "r") as zip: -# zip.extractall(chemprot_folder) - -# chemprot_folder = os.path.join(input_folder, "ChemProt_Corpus") - -# with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_development.zip")) as zip: -# zip.extractall(chemprot_folder) - -# if not os.path.exists(output_folder): -# os.makedirs(output_folder) - -# self.format(os.path.join(chemprot_folder, "chemprot_development"), -# "chemprot_development_entities.tsv", "chemprot_development_relations.tsv", -# "chemprot_development_abstracts.tsv", os.path.join(output_folder, "dev.tsv")) - -# with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_test_gs.zip")) as zip: -# zip.extractall(chemprot_folder) -# self.format(os.path.join(chemprot_folder, "chemprot_test_gs"), -# "chemprot_test_entities_gs.tsv", "chemprot_test_relations_gs.tsv", -# "chemprot_test_abstracts_gs.tsv", os.path.join(output_folder, "test.tsv")) - -# with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_training.zip")) as zip: -# zip.extractall(chemprot_folder) -# self.format(os.path.join(chemprot_folder, "chemprot_training"), -# "chemprot_training_entities.tsv", "chemprot_training_relations.tsv", -# "chemprot_training_abstracts.tsv", os.path.join(output_folder, "train.tsv")) - - - -# def format(self, chemprot_path, entity_filename, relations_filename, abstracts_filename, output_filename): -# """ -# Constructs ChemProt dataset for Relation Extraction. - -# Args: -# chemprot_path: Path to files -# entity_filename: Contains labelled mention annotations of chemical compounds and genes/proteins. -# <PMID> <EntityNumber> <Type of Entity> <Start Character offset> <End Character Offset> <Text String> -# relations_filename: Contains a subset of chemical-protein relations annotations for the Chemprot dataset -# <PMID> <CPR Group> <EntityNumber1> <EntityNumber2> -# abstracts_filename: Contains plain text CHEMPROT PubMed Data -# <PMID> <Title of the Article> <Abstract of the Article> -# output_filename: Path to output file that will contain preprocessed data -# <PMID.EntityNumber1.EntityNumber2> <Preprocessed Sentence> <CPR Group> -# """ - -# data = {} -# train_entities = csv.reader(open(os.path.join(chemprot_path, entity_filename), -# mode="r"), delimiter="\t") -# for entity in train_entities: -# id = entity[0] -# if data.get(id, None) is None: -# data[id] = {"relations":[], "entities":{}} -# data[id]["entities"][entity[1]] = (int(entity[3]), int(entity[4]), entity[2]) - -# train_relations=csv.reader(open(os.path.join(chemprot_path, relations_filename), -# mode="r"), delimiter="\t") -# for relation in train_relations: -# try: -# id = relation[0] -# data[id]["relations"].append((relation[1], relation[2], relation[4].split("Arg1:")[-1], relation[5].split("Arg2:")[-1])) -# except: -# print("invalid id") -# raise ValueError - -# with open(output_filename, 'w') as ofile: -# train_abstracts = csv.reader(open(os.path.join(chemprot_path, abstracts_filename), -# mode="r"), delimiter="\t") -# owriter = csv.writer(ofile, delimiter='\t', lineterminator=os.linesep) -# owriter.writerow(["index", "sentence", "label"]) - -# num_sentences = 0 -# rejected = 0 -# for abstract in train_abstracts: -# id = abstract[0] -# line = abstract[1] + abstract[2] - -# for relation in data[id]["relations"]: -# tag1 = relation[2] -# tag2 = relation[3] -# start = 0 -# for sentence in line.split("."): -# end = start + len(sentence) -# if data[id]["entities"][tag1][0] >= start and data[id]["entities"][tag2][0] >= start and \ -# data[id]["entities"][tag1][1] <= end and data[id]["entities"][tag2][1] <= end: -# for offset_start, offset_end, word in sorted([(data[id]["entities"][tag1][0], data[id]["entities"][tag1][1], data[id]["entities"][tag1][2]), -# (data[id]["entities"][tag2][0], data[id]["entities"][tag2][1], data[id]["entities"][tag2][2])], -# reverse=True): -# sentence = sentence[:offset_start-start-1] + "@" + word + "$" + sentence[offset_end-start-1:] -# sentence = sentence.strip() -# owriter.writerow([id+"."+tag1+"."+tag2, sentence, relation[0] if relation[1] == "Y " else "false"]) -# num_sentences += 1 -# if id == "10064839": -# print(tag1, tag2, start, end, offset_start, offset_end, "yes") -# break -# else: -# rejected += 1 -# if id == "10064839": -# print(tag1, tag2, start, end, data[id]["entities"][tag1][0], data[id]["entities"][tag1][1], data[id]["entities"][tag2][0], data[id]["entities"][tag2][1]) -# start = end + 1 -# print("Succesfully written {} samples to {}".format(num_sentences, output_filename)) -# print("Rejected are", rejected) - - -# if __name__=="__main__": -# parser = argparse.ArgumentParser( -# description='Preprocessing Application for ChemProt' -# ) - -# parser.add_argument( -# '--input_folder', -# type=str, -# help='Specify the input files in a comma-separated list (no spaces)' -# ) -# parser.add_argument( -# '--output_folder', -# type=str, -# help='Specify the input files in a comma-separated list (no spaces)' -# ) - - -# args = parser.parse_args() -# preprocess_chemprot = ChemProtTextFormatting(args.input_folder, args.output_folder) - -# # Copyright (c) 2019 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. - -# import os -# import csv -# import zipfile -# import argparse - - -# class ChemProtTextFormatting: -# """A basic formatter to preprocess the chemprot dataset. -# """ - -# def __init__(self, input_folder, output_folder): - -# chemprot_folder = input_folder -# with zipfile.ZipFile(os.path.join(chemprot_folder, "ChemProt_Corpus.zip"), "r") as zip: -# zip.extractall(chemprot_folder) - -# chemprot_folder = os.path.join(input_folder, "ChemProt_Corpus") - -# with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_development.zip")) as zip: -# zip.extractall(chemprot_folder) - -# if not os.path.exists(output_folder): -# os.makedirs(output_folder) - -# self.format(os.path.join(chemprot_folder, "chemprot_development"), -# "chemprot_development_entities.tsv", "chemprot_development_relations.tsv", -# "chemprot_development_abstracts.tsv", os.path.join(output_folder, "dev.tsv")) - -# with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_test_gs.zip")) as zip: -# zip.extractall(chemprot_folder) -# self.format(os.path.join(chemprot_folder, "chemprot_test_gs"), -# "chemprot_test_entities_gs.tsv", "chemprot_test_relations_gs.tsv", -# "chemprot_test_abstracts_gs.tsv", os.path.join(output_folder, "test.tsv")) - -# with zipfile.ZipFile(os.path.join(chemprot_folder, "chemprot_training.zip")) as zip: -# zip.extractall(chemprot_folder) -# self.format(os.path.join(chemprot_folder, "chemprot_training"), -# "chemprot_training_entities.tsv", "chemprot_training_relations.tsv", -# "chemprot_training_abstracts.tsv", os.path.join(output_folder, "train.tsv")) - -# def format(self, chemprot_path, entity_filename, relations_filename, abstracts_filename, output_filename): -# """ -# Constructs ChemProt dataset for Relation Extraction. - -# Args: -# chemprot_path: Path to files -# entity_filename: Contains labelled mention annotations of chemical compounds and genes/proteins. -# <PMID> <EntityNumber> <Type of Entity> <Start Character offset> <End Character Offset> <Text String> -# relations_filename: Contains a subset of chemical-protein relations annotations for the Chemprot dataset -# <PMID> <CPR Group> <EntityNumber1> <EntityNumber2> -# abstracts_filename: Contains plain text CHEMPROT PubMed Data -# <PMID> <Title of the Article> <Abstract of the Article> -# output_filename: Path to output file that will contain preprocessed data -# <PMID.EntityNumber1.EntityNumber2> <Preprocessed Sentence> <CPR Group> -# """ - -# data = {} -# train_entities = csv.reader(open(os.path.join(chemprot_path, entity_filename), -# mode="r"), delimiter="\t") -# for entity in train_entities: -# id = entity[0] -# if data.get(id, None) is None: -# data[id] = {"relations": {}, "entities": {"CHEMICAL": {"00": (0, 0, None)}, "GENE": {}}} -# data[id]["entities"]["CHEMICAL" if entity[2] == "CHEMICAL" else "GENE"][entity[1]] = ( -# int(entity[3]), int(entity[4]), entity[2]) - -# train_relations = csv.reader(open(os.path.join(chemprot_path, relations_filename), -# mode="r"), delimiter="\t") -# for relation in train_relations: -# try: -# id = relation[0] -# data[id]["relations"][(relation[4].split("Arg1:")[-1], relation[5].split("Arg2:")[-1])] = relation[ -# 1] if relation[2] == "Y " else "false" -# except: -# print("invalid id") -# raise ValueError -# # print(data[list(data.keys())[0]]) - -# with open(output_filename, 'w') as ofile: -# train_abstracts = csv.reader(open(os.path.join(chemprot_path, abstracts_filename), -# mode="r"), delimiter="\t") -# owriter = csv.writer(ofile, delimiter='\t', lineterminator=os.linesep) -# owriter.writerow(["index", "sentence", "label"]) - -# num_sentences = 0 -# rejected = 0 -# for abstract in train_abstracts: -# id = abstract[0] -# line = abstract[1] + abstract[2] - -# for tag1 in data[id]["entities"]["CHEMICAL"].keys(): -# for tag2 in data[id]["entities"]["GENE"].keys(): -# relation = data[id]["relations"].get((tag2, tag1), None) -# relation = data[id]["relations"].get((tag1, tag2), None) if relation is None else relation -# if relation is None: -# relation = "false" - -# start = 0 -# for sentence in line.split("."): -# original_sentence = sentence -# end = start + len(sentence) -# tag1_details = data[id]["entities"]["CHEMICAL"][tag1] -# tag2_details = data[id]["entities"]["GENE"][tag2] - -# if ((tag1_details[2] is None) or ( -# tag1_details[0] >= start and tag1_details[1] <= end)) and \ -# (tag2_details[0] >= start and tag2_details[1] <= end): -# for offset_start, offset_end, value in sorted( -# list(data[id]["entities"]["CHEMICAL"].values()) + list( -# data[id]["entities"]["GENE"].values()), -# reverse=True): -# if offset_start < start or offset_end > end or value is None: -# continue -# word = value if (offset_start, offset_end) == ( -# tag1_details[0], tag1_details[1]) or (offset_start, offset_end) == ( -# tag2_details[0], tag2_details[1]) else "OTHER" -# sentence = sentence[:offset_start - start - 1] + "@" + word + "$" + sentence[ -# offset_end - start - 1:] -# sentence = sentence.strip() -# owriter.writerow([id + "." + tag1 + "." + tag2, sentence, relation]) -# num_sentences += 1 -# # if id == list(data.keys())[0]: -# # print(original_sentence, sentence) -# # break -# else: -# rejected += 1 -# if id == "10064839": -# # print(tag1, tag2, start, end, tag1_details[0], tag1_details[1], tag2_details[0], tag2_details[1]) -# pass -# start = end + 1 -# print("Succesfully written {} samples to {}".format(num_sentences, output_filename)) -# print("Rejected are", rejected) - - -# if __name__ == "__main__": -# parser = argparse.ArgumentParser( -# description='Preprocessing Application for ChemProt' -# ) - -# parser.add_argument( -# '--input_folder', -# type=str, -# help='Specify the input files in a comma-separated list (no spaces)' -# ) -# parser.add_argument( -# '--output_folder', -# type=str, -# help='Specify the input files in a comma-separated list (no spaces)' -# ) - -# args = parser.parse_args() -# preprocess_chemprot = ChemProtTextFormatting(args.input_folder, args.output_folder) \ No newline at end of file diff --git a/TensorFlow/LanguageModeling/BERT/data/create_biobert_datasets_from_start.sh b/TensorFlow/LanguageModeling/BERT/data/create_biobert_datasets_from_start.sh deleted file mode 100644 index 3f1a41634..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/create_biobert_datasets_from_start.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2019 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. - -export BERT_PREP_WORKING_DIR="${BERT_PREP_WORKING_DIR}" - -# Download -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action download --dataset pubmed_baseline - -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action download --dataset google_pretrained_weights # Includes vocab - -# Properly format the text files -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action text_formatting --dataset pubmed_baseline - - -# Shard the text files -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action sharding --dataset pubmed_baseline - -### BERT BASE - -## UNCASED - -# Create TFRecord files Phase 1 -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action create_tfrecord_files --dataset pubmed_baseline --max_seq_length 128 \ - --max_predictions_per_seq 20 --vocab_file ${BERT_PREP_WORKING_DIR}/download/google_pretrained_weights/uncased_L-12_H-768_A-12/vocab.txt - - -# Create TFRecord files Phase 2 -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action create_tfrecord_files --dataset pubmed_baseline --max_seq_length 512 \ - --max_predictions_per_seq 80 --vocab_file ${BERT_PREP_WORKING_DIR}/download/google_pretrained_weights/uncased_L-12_H-768_A-12/vocab.txt - - -## CASED - -# Create TFRecord files Phase 1 -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action create_tfrecord_files --dataset pubmed_baseline --max_seq_length 128 \ - --max_predictions_per_seq 20 --vocab_file ${BERT_PREP_WORKING_DIR}/download/google_pretrained_weights/cased_L-12_H-768_A-12/vocab.txt \ - --do_lower_case=0 - - -# Create TFRecord files Phase 2 -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action create_tfrecord_files --dataset pubmed_baseline --max_seq_length 512 \ - --max_predictions_per_seq 80 --vocab_file ${BERT_PREP_WORKING_DIR}/download/google_pretrained_weights/cased_L-12_H-768_A-12/vocab.txt \ - --do_lower_case=0 diff --git a/TensorFlow/LanguageModeling/BERT/data/create_datasets_from_start.sh b/TensorFlow/LanguageModeling/BERT/data/create_datasets_from_start.sh deleted file mode 100755 index 6e5f451bd..000000000 --- a/TensorFlow/LanguageModeling/BERT/data/create_datasets_from_start.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash - -# Copyright (c) 2019 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. - -export BERT_PREP_WORKING_DIR="${BERT_PREP_WORKING_DIR}" - -to_download=${1:-"wiki_only"} # By default, we don't download BooksCorpus dataset due to recent issues with the host server - -#Download -if [ "$to_download" = "wiki_books" ] ; then - python3 /workspace/bert/data/bertPrep.py --action download --dataset bookscorpus -fi - -python3 /workspace/bert/data/bertPrep.py --action download --dataset wikicorpus_en -python3 /workspace/bert/data/bertPrep.py --action download --dataset squad -python3 /workspace/bert/data/bertPrep.py --action download --dataset mrpc -python3 /workspace/bert/data/bertPrep.py --action download --dataset sst-2 -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action download --dataset google_pretrained_weights - -mkdir -p /workspace/bert/data/download/nvidia_pretrained -#SQuAD Large Checkpoint - echo "Downloading SQuAD Large Checkpoint" - cd /workspace/bert/data/download/nvidia_pretrained && \ - wget --content-disposition https://api.ngc.nvidia.com/v2/models/nvidia/bert_tf_ckpt_large_qa_squad11_amp_384/versions/19.03.1/zip -O bert_tf_ckpt_large_qa_squad11_amp_384_19.03.1.zip \ - && unzip bert_tf_ckpt_large_qa_squad11_amp_384_19.03.1.zip -d bert_tf_squad11_large_384 && rm bert_tf_ckpt_large_qa_squad11_amp_384_19.03.1.zip - -#SQuAD Base Checkpoint -cd /workspace/bert/data/download/nvidia_pretrained && \ - wget --content-disposition https://api.ngc.nvidia.com/v2/models/nvidia/bert_tf_ckpt_base_qa_squad11_amp_128/versions/19.03.1/zip -O bert_tf_ckpt_base_qa_squad11_amp_128_19.03.1.zip \ - && unzip bert_tf_ckpt_base_qa_squad11_amp_128_19.03.1.zip -d bert_tf_squad11_base_128 && rm bert_tf_ckpt_base_qa_squad11_amp_128_19.03.1.zip - -#Pretraining Large checkpoint -cd /workspace/bert/data/download/nvidia_pretrained && \ - wget --content-disposition https://api.ngc.nvidia.com/v2/models/nvidia/bert_tf_ckpt_large_pretraining_amp_lamb/versions/19.03.1/zip -O bert_tf_ckpt_large_pretraining_amp_lamb_19.03.1.zip \ - && unzip bert_tf_ckpt_large_pretraining_amp_lamb_19.03.1.zip -d bert_tf_pretraining_large_lamb && rm bert_tf_ckpt_large_pretraining_amp_lamb_19.03.1.zip - -python3 /workspace/bert/data/bertPrep.py --action download --dataset google_pretrained_weights # Redundant, to verify and remove - - -DATASET="wikicorpus_en" -# Properly format the text files -if [ "$to_download" = "wiki_books" ] ; then - python3 /workspace/bert/data/bertPrep.py --action text_formatting --dataset bookscorpus - DATASET="books_wiki_en_corpus" -fi -python3 /workspace/bert/data/bertPrep.py --action text_formatting --dataset wikicorpus_en - -# Shard the text files -python3 /workspace/bert/data/bertPrep.py --action sharding --dataset $DATASET - -# Create TFRecord files Phase 1 -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action create_tfrecord_files --dataset ${DATASET} --max_seq_length 128 \ - --max_predictions_per_seq 20 --vocab_file ${BERT_PREP_WORKING_DIR}/download/google_pretrained_weights/uncased_L-24_H-1024_A-16/vocab.txt - - -# Create TFRecord files Phase 2 -python3 ${BERT_PREP_WORKING_DIR}/bertPrep.py --action create_tfrecord_files --dataset ${DATASET} --max_seq_length 512 \ - --max_predictions_per_seq 80 --vocab_file ${BERT_PREP_WORKING_DIR}/download/google_pretrained_weights/uncased_L-24_H-1024_A-16/vocab.txt diff --git a/TensorFlow/LanguageModeling/BERT/data/images/bert_pipeline.png b/TensorFlow/LanguageModeling/BERT/data/images/bert_pipeline.png deleted file mode 100644 index 40193e9e1..000000000 Binary files a/TensorFlow/LanguageModeling/BERT/data/images/bert_pipeline.png and /dev/null differ diff --git a/TensorFlow/LanguageModeling/BERT/data/images/bert_triton_dynamic_batching_a100.png b/TensorFlow/LanguageModeling/BERT/data/images/bert_triton_dynamic_batching_a100.png deleted file mode 100644 index cd1513000..000000000 Binary files a/TensorFlow/LanguageModeling/BERT/data/images/bert_triton_dynamic_batching_a100.png and /dev/null differ diff --git a/TensorFlow/LanguageModeling/BERT/data/images/bert_trt_throughput_vs_latency.png b/TensorFlow/LanguageModeling/BERT/data/images/bert_trt_throughput_vs_latency.png deleted file mode 100644 index d897f949f..000000000 Binary files a/TensorFlow/LanguageModeling/BERT/data/images/bert_trt_throughput_vs_latency.png and /dev/null differ diff --git a/TensorFlow/LanguageModeling/BERT/data/images/images_nvlamb.png b/TensorFlow/LanguageModeling/BERT/data/images/images_nvlamb.png deleted file mode 100644 index a28f24e31..000000000 Binary files a/TensorFlow/LanguageModeling/BERT/data/images/images_nvlamb.png and /dev/null differ diff --git a/TensorFlow/LanguageModeling/BERT/data/images/images_nvlamb_2.png b/TensorFlow/LanguageModeling/BERT/data/images/images_nvlamb_2.png deleted file mode 100644 index 8beaf38e9..000000000 Binary files a/TensorFlow/LanguageModeling/BERT/data/images/images_nvlamb_2.png and /dev/null differ diff --git a/TensorFlow/LanguageModeling/BERT/notebooks/bert_squad_tf_finetuning.ipynb b/TensorFlow/LanguageModeling/BERT/notebooks/bert_squad_tf_finetuning.ipynb old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/notebooks/bert_squad_tf_inference.ipynb b/TensorFlow/LanguageModeling/BERT/notebooks/bert_squad_tf_inference.ipynb old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/results/models/.gitkeep b/TensorFlow/LanguageModeling/BERT/results/models/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/TensorFlow/LanguageModeling/BERT/results/perf_client/.gitkeep b/TensorFlow/LanguageModeling/BERT/results/perf_client/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/configs/squad_config.sh b/TensorFlow/LanguageModeling/BERT/scripts/configs/squad_config.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/data_download.sh b/TensorFlow/LanguageModeling/BERT/scripts/data_download.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/docker/build.sh b/TensorFlow/LanguageModeling/BERT/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/docker/launch.sh b/TensorFlow/LanguageModeling/BERT/scripts/docker/launch.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/finetune_inference_benchmark.sh b/TensorFlow/LanguageModeling/BERT/scripts/finetune_inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/finetune_train_benchmark.sh b/TensorFlow/LanguageModeling/BERT/scripts/finetune_train_benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/run_glue.sh b/TensorFlow/LanguageModeling/BERT/scripts/run_glue.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/run_pretraining_adam.sh b/TensorFlow/LanguageModeling/BERT/scripts/run_pretraining_adam.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/run_pretraining_lamb_phase1.sh b/TensorFlow/LanguageModeling/BERT/scripts/run_pretraining_lamb_phase1.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/run_pretraining_lamb_phase2.sh b/TensorFlow/LanguageModeling/BERT/scripts/run_pretraining_lamb_phase2.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/run_squad.sh b/TensorFlow/LanguageModeling/BERT/scripts/run_squad.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/scripts/run_squad_inference.sh b/TensorFlow/LanguageModeling/BERT/scripts/run_squad_inference.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/tf_metrics.py b/TensorFlow/LanguageModeling/BERT/tf_metrics.py index 76d391468..f4c514855 100644 --- a/TensorFlow/LanguageModeling/BERT/tf_metrics.py +++ b/TensorFlow/LanguageModeling/BERT/tf_metrics.py @@ -1,215 +1,215 @@ -""" -Multiclass -from: -https://github.com/guillaumegenthial/tf_metrics/blob/master/tf_metrics/__init__.py - -""" - -__author__ = "Guillaume Genthial" - -import numpy as np -import tensorflow as tf -from tensorflow.python.ops.metrics_impl import _streaming_confusion_matrix - - -def precision(labels, predictions, num_classes, pos_indices=None, - weights=None, average='micro'): - """Multi-class precision metric for Tensorflow - Parameters - ---------- - labels : Tensor of tf.int32 or tf.int64 - The true labels - predictions : Tensor of tf.int32 or tf.int64 - The predictions, same shape as labels - num_classes : int - The number of classes - pos_indices : list of int, optional - The indices of the positive classes, default is all - weights : Tensor of tf.int32, optional - Mask, must be of compatible shape with labels - average : str, optional - 'micro': counts the total number of true positives, false - positives, and false negatives for the classes in - `pos_indices` and infer the metric from it. - 'macro': will compute the metric separately for each class in - `pos_indices` and average. Will not account for class - imbalance. - 'weighted': will compute the metric separately for each class in - `pos_indices` and perform a weighted average by the total - number of true labels for each class. - Returns - ------- - tuple of (scalar float Tensor, update_op) - """ - cm, op = _streaming_confusion_matrix( - labels, predictions, num_classes, weights) - pr, _, _ = metrics_from_confusion_matrix( - cm, pos_indices, average=average) - op, _, _ = metrics_from_confusion_matrix( - op, pos_indices, average=average) - return (pr, op) - - -def recall(labels, predictions, num_classes, pos_indices=None, weights=None, - average='micro'): - """Multi-class recall metric for Tensorflow - Parameters - ---------- - labels : Tensor of tf.int32 or tf.int64 - The true labels - predictions : Tensor of tf.int32 or tf.int64 - The predictions, same shape as labels - num_classes : int - The number of classes - pos_indices : list of int, optional - The indices of the positive classes, default is all - weights : Tensor of tf.int32, optional - Mask, must be of compatible shape with labels - average : str, optional - 'micro': counts the total number of true positives, false - positives, and false negatives for the classes in - `pos_indices` and infer the metric from it. - 'macro': will compute the metric separately for each class in - `pos_indices` and average. Will not account for class - imbalance. - 'weighted': will compute the metric separately for each class in - `pos_indices` and perform a weighted average by the total - number of true labels for each class. - Returns - ------- - tuple of (scalar float Tensor, update_op) - """ - cm, op = _streaming_confusion_matrix( - labels, predictions, num_classes, weights) - _, re, _ = metrics_from_confusion_matrix( - cm, pos_indices, average=average) - _, op, _ = metrics_from_confusion_matrix( - op, pos_indices, average=average) - return (re, op) - - -def f1(labels, predictions, num_classes, pos_indices=None, weights=None, - average='micro'): - return fbeta(labels, predictions, num_classes, pos_indices, weights, - average) - - -def fbeta(labels, predictions, num_classes, pos_indices=None, weights=None, - average='micro', beta=1): - """Multi-class fbeta metric for Tensorflow - Parameters - ---------- - labels : Tensor of tf.int32 or tf.int64 - The true labels - predictions : Tensor of tf.int32 or tf.int64 - The predictions, same shape as labels - num_classes : int - The number of classes - pos_indices : list of int, optional - The indices of the positive classes, default is all - weights : Tensor of tf.int32, optional - Mask, must be of compatible shape with labels - average : str, optional - 'micro': counts the total number of true positives, false - positives, and false negatives for the classes in - `pos_indices` and infer the metric from it. - 'macro': will compute the metric separately for each class in - `pos_indices` and average. Will not account for class - imbalance. - 'weighted': will compute the metric separately for each class in - `pos_indices` and perform a weighted average by the total - number of true labels for each class. - beta : int, optional - Weight of precision in harmonic mean - Returns - ------- - tuple of (scalar float Tensor, update_op) - """ - cm, op = _streaming_confusion_matrix( - labels, predictions, num_classes, weights) - _, _, fbeta = metrics_from_confusion_matrix( - cm, pos_indices, average=average, beta=beta) - _, _, op = metrics_from_confusion_matrix( - op, pos_indices, average=average, beta=beta) - return (fbeta, op) - - -def safe_div(numerator, denominator): - """Safe division, return 0 if denominator is 0""" - numerator, denominator = tf.to_float(numerator), tf.to_float(denominator) - zeros = tf.zeros_like(numerator, dtype=numerator.dtype) - denominator_is_zero = tf.equal(denominator, zeros) - return tf.where(denominator_is_zero, zeros, numerator / denominator) - - -def pr_re_fbeta(cm, pos_indices, beta=1): - """Uses a confusion matrix to compute precision, recall and fbeta""" - num_classes = cm.shape[0] - neg_indices = [i for i in range(num_classes) if i not in pos_indices] - cm_mask = np.ones([num_classes, num_classes]) - cm_mask[neg_indices, neg_indices] = 0 - diag_sum = tf.reduce_sum(tf.diag_part(cm * cm_mask)) - - cm_mask = np.ones([num_classes, num_classes]) - cm_mask[:, neg_indices] = 0 - tot_pred = tf.reduce_sum(cm * cm_mask) - - cm_mask = np.ones([num_classes, num_classes]) - cm_mask[neg_indices, :] = 0 - tot_gold = tf.reduce_sum(cm * cm_mask) - - pr = safe_div(diag_sum, tot_pred) - re = safe_div(diag_sum, tot_gold) - fbeta = safe_div((1. + beta**2) * pr * re, beta**2 * pr + re) - - return pr, re, fbeta - - -def metrics_from_confusion_matrix(cm, pos_indices=None, average='micro', - beta=1): - """Precision, Recall and F1 from the confusion matrix - Parameters - ---------- - cm : tf.Tensor of type tf.int32, of shape (num_classes, num_classes) - The streaming confusion matrix. - pos_indices : list of int, optional - The indices of the positive classes - beta : int, optional - Weight of precision in harmonic mean - average : str, optional - 'micro', 'macro' or 'weighted' - """ - num_classes = cm.shape[0] - if pos_indices is None: - pos_indices = [i for i in range(num_classes)] - - if average == 'micro': - return pr_re_fbeta(cm, pos_indices, beta) - elif average in {'macro', 'weighted'}: - precisions, recalls, fbetas, n_golds = [], [], [], [] - for idx in pos_indices: - pr, re, fbeta = pr_re_fbeta(cm, [idx], beta) - precisions.append(pr) - recalls.append(re) - fbetas.append(fbeta) - cm_mask = np.zeros([num_classes, num_classes]) - cm_mask[idx, :] = 1 - n_golds.append(tf.to_float(tf.reduce_sum(cm * cm_mask))) - - if average == 'macro': - pr = tf.reduce_mean(precisions) - re = tf.reduce_mean(recalls) - fbeta = tf.reduce_mean(fbetas) - return pr, re, fbeta - if average == 'weighted': - n_gold = tf.reduce_sum(n_golds) - pr_sum = sum(p * n for p, n in zip(precisions, n_golds)) - pr = safe_div(pr_sum, n_gold) - re_sum = sum(r * n for r, n in zip(recalls, n_golds)) - re = safe_div(re_sum, n_gold) - fbeta_sum = sum(f * n for f, n in zip(fbetas, n_golds)) - fbeta = safe_div(fbeta_sum, n_gold) - return pr, re, fbeta - - else: - raise NotImplementedError() +""" +Multiclass +from: +https://github.com/guillaumegenthial/tf_metrics/blob/master/tf_metrics/__init__.py + +""" + +__author__ = "Guillaume Genthial" + +import numpy as np +import tensorflow as tf +from tensorflow.python.ops.metrics_impl import _streaming_confusion_matrix + + +def precision(labels, predictions, num_classes, pos_indices=None, + weights=None, average='micro'): + """Multi-class precision metric for Tensorflow + Parameters + ---------- + labels : Tensor of tf.int32 or tf.int64 + The true labels + predictions : Tensor of tf.int32 or tf.int64 + The predictions, same shape as labels + num_classes : int + The number of classes + pos_indices : list of int, optional + The indices of the positive classes, default is all + weights : Tensor of tf.int32, optional + Mask, must be of compatible shape with labels + average : str, optional + 'micro': counts the total number of true positives, false + positives, and false negatives for the classes in + `pos_indices` and infer the metric from it. + 'macro': will compute the metric separately for each class in + `pos_indices` and average. Will not account for class + imbalance. + 'weighted': will compute the metric separately for each class in + `pos_indices` and perform a weighted average by the total + number of true labels for each class. + Returns + ------- + tuple of (scalar float Tensor, update_op) + """ + cm, op = _streaming_confusion_matrix( + labels, predictions, num_classes, weights) + pr, _, _ = metrics_from_confusion_matrix( + cm, pos_indices, average=average) + op, _, _ = metrics_from_confusion_matrix( + op, pos_indices, average=average) + return (pr, op) + + +def recall(labels, predictions, num_classes, pos_indices=None, weights=None, + average='micro'): + """Multi-class recall metric for Tensorflow + Parameters + ---------- + labels : Tensor of tf.int32 or tf.int64 + The true labels + predictions : Tensor of tf.int32 or tf.int64 + The predictions, same shape as labels + num_classes : int + The number of classes + pos_indices : list of int, optional + The indices of the positive classes, default is all + weights : Tensor of tf.int32, optional + Mask, must be of compatible shape with labels + average : str, optional + 'micro': counts the total number of true positives, false + positives, and false negatives for the classes in + `pos_indices` and infer the metric from it. + 'macro': will compute the metric separately for each class in + `pos_indices` and average. Will not account for class + imbalance. + 'weighted': will compute the metric separately for each class in + `pos_indices` and perform a weighted average by the total + number of true labels for each class. + Returns + ------- + tuple of (scalar float Tensor, update_op) + """ + cm, op = _streaming_confusion_matrix( + labels, predictions, num_classes, weights) + _, re, _ = metrics_from_confusion_matrix( + cm, pos_indices, average=average) + _, op, _ = metrics_from_confusion_matrix( + op, pos_indices, average=average) + return (re, op) + + +def f1(labels, predictions, num_classes, pos_indices=None, weights=None, + average='micro'): + return fbeta(labels, predictions, num_classes, pos_indices, weights, + average) + + +def fbeta(labels, predictions, num_classes, pos_indices=None, weights=None, + average='micro', beta=1): + """Multi-class fbeta metric for Tensorflow + Parameters + ---------- + labels : Tensor of tf.int32 or tf.int64 + The true labels + predictions : Tensor of tf.int32 or tf.int64 + The predictions, same shape as labels + num_classes : int + The number of classes + pos_indices : list of int, optional + The indices of the positive classes, default is all + weights : Tensor of tf.int32, optional + Mask, must be of compatible shape with labels + average : str, optional + 'micro': counts the total number of true positives, false + positives, and false negatives for the classes in + `pos_indices` and infer the metric from it. + 'macro': will compute the metric separately for each class in + `pos_indices` and average. Will not account for class + imbalance. + 'weighted': will compute the metric separately for each class in + `pos_indices` and perform a weighted average by the total + number of true labels for each class. + beta : int, optional + Weight of precision in harmonic mean + Returns + ------- + tuple of (scalar float Tensor, update_op) + """ + cm, op = _streaming_confusion_matrix( + labels, predictions, num_classes, weights) + _, _, fbeta = metrics_from_confusion_matrix( + cm, pos_indices, average=average, beta=beta) + _, _, op = metrics_from_confusion_matrix( + op, pos_indices, average=average, beta=beta) + return (fbeta, op) + + +def safe_div(numerator, denominator): + """Safe division, return 0 if denominator is 0""" + numerator, denominator = tf.to_float(numerator), tf.to_float(denominator) + zeros = tf.zeros_like(numerator, dtype=numerator.dtype) + denominator_is_zero = tf.equal(denominator, zeros) + return tf.where(denominator_is_zero, zeros, numerator / denominator) + + +def pr_re_fbeta(cm, pos_indices, beta=1): + """Uses a confusion matrix to compute precision, recall and fbeta""" + num_classes = cm.shape[0] + neg_indices = [i for i in range(num_classes) if i not in pos_indices] + cm_mask = np.ones([num_classes, num_classes]) + cm_mask[neg_indices, neg_indices] = 0 + diag_sum = tf.reduce_sum(tf.diag_part(cm * cm_mask)) + + cm_mask = np.ones([num_classes, num_classes]) + cm_mask[:, neg_indices] = 0 + tot_pred = tf.reduce_sum(cm * cm_mask) + + cm_mask = np.ones([num_classes, num_classes]) + cm_mask[neg_indices, :] = 0 + tot_gold = tf.reduce_sum(cm * cm_mask) + + pr = safe_div(diag_sum, tot_pred) + re = safe_div(diag_sum, tot_gold) + fbeta = safe_div((1. + beta**2) * pr * re, beta**2 * pr + re) + + return pr, re, fbeta + + +def metrics_from_confusion_matrix(cm, pos_indices=None, average='micro', + beta=1): + """Precision, Recall and F1 from the confusion matrix + Parameters + ---------- + cm : tf.Tensor of type tf.int32, of shape (num_classes, num_classes) + The streaming confusion matrix. + pos_indices : list of int, optional + The indices of the positive classes + beta : int, optional + Weight of precision in harmonic mean + average : str, optional + 'micro', 'macro' or 'weighted' + """ + num_classes = cm.shape[0] + if pos_indices is None: + pos_indices = [i for i in range(num_classes)] + + if average == 'micro': + return pr_re_fbeta(cm, pos_indices, beta) + elif average in {'macro', 'weighted'}: + precisions, recalls, fbetas, n_golds = [], [], [], [] + for idx in pos_indices: + pr, re, fbeta = pr_re_fbeta(cm, [idx], beta) + precisions.append(pr) + recalls.append(re) + fbetas.append(fbeta) + cm_mask = np.zeros([num_classes, num_classes]) + cm_mask[idx, :] = 1 + n_golds.append(tf.to_float(tf.reduce_sum(cm * cm_mask))) + + if average == 'macro': + pr = tf.reduce_mean(precisions) + re = tf.reduce_mean(recalls) + fbeta = tf.reduce_mean(fbetas) + return pr, re, fbeta + if average == 'weighted': + n_gold = tf.reduce_sum(n_golds) + pr_sum = sum(p * n for p, n in zip(precisions, n_golds)) + pr = safe_div(pr_sum, n_gold) + re_sum = sum(r * n for r, n in zip(recalls, n_golds)) + re = safe_div(re_sum, n_gold) + fbeta_sum = sum(f * n for f, n in zip(fbetas, n_golds)) + fbeta = safe_div(fbeta_sum, n_gold) + return pr, re, fbeta + + else: + raise NotImplementedError() diff --git a/TensorFlow/LanguageModeling/BERT/triton/scripts/export_model.sh b/TensorFlow/LanguageModeling/BERT/triton/scripts/export_model.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/triton/scripts/launch_server.sh b/TensorFlow/LanguageModeling/BERT/triton/scripts/launch_server.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/triton/scripts/run_client.sh b/TensorFlow/LanguageModeling/BERT/triton/scripts/run_client.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/triton/scripts/run_perf_client.sh b/TensorFlow/LanguageModeling/BERT/triton/scripts/run_perf_client.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/triton/scripts/run_triton_tf.sh b/TensorFlow/LanguageModeling/BERT/triton/scripts/run_triton_tf.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/BERT/triton/scripts/triton_data_download.sh b/TensorFlow/LanguageModeling/BERT/triton/scripts/triton_data_download.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/Dockerfile b/TensorFlow/LanguageModeling/Transformer-XL/Dockerfile old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/LICENSE b/TensorFlow/LanguageModeling/Transformer-XL/LICENSE old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/README.md b/TensorFlow/LanguageModeling/Transformer-XL/README.md old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/getdata.sh b/TensorFlow/LanguageModeling/Transformer-XL/getdata.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/prep_text8.py b/TensorFlow/LanguageModeling/Transformer-XL/prep_text8.py old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/data_utils.py b/TensorFlow/LanguageModeling/Transformer-XL/tf/data_utils.py old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/exp_utils.py b/TensorFlow/LanguageModeling/Transformer-XL/tf/exp_utils.py old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/lamb.py b/TensorFlow/LanguageModeling/Transformer-XL/tf/lamb.py old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/main.py b/TensorFlow/LanguageModeling/Transformer-XL/tf/main.py old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/model.py b/TensorFlow/LanguageModeling/Transformer-XL/tf/model.py old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/run_wt103_base.sh b/TensorFlow/LanguageModeling/Transformer-XL/tf/run_wt103_base.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/scripts/docker/build.sh b/TensorFlow/LanguageModeling/Transformer-XL/tf/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/scripts/docker/interactive.sh b/TensorFlow/LanguageModeling/Transformer-XL/tf/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/scripts/inference_benchmark.sh b/TensorFlow/LanguageModeling/Transformer-XL/tf/scripts/inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/LanguageModeling/Transformer-XL/tf/vocabulary.py b/TensorFlow/LanguageModeling/Transformer-XL/tf/vocabulary.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Recommendation/NCF/download_dataset.sh b/TensorFlow/Recommendation/NCF/download_dataset.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Recommendation/NCF/prepare_dataset.sh b/TensorFlow/Recommendation/NCF/prepare_dataset.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Recommendation/VAE-CF/scripts/benchmark.sh b/TensorFlow/Recommendation/VAE-CF/scripts/benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Recommendation/WideAndDeep/scripts/preproc.sh b/TensorFlow/Recommendation/WideAndDeep/scripts/preproc.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/README.md b/TensorFlow/Segmentation/README.md index 1fcb15f65..8c66962d3 100644 --- a/TensorFlow/Segmentation/README.md +++ b/TensorFlow/Segmentation/README.md @@ -1,97 +1,97 @@ -# Segmentation - -Image Segmentation is the field of image processing that deals with separating the image into multiple subgroups or regions (such as pixels set, also known as image segments) representing distinctive objects or its subparts. - -Nowadays, we are constantly making interpretations of the world around us through cameras and other devices. Therefore image segmentation has become an integral part of our lives, since it's an indispensable technique for teaching the devices how to process this interpretation, how to understand the world around them. - -In this collection, we will cover: -- What is image segmentation? -- Types of image segmentation -- How does image segmentation work? -- Use-cases and applications -- Where to get started - ---- -## What is image segmentation? - -Image segmentation is a computer vision process by which a digital image is divided into various categories or segments. We use this method to understand what is depicted using a pixel-wise classification of the image. It is very much distinct from image classification, which allots labels to an entire image; object detection identifies and locates objects within an image by drawing bounding boxes around them. Image segmentation presents more pixel-level knowledge about the image content. - -Consider a road side scenario with pedestrians, cars and lights: -![](img/3_image-segmentation-figure-1.png) - -This photo is made up of an immense number of individual pixels, and image segmentation aims to assign each of those pixels to the object to which it belongs. Segmentation of an image enables us to segregate the foreground from the background, identify a road or a car's precise location, and mark the margins that separate a pedestrian from a car or road. - ---- -## Types of image segmentation - -Image segmentation tasks can be broken down into two broad categories: semantic segmentation and instance segmentation. - -1. Semantic segmentation:- This is the process of classifying each pixel belonging to a particular label. It doesn't different across different instances of the same object. For example if there are 2 cats in an image, semantic segmentation gives same label to all the pixels of both cats - -2. Instance segmentation:- This differs from semantic segmentation in the sense that it gives a unique label to every instance of a particular object in the image. As can be seen in the image above all 3 dogs are assigned different colours i.e different labels. With semantic segmentation all of them would have been assigned the same colour. - ---- -## How does image segmentation work? -Let's consider image segmentation as a function. -An image is given as input to the function and it gives a matrix or a mask as the output, where each element tells us which class or instance that pixel belongs to. - -Machine learning moves towards image segmentation train models to recognize which features of an image are crucial, rather than designing bespoke heuristics by hand. - -Although deep neural networks architectures for image segmentation may differ in implementation, most follows similar basis structure: - -![](img/3_image-segmentation-figure-2.png) - -Source - [SegNet Paper](https://arxiv.org/pdf/1511.00561.pdf) - -- The encoder: A set of layers that extract features of an image through a sequence of progressively narrower and deeper filters. Oftentimes, the encoder is pre-trained on a different task (like image recognition), where it learns statistical correlations from many images and may transfer that knowledge for the purposes of segmentation. -- The Decoder: A set of layers that progressively grows the output of the encoder into a segmentation mask resembling the pixel resolution of the input image. -- Skip connections: Long range connections in the neural network that allow the model to draw on features at varying spatial scales to improve model accuracy. - -Most of the architectures used for segmentation tasks are built on the technique of Fully Convolutional Network (FCN) i.e., the architecture contains convolution layers instead of any Dense or Max Pool layers. Though various models support the FCN technique, a few handpicked models generally used in production are - UNet, MaskRCNN, and DeepLabv3. - ---- -## Use-cases and applications - -Image Segmentation can be useful for a lot of different use-cases - handwriting recognition, virtual try-on, visual image search, road scene segmentation, organ segmentation and much more. Here are the few applications explained in detail: - -### Autonomous vehicles: - -There are a lot of things that needs your attention while driving- the road, other vehicles, pedestrians, sidewalks, and (potentially) a plethora of other potential obstacles/safety hazards. - -If you’ve been driving for a long time, noticing and reacting to this environment might seem automatic or like second nature. In case of a self driving car, it would be a quick observation that this car needs to see, interpret, and respond to a scene in real-time. This implies the need to create pixel-level map of the world through the camera system in this vehicle in order to navigate it safely and efficiently. - -Even though the field of autonomous machines/automobiles is much more complex than performing segmentation, this pixel-level understanding is a essential ingredient in a step towards reality. - -![](img/3_image-segmentation-figure-3.png) - -### Medical imaging and diagnostics: - -In the initial steps of a diagnostic and treatment pipeline for many conditions that require medical images, such as CT or MRI scans, image segmentation can be used as a powerful technique. - -Essentially, segmentation can effectively distinguish and separate homogeneous areas that may include particularly important pixels of organs, lesions, etc. However, there are significant challenges, including low contrast, noise, and various other imaging ambiguities. - -![](img/3_image-segmentation-figure-4.png) - -### Virtual try-on: - -Virtual try on clothes is quite a fascinating feature which was available in stores using specialized hardware which creates a 3d model. But interestingly with deep learning and image segmentation the same can be obtained using just a 2d image. - -![](img/3_image-segmentation-figure-5.png) ---- -## Where to get started -NVIDIA provides Deep Learning Examples for Image Segmentation on its GitHub repository. These examples provide you with easy to consume and highly optimized scripts for both training and inferencing. The quick start guide at our GitHub repository will help you in setting up the environment using NGC Docker Images, download pre-trained models from NGC and adapt the model training and inference for your application/use-case. -Here are the examples relevant for image segmentation, directly from [Deep Learning Examples](https://github.com/NVIDIA/DeepLearningExamples): - -1. 3D UNet for Medical Image Segmentation using Tensorflow 1.x -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_3D_Medical) -- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) - - -2. 2D UNet for Industrial Defect Segmentation using Tensorflow 1.x -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_Industrial) -- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) - - -3. MaskRCNN for Common Objects Segmentation using PyTorch -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmentation/MaskRCNN) -- Uses PyTorch 20.06-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-pytorch) +# Segmentation + +Image Segmentation is the field of image processing that deals with separating the image into multiple subgroups or regions (such as pixels set, also known as image segments) representing distinctive objects or its subparts. + +Nowadays, we are constantly making interpretations of the world around us through cameras and other devices. Therefore image segmentation has become an integral part of our lives, since it's an indispensable technique for teaching the devices how to process this interpretation, how to understand the world around them. + +In this collection, we will cover: +- What is image segmentation? +- Types of image segmentation +- How does image segmentation work? +- Use-cases and applications +- Where to get started + +--- +## What is image segmentation? + +Image segmentation is a computer vision process by which a digital image is divided into various categories or segments. We use this method to understand what is depicted using a pixel-wise classification of the image. It is very much distinct from image classification, which allots labels to an entire image; object detection identifies and locates objects within an image by drawing bounding boxes around them. Image segmentation presents more pixel-level knowledge about the image content. + +Consider a road side scenario with pedestrians, cars and lights: +![](img/3_image-segmentation-figure-1.png) + +This photo is made up of an immense number of individual pixels, and image segmentation aims to assign each of those pixels to the object to which it belongs. Segmentation of an image enables us to segregate the foreground from the background, identify a road or a car's precise location, and mark the margins that separate a pedestrian from a car or road. + +--- +## Types of image segmentation + +Image segmentation tasks can be broken down into two broad categories: semantic segmentation and instance segmentation. + +1. Semantic segmentation:- This is the process of classifying each pixel belonging to a particular label. It doesn't different across different instances of the same object. For example if there are 2 cats in an image, semantic segmentation gives same label to all the pixels of both cats + +2. Instance segmentation:- This differs from semantic segmentation in the sense that it gives a unique label to every instance of a particular object in the image. As can be seen in the image above all 3 dogs are assigned different colours i.e different labels. With semantic segmentation all of them would have been assigned the same colour. + +--- +## How does image segmentation work? +Let's consider image segmentation as a function. +An image is given as input to the function and it gives a matrix or a mask as the output, where each element tells us which class or instance that pixel belongs to. + +Machine learning moves towards image segmentation train models to recognize which features of an image are crucial, rather than designing bespoke heuristics by hand. + +Although deep neural networks architectures for image segmentation may differ in implementation, most follows similar basis structure: + +![](img/3_image-segmentation-figure-2.png) + +Source - [SegNet Paper](https://arxiv.org/pdf/1511.00561.pdf) + +- The encoder: A set of layers that extract features of an image through a sequence of progressively narrower and deeper filters. Oftentimes, the encoder is pre-trained on a different task (like image recognition), where it learns statistical correlations from many images and may transfer that knowledge for the purposes of segmentation. +- The Decoder: A set of layers that progressively grows the output of the encoder into a segmentation mask resembling the pixel resolution of the input image. +- Skip connections: Long range connections in the neural network that allow the model to draw on features at varying spatial scales to improve model accuracy. + +Most of the architectures used for segmentation tasks are built on the technique of Fully Convolutional Network (FCN) i.e., the architecture contains convolution layers instead of any Dense or Max Pool layers. Though various models support the FCN technique, a few handpicked models generally used in production are - UNet, MaskRCNN, and DeepLabv3. + +--- +## Use-cases and applications + +Image Segmentation can be useful for a lot of different use-cases - handwriting recognition, virtual try-on, visual image search, road scene segmentation, organ segmentation and much more. Here are the few applications explained in detail: + +### Autonomous vehicles: + +There are a lot of things that needs your attention while driving- the road, other vehicles, pedestrians, sidewalks, and (potentially) a plethora of other potential obstacles/safety hazards. + +If you’ve been driving for a long time, noticing and reacting to this environment might seem automatic or like second nature. In case of a self driving car, it would be a quick observation that this car needs to see, interpret, and respond to a scene in real-time. This implies the need to create pixel-level map of the world through the camera system in this vehicle in order to navigate it safely and efficiently. + +Even though the field of autonomous machines/automobiles is much more complex than performing segmentation, this pixel-level understanding is a essential ingredient in a step towards reality. + +![](img/3_image-segmentation-figure-3.png) + +### Medical imaging and diagnostics: + +In the initial steps of a diagnostic and treatment pipeline for many conditions that require medical images, such as CT or MRI scans, image segmentation can be used as a powerful technique. + +Essentially, segmentation can effectively distinguish and separate homogeneous areas that may include particularly important pixels of organs, lesions, etc. However, there are significant challenges, including low contrast, noise, and various other imaging ambiguities. + +![](img/3_image-segmentation-figure-4.png) + +### Virtual try-on: + +Virtual try on clothes is quite a fascinating feature which was available in stores using specialized hardware which creates a 3d model. But interestingly with deep learning and image segmentation the same can be obtained using just a 2d image. + +![](img/3_image-segmentation-figure-5.png) +--- +## Where to get started +NVIDIA provides Deep Learning Examples for Image Segmentation on its GitHub repository. These examples provide you with easy to consume and highly optimized scripts for both training and inferencing. The quick start guide at our GitHub repository will help you in setting up the environment using NGC Docker Images, download pre-trained models from NGC and adapt the model training and inference for your application/use-case. +Here are the examples relevant for image segmentation, directly from [Deep Learning Examples](https://github.com/NVIDIA/DeepLearningExamples): + +1. 3D UNet for Medical Image Segmentation using Tensorflow 1.x +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_3D_Medical) +- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) + + +2. 2D UNet for Industrial Defect Segmentation using Tensorflow 1.x +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_Industrial) +- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) + + +3. MaskRCNN for Common Objects Segmentation using PyTorch +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmentation/MaskRCNN) +- Uses PyTorch 20.06-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-pytorch) diff --git a/TensorFlow/Segmentation/UNet_Industrial/download_and_preprocess_dagm2007.sh b/TensorFlow/Segmentation/UNet_Industrial/download_and_preprocess_dagm2007.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/download_and_preprocess_dagm2007_public.sh b/TensorFlow/Segmentation/UNet_Industrial/download_and_preprocess_dagm2007_public.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/main.py b/TensorFlow/Segmentation/UNet_Industrial/main.py old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/notebooks/download_and_preprocess_dagm2007_public.sh b/TensorFlow/Segmentation/UNet_Industrial/notebooks/download_and_preprocess_dagm2007_public.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_1GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_1GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_1GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_1GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_4GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_4GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_4GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_4GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_8GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_8GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_8GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_8GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_1GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_1GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_1GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_1GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_4GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_4GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_4GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_4GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_8GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_8GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_8GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_8GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_EVAL.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_EVAL.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_EVAL_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_AMP_EVAL_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_EVAL.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_EVAL.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_EVAL_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_EVAL_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_FP32_1GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_FP32_1GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_FP32_4GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_FP32_4GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_FP32_8GPU_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_FP32_8GPU_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_FP32_EVAL_XLA.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/UNet_FP32_EVAL_XLA.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_evalbench.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_evalbench.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_evalbench_AMP.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_evalbench_AMP.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_1GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_1GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_4GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_4GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_8GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_8GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_AMP_1GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_AMP_1GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_AMP_4GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_AMP_4GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_AMP_8GPU.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/benchmarking/UNet_trainbench_AMP_8GPU.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Segmentation/UNet_Industrial/scripts/launch_docker.sh b/TensorFlow/Segmentation/UNet_Industrial/scripts/launch_docker.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Translation/GNMT/img/bleu_score.png b/TensorFlow/Translation/GNMT/img/bleu_score.png old mode 100755 new mode 100644 diff --git a/TensorFlow/Translation/GNMT/scripts/docker/build.sh b/TensorFlow/Translation/GNMT/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Translation/GNMT/scripts/docker/interactive.sh b/TensorFlow/Translation/GNMT/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/TensorFlow/Translation/GNMT/scripts/wmt16_en_de.sh b/TensorFlow/Translation/GNMT/scripts/wmt16_en_de.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/dataset/get_coco.sh b/TensorFlow2/Detection/Efficientdet/dataset/get_coco.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-AMP-32xV100-32G.sub b/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-AMP-32xV100-32G.sub old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-AMP-8xA100-80G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-AMP-8xA100-80G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-AMP-8xV100-32G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-AMP-8xV100-32G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-FP32-32xV100-32G.sub b/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-FP32-32xV100-32G.sub old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-FP32-8xV100-32G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-FP32-8xV100-32G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-TF32-8xA100-80G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/convergence-TF32-8xA100-80G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/evaluate-AMP-8xA100-80G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/evaluate-AMP-8xA100-80G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/evaluate-AMP-8xV100-32G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/evaluate-AMP-8xV100-32G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/evaluate-FP32-8xV100-32G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/evaluate-FP32-8xV100-32G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/evaluate-TF32-8xA100-80G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/evaluate-TF32-8xA100-80G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/inference-benchmark.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/inference-benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/inference.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/inference.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-AMP-1xA100-80G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-AMP-1xA100-80G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-AMP-A100-80G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-AMP-A100-80G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-AMP-V100-32G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-AMP-V100-32G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-FP32-V100-32G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-FP32-V100-32G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-TF32-1xA100-80G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-TF32-1xA100-80G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-TF32-A100-80G.sh b/TensorFlow2/Detection/Efficientdet/scripts/D0/training-benchmark-TF32-A100-80G.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/docker/build.sh b/TensorFlow2/Detection/Efficientdet/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Detection/Efficientdet/scripts/docker/interactive.sh b/TensorFlow2/Detection/Efficientdet/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/data/create_datasets_from_start.sh b/TensorFlow2/LanguageModeling/BERT/data/create_datasets_from_start.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/benchmark_pretraining_lamb_phase2.sh b/TensorFlow2/LanguageModeling/BERT/scripts/benchmark_pretraining_lamb_phase2.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/data_download.sh b/TensorFlow2/LanguageModeling/BERT/scripts/data_download.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/docker/build.sh b/TensorFlow2/LanguageModeling/BERT/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/docker/launch.sh b/TensorFlow2/LanguageModeling/BERT/scripts/docker/launch.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/finetune_inference_benchmark.sh b/TensorFlow2/LanguageModeling/BERT/scripts/finetune_inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/finetune_train_benchmark.sh b/TensorFlow2/LanguageModeling/BERT/scripts/finetune_train_benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/run_inference_benchmark.sh b/TensorFlow2/LanguageModeling/BERT/scripts/run_inference_benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/run_inference_benchmark_seq128.sh b/TensorFlow2/LanguageModeling/BERT/scripts/run_inference_benchmark_seq128.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/run_pretraining_adam.sh b/TensorFlow2/LanguageModeling/BERT/scripts/run_pretraining_adam.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/run_pretraining_lamb.sh b/TensorFlow2/LanguageModeling/BERT/scripts/run_pretraining_lamb.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/run_pretraining_lamb_phase1.sh b/TensorFlow2/LanguageModeling/BERT/scripts/run_pretraining_lamb_phase1.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/run_pretraining_lamb_phase2.sh b/TensorFlow2/LanguageModeling/BERT/scripts/run_pretraining_lamb_phase2.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/run_squad.sh b/TensorFlow2/LanguageModeling/BERT/scripts/run_squad.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/BERT/scripts/run_squad_inference.sh b/TensorFlow2/LanguageModeling/BERT/scripts/run_squad_inference.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/ELECTRA/data/create_datasets_from_start.sh b/TensorFlow2/LanguageModeling/ELECTRA/data/create_datasets_from_start.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/ELECTRA/data/glue/download_mrpc.sh b/TensorFlow2/LanguageModeling/ELECTRA/data/glue/download_mrpc.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/ELECTRA/data/squad/squad_download.sh b/TensorFlow2/LanguageModeling/ELECTRA/data/squad/squad_download.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/ELECTRA/results/.gitkeep b/TensorFlow2/LanguageModeling/ELECTRA/results/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/TensorFlow2/LanguageModeling/ELECTRA/scripts/bind.sh b/TensorFlow2/LanguageModeling/ELECTRA/scripts/bind.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/LanguageModeling/ELECTRA/vocab/vocab.txt b/TensorFlow2/LanguageModeling/ELECTRA/vocab/vocab.txt old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/DLRM_and_DCNv2/deployment/evaluate_latency.py b/TensorFlow2/Recommendation/DLRM_and_DCNv2/deployment/evaluate_latency.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/dgx2_config.sh b/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/dgx2_config.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/prepare_dataset.sh b/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/prepare_dataset.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/run_spark.sh b/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/run_spark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/run_spark_cpu.sh b/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/run_spark_cpu.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/run_spark_gpu.sh b/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/run_spark_gpu.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/verify_criteo_downloaded.sh b/TensorFlow2/Recommendation/DLRM_and_DCNv2/preproc/verify_criteo_downloaded.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/DLRM_and_DCNv2/tensorflow-dot-based-interact/build_pip_pkg.sh b/TensorFlow2/Recommendation/DLRM_and_DCNv2/tensorflow-dot-based-interact/build_pip_pkg.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/SIM/scripts/download_amazon_books_2014.sh b/TensorFlow2/Recommendation/SIM/scripts/download_amazon_books_2014.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/SIM/scripts/run_model.sh b/TensorFlow2/Recommendation/SIM/scripts/run_model.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/hvd_wrapper.sh b/TensorFlow2/Recommendation/WideAndDeep/hvd_wrapper.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/main.py b/TensorFlow2/Recommendation/WideAndDeep/main.py index 81739067d..78944993a 100644 --- a/TensorFlow2/Recommendation/WideAndDeep/main.py +++ b/TensorFlow2/Recommendation/WideAndDeep/main.py @@ -1,40 +1,40 @@ -# Copyright (c) 2021-2022, 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. - -# DO NOT REMOVE THIS IMPORT -# It is here to initialize nvtabular before tensorflow is initialized. -# Removing it leads to a drop in nvtabular dataloader performance -# Do not put other imports before this without running performance validation -import nvtabular # noqa # pylint: disable=unused-import -# See above - -import os - -os.environ["TF_GPU_ALLOCATOR"]="cuda_malloc_async" - -from trainer.model.widedeep import wide_deep_model -from trainer.run import run -from trainer.utils.arguments import parse_args -from trainer.utils.setup import create_config - - -def main(): - args = parse_args() - config = create_config(args) - model, _ = wide_deep_model(args, config["feature_spec"], config["embedding_dimensions"]) - run(args, model, config) - - -if __name__ == "__main__": - main() +# Copyright (c) 2021-2022, 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. + +# DO NOT REMOVE THIS IMPORT +# It is here to initialize nvtabular before tensorflow is initialized. +# Removing it leads to a drop in nvtabular dataloader performance +# Do not put other imports before this without running performance validation +import nvtabular # noqa # pylint: disable=unused-import +# See above + +import os + +os.environ["TF_GPU_ALLOCATOR"]="cuda_malloc_async" + +from trainer.model.widedeep import wide_deep_model +from trainer.run import run +from trainer.utils.arguments import parse_args +from trainer.utils.setup import create_config + + +def main(): + args = parse_args() + config = create_config(args) + model, _ = wide_deep_model(args, config["feature_spec"], config["embedding_dimensions"]) + run(args, model, config) + + +if __name__ == "__main__": + main() diff --git a/TensorFlow2/Recommendation/WideAndDeep/scripts/evaluating_benchmark.sh b/TensorFlow2/Recommendation/WideAndDeep/scripts/evaluating_benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/scripts/preproc.sh b/TensorFlow2/Recommendation/WideAndDeep/scripts/preproc.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/scripts/training_benchmark.sh b/TensorFlow2/Recommendation/WideAndDeep/scripts/training_benchmark.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/scripts/training_full.sh b/TensorFlow2/Recommendation/WideAndDeep/scripts/training_full.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/trainer/model/widedeep.py b/TensorFlow2/Recommendation/WideAndDeep/trainer/model/widedeep.py index 4d8be116a..960598253 100644 --- a/TensorFlow2/Recommendation/WideAndDeep/trainer/model/widedeep.py +++ b/TensorFlow2/Recommendation/WideAndDeep/trainer/model/widedeep.py @@ -1,113 +1,113 @@ -# Copyright (c) 2021-2022, 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. - -import logging -import tensorflow as tf -from data.feature_spec import FeatureSpec -from trainer.model import layers as nvtlayers -from data.outbrain.defaults import NUMERICAL_CHANNEL, ONEHOT_CHANNEL, MULTIHOT_CHANNEL - - -def get_feature_columns(fspec: FeatureSpec, embedding_dimensions: dict, combiner): - logger = logging.getLogger("tensorflow") - wide_columns, deep_columns = [], [] - - categorical_columns = fspec.get_names_by_channel(ONEHOT_CHANNEL) + fspec.get_names_by_channel(MULTIHOT_CHANNEL) - cardinalities = fspec.get_cardinalities(features=categorical_columns) - for column_name in categorical_columns: - - categorical_column = tf.feature_column.categorical_column_with_identity( - column_name, num_buckets=cardinalities[column_name] - ) - wrapped_column = tf.feature_column.embedding_column( - categorical_column, - dimension=embedding_dimensions[column_name], - combiner=combiner, - ) - - wide_columns.append(categorical_column) - deep_columns.append(wrapped_column) - - numerics = [ - tf.feature_column.numeric_column(column_name, shape=(1,), dtype=tf.float32) - for column_name in fspec.get_names_by_channel(NUMERICAL_CHANNEL) - ] - - wide_columns.extend(numerics) - deep_columns.extend(numerics) - - logger.warning("deep columns: {}".format(len(deep_columns))) - logger.warning("wide columns: {}".format(len(wide_columns))) - logger.warning( - "wide&deep intersection: {}".format( - len(set(wide_columns).intersection(set(deep_columns))) - ) - ) - return wide_columns, deep_columns - -def get_input_features(feature_spec): - features = {} - - numeric_columns = feature_spec.get_names_by_channel(NUMERICAL_CHANNEL) - onehot_columns = feature_spec.get_names_by_channel(ONEHOT_CHANNEL) - multihot_columns = feature_spec.get_names_by_channel(MULTIHOT_CHANNEL) - - # Numerical - for feature in numeric_columns: - features[feature] = tf.keras.Input( - shape=(1,), batch_size=None, name=feature, dtype=tf.float32, sparse=False - ) - - # Categorical (One-hot) - for feature in onehot_columns: - features[feature] = tf.keras.Input( - shape=(1,), batch_size=None, name=feature, dtype=tf.int32, sparse=False - ) - - # Categorical (Multi-hot) - multihot_hotness_dict = feature_spec.get_multihot_hotnesses(multihot_columns) - for feature, hotness in multihot_hotness_dict.items(): - features[feature] = tf.keras.Input( - shape=(hotness,), - batch_size=None, - name=f"{feature}", - dtype=tf.int32, - sparse=False, - ) - - return features - - -def wide_deep_model(args, feature_spec, embedding_dimensions): - wide_columns, deep_columns = get_feature_columns(fspec=feature_spec, - embedding_dimensions=embedding_dimensions, - combiner=args.combiner) - features = get_input_features(feature_spec) - - wide = nvtlayers.LinearFeatures(wide_columns, name="wide_linear")(features) - - dnn = nvtlayers.DenseFeatures(deep_columns, name="deep_embedded")(features) - for unit_size in args.deep_hidden_units: - dnn = tf.keras.layers.Dense(units=unit_size, activation="relu")(dnn) - dnn = tf.keras.layers.Dropout(rate=args.deep_dropout)(dnn) - dnn = tf.keras.layers.Dense(units=1)(dnn) - - dnn_model = tf.keras.Model(inputs=features, outputs=dnn) - linear_model = tf.keras.Model(inputs=features, outputs=wide) - - model = tf.keras.experimental.WideDeepModel( - linear_model, dnn_model, activation="sigmoid" - ) - +# Copyright (c) 2021-2022, 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. + +import logging +import tensorflow as tf +from data.feature_spec import FeatureSpec +from trainer.model import layers as nvtlayers +from data.outbrain.defaults import NUMERICAL_CHANNEL, ONEHOT_CHANNEL, MULTIHOT_CHANNEL + + +def get_feature_columns(fspec: FeatureSpec, embedding_dimensions: dict, combiner): + logger = logging.getLogger("tensorflow") + wide_columns, deep_columns = [], [] + + categorical_columns = fspec.get_names_by_channel(ONEHOT_CHANNEL) + fspec.get_names_by_channel(MULTIHOT_CHANNEL) + cardinalities = fspec.get_cardinalities(features=categorical_columns) + for column_name in categorical_columns: + + categorical_column = tf.feature_column.categorical_column_with_identity( + column_name, num_buckets=cardinalities[column_name] + ) + wrapped_column = tf.feature_column.embedding_column( + categorical_column, + dimension=embedding_dimensions[column_name], + combiner=combiner, + ) + + wide_columns.append(categorical_column) + deep_columns.append(wrapped_column) + + numerics = [ + tf.feature_column.numeric_column(column_name, shape=(1,), dtype=tf.float32) + for column_name in fspec.get_names_by_channel(NUMERICAL_CHANNEL) + ] + + wide_columns.extend(numerics) + deep_columns.extend(numerics) + + logger.warning("deep columns: {}".format(len(deep_columns))) + logger.warning("wide columns: {}".format(len(wide_columns))) + logger.warning( + "wide&deep intersection: {}".format( + len(set(wide_columns).intersection(set(deep_columns))) + ) + ) + return wide_columns, deep_columns + +def get_input_features(feature_spec): + features = {} + + numeric_columns = feature_spec.get_names_by_channel(NUMERICAL_CHANNEL) + onehot_columns = feature_spec.get_names_by_channel(ONEHOT_CHANNEL) + multihot_columns = feature_spec.get_names_by_channel(MULTIHOT_CHANNEL) + + # Numerical + for feature in numeric_columns: + features[feature] = tf.keras.Input( + shape=(1,), batch_size=None, name=feature, dtype=tf.float32, sparse=False + ) + + # Categorical (One-hot) + for feature in onehot_columns: + features[feature] = tf.keras.Input( + shape=(1,), batch_size=None, name=feature, dtype=tf.int32, sparse=False + ) + + # Categorical (Multi-hot) + multihot_hotness_dict = feature_spec.get_multihot_hotnesses(multihot_columns) + for feature, hotness in multihot_hotness_dict.items(): + features[feature] = tf.keras.Input( + shape=(hotness,), + batch_size=None, + name=f"{feature}", + dtype=tf.int32, + sparse=False, + ) + + return features + + +def wide_deep_model(args, feature_spec, embedding_dimensions): + wide_columns, deep_columns = get_feature_columns(fspec=feature_spec, + embedding_dimensions=embedding_dimensions, + combiner=args.combiner) + features = get_input_features(feature_spec) + + wide = nvtlayers.LinearFeatures(wide_columns, name="wide_linear")(features) + + dnn = nvtlayers.DenseFeatures(deep_columns, name="deep_embedded")(features) + for unit_size in args.deep_hidden_units: + dnn = tf.keras.layers.Dense(units=unit_size, activation="relu")(dnn) + dnn = tf.keras.layers.Dropout(rate=args.deep_dropout)(dnn) + dnn = tf.keras.layers.Dense(units=1)(dnn) + + dnn_model = tf.keras.Model(inputs=features, outputs=dnn) + linear_model = tf.keras.Model(inputs=features, outputs=wide) + + model = tf.keras.experimental.WideDeepModel( + linear_model, dnn_model, activation="sigmoid" + ) + return model, features \ No newline at end of file diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/calculate_metrics.py b/TensorFlow2/Recommendation/WideAndDeep/triton/calculate_metrics.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/export_model.py b/TensorFlow2/Recommendation/WideAndDeep/triton/export_model.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/run_inference_on_fw.py b/TensorFlow2/Recommendation/WideAndDeep/triton/run_inference_on_fw.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/run_inference_on_triton.py b/TensorFlow2/Recommendation/WideAndDeep/triton/run_inference_on_triton.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/run_performance_on_triton.py b/TensorFlow2/Recommendation/WideAndDeep/triton/run_performance_on_triton.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/runner/downloader.py b/TensorFlow2/Recommendation/WideAndDeep/triton/runner/downloader.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/runner/pipeline_impl.py b/TensorFlow2/Recommendation/WideAndDeep/triton/runner/pipeline_impl.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/runner/start_NVIDIA-A30.sh b/TensorFlow2/Recommendation/WideAndDeep/triton/runner/start_NVIDIA-A30.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh b/TensorFlow2/Recommendation/WideAndDeep/triton/runner/start_NVIDIA-DGX-1-(1x-V100-32GB).sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh b/TensorFlow2/Recommendation/WideAndDeep/triton/runner/start_NVIDIA-DGX-A100-(1x-A100-80GB).sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/runner/start_NVIDIA-T4.sh b/TensorFlow2/Recommendation/WideAndDeep/triton/runner/start_NVIDIA-T4.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/scripts/docker/build.sh b/TensorFlow2/Recommendation/WideAndDeep/triton/scripts/docker/build.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/scripts/docker/interactive.sh b/TensorFlow2/Recommendation/WideAndDeep/triton/scripts/docker/interactive.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/scripts/docker/triton_inference_server.sh b/TensorFlow2/Recommendation/WideAndDeep/triton/scripts/docker/triton_inference_server.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Recommendation/WideAndDeep/triton/scripts/setup_environment.sh b/TensorFlow2/Recommendation/WideAndDeep/triton/scripts/setup_environment.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/MaskRCNN/dataset/download_and_preprocess_coco.sh b/TensorFlow2/Segmentation/MaskRCNN/dataset/download_and_preprocess_coco.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/README.md b/TensorFlow2/Segmentation/README.md index 1fcb15f65..8c66962d3 100644 --- a/TensorFlow2/Segmentation/README.md +++ b/TensorFlow2/Segmentation/README.md @@ -1,97 +1,97 @@ -# Segmentation - -Image Segmentation is the field of image processing that deals with separating the image into multiple subgroups or regions (such as pixels set, also known as image segments) representing distinctive objects or its subparts. - -Nowadays, we are constantly making interpretations of the world around us through cameras and other devices. Therefore image segmentation has become an integral part of our lives, since it's an indispensable technique for teaching the devices how to process this interpretation, how to understand the world around them. - -In this collection, we will cover: -- What is image segmentation? -- Types of image segmentation -- How does image segmentation work? -- Use-cases and applications -- Where to get started - ---- -## What is image segmentation? - -Image segmentation is a computer vision process by which a digital image is divided into various categories or segments. We use this method to understand what is depicted using a pixel-wise classification of the image. It is very much distinct from image classification, which allots labels to an entire image; object detection identifies and locates objects within an image by drawing bounding boxes around them. Image segmentation presents more pixel-level knowledge about the image content. - -Consider a road side scenario with pedestrians, cars and lights: -![](img/3_image-segmentation-figure-1.png) - -This photo is made up of an immense number of individual pixels, and image segmentation aims to assign each of those pixels to the object to which it belongs. Segmentation of an image enables us to segregate the foreground from the background, identify a road or a car's precise location, and mark the margins that separate a pedestrian from a car or road. - ---- -## Types of image segmentation - -Image segmentation tasks can be broken down into two broad categories: semantic segmentation and instance segmentation. - -1. Semantic segmentation:- This is the process of classifying each pixel belonging to a particular label. It doesn't different across different instances of the same object. For example if there are 2 cats in an image, semantic segmentation gives same label to all the pixels of both cats - -2. Instance segmentation:- This differs from semantic segmentation in the sense that it gives a unique label to every instance of a particular object in the image. As can be seen in the image above all 3 dogs are assigned different colours i.e different labels. With semantic segmentation all of them would have been assigned the same colour. - ---- -## How does image segmentation work? -Let's consider image segmentation as a function. -An image is given as input to the function and it gives a matrix or a mask as the output, where each element tells us which class or instance that pixel belongs to. - -Machine learning moves towards image segmentation train models to recognize which features of an image are crucial, rather than designing bespoke heuristics by hand. - -Although deep neural networks architectures for image segmentation may differ in implementation, most follows similar basis structure: - -![](img/3_image-segmentation-figure-2.png) - -Source - [SegNet Paper](https://arxiv.org/pdf/1511.00561.pdf) - -- The encoder: A set of layers that extract features of an image through a sequence of progressively narrower and deeper filters. Oftentimes, the encoder is pre-trained on a different task (like image recognition), where it learns statistical correlations from many images and may transfer that knowledge for the purposes of segmentation. -- The Decoder: A set of layers that progressively grows the output of the encoder into a segmentation mask resembling the pixel resolution of the input image. -- Skip connections: Long range connections in the neural network that allow the model to draw on features at varying spatial scales to improve model accuracy. - -Most of the architectures used for segmentation tasks are built on the technique of Fully Convolutional Network (FCN) i.e., the architecture contains convolution layers instead of any Dense or Max Pool layers. Though various models support the FCN technique, a few handpicked models generally used in production are - UNet, MaskRCNN, and DeepLabv3. - ---- -## Use-cases and applications - -Image Segmentation can be useful for a lot of different use-cases - handwriting recognition, virtual try-on, visual image search, road scene segmentation, organ segmentation and much more. Here are the few applications explained in detail: - -### Autonomous vehicles: - -There are a lot of things that needs your attention while driving- the road, other vehicles, pedestrians, sidewalks, and (potentially) a plethora of other potential obstacles/safety hazards. - -If you’ve been driving for a long time, noticing and reacting to this environment might seem automatic or like second nature. In case of a self driving car, it would be a quick observation that this car needs to see, interpret, and respond to a scene in real-time. This implies the need to create pixel-level map of the world through the camera system in this vehicle in order to navigate it safely and efficiently. - -Even though the field of autonomous machines/automobiles is much more complex than performing segmentation, this pixel-level understanding is a essential ingredient in a step towards reality. - -![](img/3_image-segmentation-figure-3.png) - -### Medical imaging and diagnostics: - -In the initial steps of a diagnostic and treatment pipeline for many conditions that require medical images, such as CT or MRI scans, image segmentation can be used as a powerful technique. - -Essentially, segmentation can effectively distinguish and separate homogeneous areas that may include particularly important pixels of organs, lesions, etc. However, there are significant challenges, including low contrast, noise, and various other imaging ambiguities. - -![](img/3_image-segmentation-figure-4.png) - -### Virtual try-on: - -Virtual try on clothes is quite a fascinating feature which was available in stores using specialized hardware which creates a 3d model. But interestingly with deep learning and image segmentation the same can be obtained using just a 2d image. - -![](img/3_image-segmentation-figure-5.png) ---- -## Where to get started -NVIDIA provides Deep Learning Examples for Image Segmentation on its GitHub repository. These examples provide you with easy to consume and highly optimized scripts for both training and inferencing. The quick start guide at our GitHub repository will help you in setting up the environment using NGC Docker Images, download pre-trained models from NGC and adapt the model training and inference for your application/use-case. -Here are the examples relevant for image segmentation, directly from [Deep Learning Examples](https://github.com/NVIDIA/DeepLearningExamples): - -1. 3D UNet for Medical Image Segmentation using Tensorflow 1.x -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_3D_Medical) -- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) - - -2. 2D UNet for Industrial Defect Segmentation using Tensorflow 1.x -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_Industrial) -- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) - - -3. MaskRCNN for Common Objects Segmentation using PyTorch -- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmentation/MaskRCNN) -- Uses PyTorch 20.06-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-pytorch) +# Segmentation + +Image Segmentation is the field of image processing that deals with separating the image into multiple subgroups or regions (such as pixels set, also known as image segments) representing distinctive objects or its subparts. + +Nowadays, we are constantly making interpretations of the world around us through cameras and other devices. Therefore image segmentation has become an integral part of our lives, since it's an indispensable technique for teaching the devices how to process this interpretation, how to understand the world around them. + +In this collection, we will cover: +- What is image segmentation? +- Types of image segmentation +- How does image segmentation work? +- Use-cases and applications +- Where to get started + +--- +## What is image segmentation? + +Image segmentation is a computer vision process by which a digital image is divided into various categories or segments. We use this method to understand what is depicted using a pixel-wise classification of the image. It is very much distinct from image classification, which allots labels to an entire image; object detection identifies and locates objects within an image by drawing bounding boxes around them. Image segmentation presents more pixel-level knowledge about the image content. + +Consider a road side scenario with pedestrians, cars and lights: +![](img/3_image-segmentation-figure-1.png) + +This photo is made up of an immense number of individual pixels, and image segmentation aims to assign each of those pixels to the object to which it belongs. Segmentation of an image enables us to segregate the foreground from the background, identify a road or a car's precise location, and mark the margins that separate a pedestrian from a car or road. + +--- +## Types of image segmentation + +Image segmentation tasks can be broken down into two broad categories: semantic segmentation and instance segmentation. + +1. Semantic segmentation:- This is the process of classifying each pixel belonging to a particular label. It doesn't different across different instances of the same object. For example if there are 2 cats in an image, semantic segmentation gives same label to all the pixels of both cats + +2. Instance segmentation:- This differs from semantic segmentation in the sense that it gives a unique label to every instance of a particular object in the image. As can be seen in the image above all 3 dogs are assigned different colours i.e different labels. With semantic segmentation all of them would have been assigned the same colour. + +--- +## How does image segmentation work? +Let's consider image segmentation as a function. +An image is given as input to the function and it gives a matrix or a mask as the output, where each element tells us which class or instance that pixel belongs to. + +Machine learning moves towards image segmentation train models to recognize which features of an image are crucial, rather than designing bespoke heuristics by hand. + +Although deep neural networks architectures for image segmentation may differ in implementation, most follows similar basis structure: + +![](img/3_image-segmentation-figure-2.png) + +Source - [SegNet Paper](https://arxiv.org/pdf/1511.00561.pdf) + +- The encoder: A set of layers that extract features of an image through a sequence of progressively narrower and deeper filters. Oftentimes, the encoder is pre-trained on a different task (like image recognition), where it learns statistical correlations from many images and may transfer that knowledge for the purposes of segmentation. +- The Decoder: A set of layers that progressively grows the output of the encoder into a segmentation mask resembling the pixel resolution of the input image. +- Skip connections: Long range connections in the neural network that allow the model to draw on features at varying spatial scales to improve model accuracy. + +Most of the architectures used for segmentation tasks are built on the technique of Fully Convolutional Network (FCN) i.e., the architecture contains convolution layers instead of any Dense or Max Pool layers. Though various models support the FCN technique, a few handpicked models generally used in production are - UNet, MaskRCNN, and DeepLabv3. + +--- +## Use-cases and applications + +Image Segmentation can be useful for a lot of different use-cases - handwriting recognition, virtual try-on, visual image search, road scene segmentation, organ segmentation and much more. Here are the few applications explained in detail: + +### Autonomous vehicles: + +There are a lot of things that needs your attention while driving- the road, other vehicles, pedestrians, sidewalks, and (potentially) a plethora of other potential obstacles/safety hazards. + +If you’ve been driving for a long time, noticing and reacting to this environment might seem automatic or like second nature. In case of a self driving car, it would be a quick observation that this car needs to see, interpret, and respond to a scene in real-time. This implies the need to create pixel-level map of the world through the camera system in this vehicle in order to navigate it safely and efficiently. + +Even though the field of autonomous machines/automobiles is much more complex than performing segmentation, this pixel-level understanding is a essential ingredient in a step towards reality. + +![](img/3_image-segmentation-figure-3.png) + +### Medical imaging and diagnostics: + +In the initial steps of a diagnostic and treatment pipeline for many conditions that require medical images, such as CT or MRI scans, image segmentation can be used as a powerful technique. + +Essentially, segmentation can effectively distinguish and separate homogeneous areas that may include particularly important pixels of organs, lesions, etc. However, there are significant challenges, including low contrast, noise, and various other imaging ambiguities. + +![](img/3_image-segmentation-figure-4.png) + +### Virtual try-on: + +Virtual try on clothes is quite a fascinating feature which was available in stores using specialized hardware which creates a 3d model. But interestingly with deep learning and image segmentation the same can be obtained using just a 2d image. + +![](img/3_image-segmentation-figure-5.png) +--- +## Where to get started +NVIDIA provides Deep Learning Examples for Image Segmentation on its GitHub repository. These examples provide you with easy to consume and highly optimized scripts for both training and inferencing. The quick start guide at our GitHub repository will help you in setting up the environment using NGC Docker Images, download pre-trained models from NGC and adapt the model training and inference for your application/use-case. +Here are the examples relevant for image segmentation, directly from [Deep Learning Examples](https://github.com/NVIDIA/DeepLearningExamples): + +1. 3D UNet for Medical Image Segmentation using Tensorflow 1.x +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_3D_Medical) +- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) + + +2. 2D UNet for Industrial Defect Segmentation using Tensorflow 1.x +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/TensorFlow/Segmentation/UNet_Industrial) +- Uses TensorFlow 20.06-tf1-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-tensorflow) + + +3. MaskRCNN for Common Objects Segmentation using PyTorch +- [Git repository](https://github.com/NVIDIA/DeepLearningExamples/tree/master/PyTorch/Segmentation/MaskRCNN) +- Uses PyTorch 20.06-py3 [NGC container](https://ngc.nvidia.com/registry/nvidia-pytorch) diff --git a/TensorFlow2/Segmentation/UNet_Medical/Dockerfile b/TensorFlow2/Segmentation/UNet_Medical/Dockerfile old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/LICENSE b/TensorFlow2/Segmentation/UNet_Medical/LICENSE old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/NOTICE b/TensorFlow2/Segmentation/UNet_Medical/NOTICE old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/README.md b/TensorFlow2/Segmentation/UNet_Medical/README.md old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/data_loading/data_loader.py b/TensorFlow2/Segmentation/UNet_Medical/data_loading/data_loader.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/download_dataset.py b/TensorFlow2/Segmentation/UNet_Medical/download_dataset.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/examples/unet_INFER.sh b/TensorFlow2/Segmentation/UNet_Medical/examples/unet_INFER.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/examples/unet_INFER_BENCHMARK.sh b/TensorFlow2/Segmentation/UNet_Medical/examples/unet_INFER_BENCHMARK.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/examples/unet_INFER_BENCHMARK_TF-AMP.sh b/TensorFlow2/Segmentation/UNet_Medical/examples/unet_INFER_BENCHMARK_TF-AMP.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/examples/unet_INFER_TF-AMP.sh b/TensorFlow2/Segmentation/UNet_Medical/examples/unet_INFER_TF-AMP.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/examples/unet_TRAIN_BENCHMARK.sh b/TensorFlow2/Segmentation/UNet_Medical/examples/unet_TRAIN_BENCHMARK.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/examples/unet_TRAIN_BENCHMARK_TF-AMP.sh b/TensorFlow2/Segmentation/UNet_Medical/examples/unet_TRAIN_BENCHMARK_TF-AMP.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/examples/unet_TRAIN_SINGLE.sh b/TensorFlow2/Segmentation/UNet_Medical/examples/unet_TRAIN_SINGLE.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/examples/unet_TRAIN_SINGLE_TF-AMP.sh b/TensorFlow2/Segmentation/UNet_Medical/examples/unet_TRAIN_SINGLE_TF-AMP.sh old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/images/unet.png b/TensorFlow2/Segmentation/UNet_Medical/images/unet.png old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/main.py b/TensorFlow2/Segmentation/UNet_Medical/main.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/model/layers.py b/TensorFlow2/Segmentation/UNet_Medical/model/layers.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/model/unet.py b/TensorFlow2/Segmentation/UNet_Medical/model/unet.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/requirements.txt b/TensorFlow2/Segmentation/UNet_Medical/requirements.txt old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/runtime/arguments.py b/TensorFlow2/Segmentation/UNet_Medical/runtime/arguments.py old mode 100755 new mode 100644 diff --git a/TensorFlow2/Segmentation/UNet_Medical/runtime/losses.py b/TensorFlow2/Segmentation/UNet_Medical/runtime/losses.py old mode 100755 new mode 100644 diff --git a/Tools/DGLPyTorch/SyntheticGraphGeneration/docker_scripts/build_docker.sh b/Tools/DGLPyTorch/SyntheticGraphGeneration/docker_scripts/build_docker.sh old mode 100755 new mode 100644 diff --git a/Tools/DGLPyTorch/SyntheticGraphGeneration/docker_scripts/run_docker_interactive.sh b/Tools/DGLPyTorch/SyntheticGraphGeneration/docker_scripts/run_docker_interactive.sh old mode 100755 new mode 100644 diff --git a/Tools/DGLPyTorch/SyntheticGraphGeneration/docker_scripts/run_docker_notebook.sh b/Tools/DGLPyTorch/SyntheticGraphGeneration/docker_scripts/run_docker_notebook.sh old mode 100755 new mode 100644 diff --git a/Tools/DGLPyTorch/SyntheticGraphGeneration/requirements.txt b/Tools/DGLPyTorch/SyntheticGraphGeneration/requirements.txt deleted file mode 100644 index 0b114d7cd..000000000 --- a/Tools/DGLPyTorch/SyntheticGraphGeneration/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -snap-stanford==6.0.0 -similaritymeasures==0.6.0 -seaborn==0.12.2 -ipywidgets==8.0.4 -ipython_autotime==0.3.1 -scikit-plot>=0.3.7 diff --git a/Tools/DGLPyTorch/SyntheticGraphGeneration/scripts/get_datasets.sh b/Tools/DGLPyTorch/SyntheticGraphGeneration/scripts/get_datasets.sh old mode 100755 new mode 100644 diff --git a/Tools/DGLPyTorch/SyntheticGraphGeneration/scripts/ieee_fraud.py b/Tools/DGLPyTorch/SyntheticGraphGeneration/scripts/ieee_fraud.py old mode 100755 new mode 100644 diff --git a/Tools/DGLPyTorch/SyntheticGraphGeneration/scripts/time_filter_credit.py b/Tools/DGLPyTorch/SyntheticGraphGeneration/scripts/time_filter_credit.py old mode 100755 new mode 100644 diff --git a/Tools/DGLPyTorch/SyntheticGraphGeneration/scripts/time_filter_tabformer.py b/Tools/DGLPyTorch/SyntheticGraphGeneration/scripts/time_filter_tabformer.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/.dockerignore b/Tools/PyTorch/TimeSeriesPredictionPlatform/.dockerignore old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/.gitignore b/Tools/PyTorch/TimeSeriesPredictionPlatform/.gitignore old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/Dockerfile b/Tools/PyTorch/TimeSeriesPredictionPlatform/Dockerfile old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/LICENSE b/Tools/PyTorch/TimeSeriesPredictionPlatform/LICENSE old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/LICENSE AGREEMENT b/Tools/PyTorch/TimeSeriesPredictionPlatform/LICENSE AGREEMENT old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/NOTICE b/Tools/PyTorch/TimeSeriesPredictionPlatform/NOTICE old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/README.md b/Tools/PyTorch/TimeSeriesPredictionPlatform/README.md old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/callbacks/callbacks.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/callbacks/callbacks.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/callbacks/ctl_callbacks.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/callbacks/ctl_callbacks.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/M5.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/M5.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/M5_norm.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/M5_norm.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/electricity.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/electricity.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/electricity_xgb.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/electricity_xgb.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/traffic.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/dataset/traffic.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/evaluator/ctlevaluator.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/evaluator/ctlevaluator.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/evaluator/statevaluator.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/evaluator/statevaluator.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/hydra/job_logging/primary.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/hydra/job_logging/primary.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/hydra/job_logging/secondary.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/hydra/job_logging/secondary.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/auto_arima.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/auto_arima.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/deepar.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/deepar.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/lstm.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/lstm.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/tft.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/tft.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/trivial.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model/trivial.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_M5.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_M5.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_M5_norm.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_M5_norm.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_electricity.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_electricity.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_favorita.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_favorita.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_traffic.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/model_dataset/tft_traffic.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/preproc_config.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/preproc_config.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/train_config.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/train_config.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/callbacks/callbacks/early_stopping.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/callbacks/callbacks/early_stopping.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/callbacks/callbacks/save_best_checkpoint.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/callbacks/callbacks/save_best_checkpoint.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/callbacks/callbacks/throughput_benchmark.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/callbacks/callbacks/throughput_benchmark.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/callbacks/standard.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/callbacks/standard.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/criterion/GLL.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/criterion/GLL.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/criterion/MSE.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/criterion/MSE.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/criterion/quantile.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/criterion/quantile.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/ctltrainer.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/ctltrainer.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/ASGD.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/ASGD.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/Adadelta.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/Adadelta.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/Adam.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/Adam.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/AdamW.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/AdamW.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/Adamax.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/Adamax.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/LBFGS.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/LBFGS.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/RMSprop.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/RMSprop.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/Rprop.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/Rprop.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/SGD.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/SGD.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/SparseAdam.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/SparseAdam.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/TorchAdam.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/optimizer/TorchAdam.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/stattrainer.yaml b/Tools/PyTorch/TimeSeriesPredictionPlatform/conf/trainer/stattrainer.yaml old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/criterion.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/criterion.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/data/data_utils.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/data/data_utils.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/data/script_download_data.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/data/script_download_data.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/distributed_utils.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/distributed_utils.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/evaluators/evaluation_metrics.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/evaluators/evaluation_metrics.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/inference/deploy.sh b/Tools/PyTorch/TimeSeriesPredictionPlatform/inference/deploy.sh old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/inference/inference.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/inference/inference.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/inference/launch_triton_server.sh b/Tools/PyTorch/TimeSeriesPredictionPlatform/inference/launch_triton_server.sh old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/launch_preproc.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/launch_preproc.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/launch_training.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/launch_training.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/loggers/log_helper.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/loggers/log_helper.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/models/lstm.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/models/lstm.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/models/stat_models.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/models/stat_models.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/models/trivial_model.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/models/trivial_model.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/requirements.txt b/Tools/PyTorch/TimeSeriesPredictionPlatform/requirements.txt old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/training/ema.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/training/ema.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/training/trainer.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/training/trainer.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/training/utils.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/training/utils.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/calculate_metrics.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/calculate_metrics.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/export_model.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/export_model.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/run_inference_on_fw.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/run_inference_on_fw.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/run_inference_on_triton.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/run_inference_on_triton.py old mode 100755 new mode 100644 diff --git a/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/run_performance_on_triton.py b/Tools/PyTorch/TimeSeriesPredictionPlatform/triton/run_performance_on_triton.py old mode 100755 new mode 100644 diff --git a/hello.txt b/hello.txt new file mode 100644 index 000000000..3e4300709 --- /dev/null +++ b/hello.txt @@ -0,0 +1,3 @@ +aaa +in the by bybyby +vbvv \ No newline at end of file