| 123 | |
| 124 | template<typename T> |
| 125 | BartEncoder<T>::BartEncoder(size_t max_batch_size, |
| 126 | size_t max_seq_len, |
| 127 | size_t head_num, |
| 128 | size_t size_per_head, |
| 129 | size_t inter_size, |
| 130 | size_t d_model, |
| 131 | size_t num_layer, |
| 132 | size_t num_bucket_or_max_seq_len, |
| 133 | size_t max_distance, |
| 134 | int sm, |
| 135 | float q_scaling, |
| 136 | cudaStream_t stream, |
| 137 | cublasMMWrapper* cublas_wrapper, |
| 138 | IAllocator* allocator, |
| 139 | bool is_free_buffer_after_forward, |
| 140 | AttentionType attention_type, |
| 141 | bool sparse, |
| 142 | ActivationType activation_type, |
| 143 | LayerNormType layernorm_type, |
| 144 | NcclParam tensor_para, |
| 145 | NcclParam pipeline_para, |
| 146 | std::shared_ptr<AbstractCustomComm> custom_all_reduce_comm, |
| 147 | int enable_custom_all_reduce): |
| 148 | BaseLayer(stream, cublas_wrapper, allocator, is_free_buffer_after_forward), |
| 149 | max_batch_size_(max_batch_size), |
| 150 | max_seq_len_(max_seq_len), |
| 151 | head_num_(head_num), |
| 152 | size_per_head_(size_per_head), |
| 153 | inter_size_(inter_size), |
| 154 | d_model_(d_model), |
| 155 | hidden_units_(head_num_ * size_per_head_), |
| 156 | num_layer_(num_layer), |
| 157 | num_bucket_or_max_seq_len_(num_bucket_or_max_seq_len), |
| 158 | max_distance_(max_distance), |
| 159 | sm_(sm), |
| 160 | q_scaling_(q_scaling), |
| 161 | attention_type_(attention_type), |
| 162 | sparse_(sparse), |
| 163 | activation_type_(activation_type), |
| 164 | layernorm_type_(layernorm_type), |
| 165 | tensor_para_(tensor_para), |
| 166 | pipeline_para_(pipeline_para), |
| 167 | custom_all_reduce_comm_(custom_all_reduce_comm), |
| 168 | enable_custom_all_reduce_(enable_custom_all_reduce) |
| 169 | { |
| 170 | initialize(); |
| 171 | } |
| 172 | |
| 173 | template<typename T> |
| 174 | BartEncoder<T>::BartEncoder(BartEncoder<T> const& bart_encoder): |