MCPcopy Create free account
hub / github.com/NVIDIA/FasterTransformer / T5Encoder

Method T5Encoder

src/fastertransformer/models/t5/T5Encoder.cc:140–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138
139template<typename T>
140T5Encoder<T>::T5Encoder(size_t max_batch_size,
141 size_t max_seq_len,
142 size_t head_num,
143 size_t size_per_head,
144 size_t inter_size,
145 size_t d_model,
146 size_t num_layer,
147 size_t num_bucket_or_max_seq_len,
148 size_t expert_num,
149 size_t max_distance,
150 size_t moe_k,
151 int sm,
152 float q_scaling,
153 std::vector<int64_t> moe_layer_index,
154 cudaStream_t stream,
155 cublasMMWrapper* cublas_wrapper,
156 IAllocator* allocator,
157 bool is_free_buffer_after_forward,
158 AttentionType attention_type,
159 bool sparse,
160 ActivationType activation_type,
161 LayerNormType layernorm_type,
162 NcclParam tensor_para,
163 NcclParam pipeline_para,
164 int prompt_learning_start_id,
165 PromptLearningType prompt_learning_type,
166 std::shared_ptr<AbstractCustomComm> custom_all_reduce_comm,
167 int enable_custom_all_reduce,
168 LinearAdapterConfig const& adapter_config):
169 BaseLayer(stream, cublas_wrapper, allocator, is_free_buffer_after_forward),
170 max_batch_size_(max_batch_size),
171 max_seq_len_(max_seq_len),
172 head_num_(head_num),
173 size_per_head_(size_per_head),
174 inter_size_(inter_size),
175 d_model_(d_model),
176 hidden_units_(head_num_ * size_per_head_),
177 num_layer_(num_layer),
178 num_bucket_or_max_seq_len_(num_bucket_or_max_seq_len),
179 expert_num_(expert_num),
180 max_distance_(max_distance),
181 moe_k_(moe_k),
182 sm_(sm),
183 q_scaling_(q_scaling),
184 moe_layer_index_(moe_layer_index),
185 attention_type_(attention_type),
186 sparse_(sparse),
187 activation_type_(activation_type),
188 layernorm_type_(layernorm_type),
189 tensor_para_(tensor_para),
190 pipeline_para_(pipeline_para),
191 prompt_learning_start_id_(prompt_learning_start_id),
192 prompt_learning_type_(prompt_learning_type),
193 custom_all_reduce_comm_(custom_all_reduce_comm),
194 enable_custom_all_reduce_(enable_custom_all_reduce),
195 adapter_config_{adapter_config}
196{
197 FT_CHECK_WITH_INFO(layernorm_type_ == LayerNormType::pre_layernorm, "T5Encoder only supports pre_layernorm");

Callers 1

__init__Method · 0.80

Calls 1

initializeFunction · 0.85

Tested by

no test coverage detected