MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / server_params_parse

Function server_params_parse

examples/server/server.cpp:1812–2198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1810}
1811
1812static void server_params_parse(int argc, char **argv, server_params &sparams,
1813 gpt_params &params, llama_server_context& llama)
1814{
1815 gpt_params default_params;
1816 server_params default_sparams;
1817 std::string arg;
1818 bool invalid_param = false;
1819
1820 for (int i = 1; i < argc; i++)
1821 {
1822 arg = argv[i];
1823 if (arg == "--port")
1824 {
1825 if (++i >= argc)
1826 {
1827 invalid_param = true;
1828 break;
1829 }
1830 sparams.port = std::stoi(argv[i]);
1831 }
1832 else if (arg == "--host")
1833 {
1834 if (++i >= argc)
1835 {
1836 invalid_param = true;
1837 break;
1838 }
1839 sparams.hostname = argv[i];
1840 }
1841 else if (arg == "--path")
1842 {
1843 if (++i >= argc)
1844 {
1845 invalid_param = true;
1846 break;
1847 }
1848 sparams.public_path = argv[i];
1849 }
1850 else if (arg == "--timeout" || arg == "-to")
1851 {
1852 if (++i >= argc)
1853 {
1854 invalid_param = true;
1855 break;
1856 }
1857 sparams.read_timeout = std::stoi(argv[i]);
1858 sparams.write_timeout = std::stoi(argv[i]);
1859 }
1860 else if (arg == "-m" || arg == "--model")
1861 {
1862 if (++i >= argc)
1863 {
1864 invalid_param = true;
1865 break;
1866 }
1867 params.model = argv[i];
1868 }
1869 else if (arg == "-a" || arg == "--alias")

Callers 1

mainFunction · 0.85

Calls 11

server_print_usageFunction · 0.85
minFunction · 0.85
fprintfFunction · 0.85
parseFunction · 0.70
copyFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected