diff --git a/nntrainer/layers/cl_layers/custom_vocab_selection.cpp b/nntrainer/layers/cl_layers/custom_vocab_selection.cpp index 171942be99..b79ed4f3ab 100644 --- a/nntrainer/layers/cl_layers/custom_vocab_selection.cpp +++ b/nntrainer/layers/cl_layers/custom_vocab_selection.cpp @@ -1,6 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 /** - * Copyright (C) 2024 Yash Singh > + * Copyright (C) 2024 Hyeonseok Lee + * Copyright (C) 2024 Yash Singh * * @file custom_vocab_selection.cpp * @date 1 Oct 2024 diff --git a/nntrainer/layers/cl_layers/custom_vocab_selection.h b/nntrainer/layers/cl_layers/custom_vocab_selection.h index 4334679397..5424549118 100644 --- a/nntrainer/layers/cl_layers/custom_vocab_selection.h +++ b/nntrainer/layers/cl_layers/custom_vocab_selection.h @@ -1,6 +1,7 @@ // SPDX-License-Identifier: Apache-2.0 /** - * Copyright (C) 2024 Yash Singh > + * Copyright (C) 2024 Hyeonseok Lee + * Copyright (C) 2024 Yash Singh * * @file custom_vocab_selection.h * @date 1 Oct 2024 diff --git a/nntrainer/layers/cl_layers/lm_head_layer_cl.cpp b/nntrainer/layers/cl_layers/lm_head_layer_cl.cpp index df91deaca7..457c693736 100644 --- a/nntrainer/layers/cl_layers/lm_head_layer_cl.cpp +++ b/nntrainer/layers/cl_layers/lm_head_layer_cl.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 /** - * Copyright (C) 2024 Yash Singh > + * Copyright (C) 2024 Yash Singh * * @file lm_head_layer_cl.cpp * @date 1 Oct 2024 @@ -26,7 +26,7 @@ enum LMHeadParams { weight, bias, candidate_weight, candidate_hidden_step }; CustomLMHeadLayerCl::CustomLMHeadLayerCl() : LayerImpl(), custom_lm_head_props(nntrainer::props::Unit(), props::UseVocabSelection(), - props::LshChoices(), props::SmartReply()) { + props::LshChoices()) { weight_idx.fill(std::numeric_limits::max()); } @@ -36,8 +36,6 @@ void CustomLMHeadLayerCl::finalize(nntrainer::InitLayerContext &context) { auto &weight_regularizer_constant = std::get(*layer_impl_props); auto weight_initializer = nntrainer::props::InitializerInfo::Enum::ZEROS; - // auto &weight_initializer = - // std::get(*layer_impl_props); auto &weight_decay = std::get(*layer_impl_props); auto &bias_decay = std::get(*layer_impl_props); @@ -170,14 +168,14 @@ void CustomLMHeadLayerCl::incremental_forwarding( hidden_step_dim.batch(1); hidden_step_dim.height(1); - bool smart_reply = std::get(custom_lm_head_props).get(); + // bool smart_reply = std::get(custom_lm_head_props).get(); unsigned int b_size = input_dim.batch(); unsigned omp_num = 4; - if (smart_reply && !_from) { - b_size = 1; - omp_num = 1; - } + // if (smart_reply && !_from) { + // b_size = 1; + // omp_num = 1; + // } // #pragma omp parallel for num_threads(omp_num) for (unsigned int b = 0; b < b_size; ++b) { @@ -228,7 +226,7 @@ void CustomLMHeadLayerCl::incremental_forwarding( nntrainer::Tensor &bias = context.getWeight(weight_idx[LMHeadParams::bias]); - add_i_cl(bias, hidden_step); + add_i_cl(hidden_step, bias); } } } @@ -239,21 +237,4 @@ void CustomLMHeadLayerCl::setProperty(const std::vector &values) { auto remain_props = loadProperties(values, custom_lm_head_props); LayerImpl::setProperty(remain_props); } - -#ifdef PLUGGABLE - -nntrainer::Layer *create_custom_lm_head_layer() { - auto layer = new CustomLMHeadLayerCl(); - return layer; -} - -void destroy_custom_lm_head_layer(nntrainer::Layer *layer) { delete layer; } - -extern "C" { -nntrainer::LayerPluggable ml_train_layer_pluggable{ - create_custom_lm_head_layer, destroy_custom_lm_head_layer}; -} - -#endif - } // namespace nntrainer diff --git a/nntrainer/layers/cl_layers/lm_head_layer_cl.h b/nntrainer/layers/cl_layers/lm_head_layer_cl.h index 6378c6f778..553e85ba36 100644 --- a/nntrainer/layers/cl_layers/lm_head_layer_cl.h +++ b/nntrainer/layers/cl_layers/lm_head_layer_cl.h @@ -14,7 +14,6 @@ #ifndef __CUSTOM_LM_HEAD_LAYER_H__ #define __CUSTOM_LM_HEAD_LAYER_H__ -#include #include #include #include @@ -152,13 +151,12 @@ class CustomLMHeadLayerCl : public LayerImpl { private: std::tuple + props::LshChoices> custom_lm_head_props; std::array weight_idx; /**< indices of the weights */ std::unique_ptr weight_T; // temporary weight. will be removed }; - } // namespace nntrainer #endif /* __LM_HEAD_LAYER_CL_H__ */ diff --git a/nntrainer/utils/custom_properties.h b/nntrainer/utils/custom_properties.h deleted file mode 100644 index d38f8909b3..0000000000 --- a/nntrainer/utils/custom_properties.h +++ /dev/null @@ -1,42 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -/** - * Copyright (C) 2024 Debadri Samaddar - * - * @file custom_properties.h - * @date 1 October 2024 - * @see https://github.com/nnstreamer/nntrainer - * @author Yash Singh - * @bug No known bugs except for NYI items - * @brief This file contains list of custom properties widely used across - * custom layers - */ - -#ifndef __CUSTOM_PROPERTIES_H__ -#define __CUSTOM_PROPERTIES_H__ - -#include - -namespace nntrainer { - -namespace props { - -/** - * @brief indicated this layer is for smart reply application - * - */ -class SmartReply : public Property { -public: - /** - * @brief Construct a new SmartReply object - * - */ - SmartReply(bool value = false) { set(value); } - static constexpr const char *key = "smart_reply"; - using prop_tag = bool_prop_tag; -}; - -} // namespace props - -} // namespace nntrainer - -#endif /* __CUSTOM_PROPERTIES_H__ */ diff --git a/packaging/unittest_layers.tar.gz b/packaging/unittest_layers.tar.gz index 9f6367dcf1..36755ce555 100644 Binary files a/packaging/unittest_layers.tar.gz and b/packaging/unittest_layers.tar.gz differ