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

Function main

examples/cpp/decoding/decoding_example.cc:38–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 const float top_p);
37
38int main(int argc, char** argv)
39{
40 if (argc != 14) {
41 printf("[ERROR] decoding_example batch_size beam_width head_num size_per_head inter_size vocab_size"
42 " num_layers max_seq_len memory_max_seq_len memory_hidden_units top_k top_p data_type\n");
43 printf("e.g., ./bin/decoding_example 4 1 8 64 2048 30000 6 32 32 512 0 0.6 1\n");
44 return 0;
45 }
46
47 int batch_size = atoi(argv[1]);
48 int beam_width = atoi(argv[2]);
49 int head_num = atoi(argv[3]);
50 int size_per_head = atoi(argv[4]);
51 int inter_size = atoi(argv[5]);
52 int vocab_size = atoi(argv[6]);
53 int num_layers = atoi(argv[7]);
54 int max_seq_len = atoi(argv[8]);
55 int memory_max_seq_len = atoi(argv[9]);
56 int memory_hidden_units = atoi(argv[10]);
57 int top_k = atoi(argv[11]);
58 float top_p = atof(argv[12]);
59 const CublasDataType data_type = static_cast<CublasDataType>(atoi(argv[13])); // 0 FP32, 1 FP16, 2 BF 16
60
61 if (data_type == FLOAT_DATATYPE) {
62 return decodingExample<float>(batch_size,
63 beam_width,
64 head_num,
65 size_per_head,
66 inter_size,
67 vocab_size,
68 num_layers,
69 max_seq_len,
70 memory_max_seq_len,
71 memory_hidden_units,
72 top_k,
73 top_p);
74 }
75 else if (data_type == HALF_DATATYPE) {
76 return decodingExample<half>(batch_size,
77 beam_width,
78 head_num,
79 size_per_head,
80 inter_size,
81 vocab_size,
82 num_layers,
83 max_seq_len,
84 memory_max_seq_len,
85 memory_hidden_units,
86 top_k,
87 top_p);
88 }
89#ifdef ENABLE_BF16
90 else if (data_type == BFLOAT16_DATATYPE) {
91 return decodingExample<__nv_bfloat16>(batch_size,
92 beam_width,
93 head_num,
94 size_per_head,
95 inter_size,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected