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

Function main

examples/cpp/gptj/gptj_example.cc:36–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34void gptj_example(const INIReader reader);
35
36int main(int argc, char* argv[])
37{
38 mpi::initialize(&argc, &argv);
39 srand(0);
40
41 std::string ini_name;
42 if (argc == 2) {
43 ini_name = std::string(argv[1]);
44 }
45 else {
46 ini_name = "../examples/cpp/gptj/gptj_config.ini";
47 }
48
49 INIReader reader = INIReader(ini_name);
50 if (reader.ParseError() < 0) {
51 std::cout << "[ERROR] Can't load '" << ini_name << "'\n";
52 return -1;
53 }
54 const std::string data_type = reader.Get("ft_instance_hyperparameter", "data_type");
55
56 if (data_type == "fp32") {
57 gptj_example<float>(reader);
58 }
59 else if (data_type == "fp16") {
60 gptj_example<half>(reader);
61 }
62#ifdef ENABLE_BF16
63 else if (data_type == "bf16") {
64 gptj_example<__nv_bfloat16>(reader);
65 }
66#endif
67 else {
68 FT_LOG_ERROR("data_type should be fp32, fp16 or bf16!");
69 return -1;
70 }
71 mpi::finalize();
72 return 0;
73}

Callers

nothing calls this directly

Calls 4

initializeFunction · 0.85
INIReaderClass · 0.85
ParseErrorMethod · 0.80
GetMethod · 0.80

Tested by

no test coverage detected