You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Simplified simulation of serving incoming requests in parallel
4
+
5
+
## Example
6
+
7
+
Generate 128 client requests (`-ns 128`), simulating 8 concurrent clients (`-np 8`). The system prompt is shared (`-pps`), meaning that it is computed once at the start. The client requests consist of 10 junk questions (`-j 10`) followed by the actual question.
> It's recommended to use base models with this example. Instruction tuned models might not be able to properly follow the custom chat template specified here, so the results might not be as expected.
Copy file name to clipboardExpand all lines: examples/parallel/parallel.cpp
+86-14Lines changed: 86 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,61 @@ static std::string k_system =
34
34
R"(Transcript of a never ending dialog, where the User interacts with an Assistant.
35
35
The Assistant is helpful, kind, honest, good at writing, and never fails to answer the User's requests immediately and with precision.
36
36
37
-
User: Recommend a nice restaurant in the area.
38
-
Assistant: I recommend the restaurant "The Golden Duck". It is a 5 star restaurant with a great view of the city. The food is delicious and the service is excellent. The prices are reasonable and the portions are generous. The restaurant is located at 123 Main Street, New York, NY 10001. The phone number is (212) 555-1234. The hours are Monday through Friday from 11:00 am to 10:00 pm. The restaurant is closed on Saturdays and Sundays.
39
-
User: Who is Richard Feynman?
40
-
Assistant: Richard Feynman was an American physicist who is best known for his work in quantum mechanics and particle physics. He was awarded the Nobel Prize in Physics in 1965 for his contributions to the development of quantum electrodynamics. He was a popular lecturer and author, and he wrote several books, including "Surely You're Joking, Mr. Feynman!" and "What Do You Care What Other People Think?".
41
-
User:)";
37
+
User:
38
+
Recommend a nice restaurant in the area.
39
+
Assistant:
40
+
I recommend the restaurant "The Golden Duck". It is a 5 star restaurant with a great view of the city. The food is delicious and the service is excellent. The prices are reasonable and the portions are generous. The restaurant is located at 123 Main Street, New York, NY 10001. The phone number is (212) 555-1234. The hours are Monday through Friday from 11:00 am to 10:00 pm. The restaurant is closed on Saturdays and Sundays.
41
+
User:
42
+
Who is Richard Feynman?
43
+
Assistant:
44
+
Richard Feynman was an American physicist who is best known for his work in quantum mechanics and particle physics. He was awarded the Nobel Prize in Physics in 1965 for his contributions to the development of quantum electrodynamics. He was a popular lecturer and author, and he wrote several books, including "Surely You're Joking, Mr. Feynman!" and "What Do You Care What Other People Think?".
45
+
)";
46
+
47
+
static std::vector<std::string> k_questions = {
48
+
"What is the tallest mountain in the world?",
49
+
"Who was the first person to win two Nobel Prizes?",
50
+
"Which country invented paper?",
51
+
"What organ is primarily responsible for pumping blood throughout the body?",
52
+
"Which planet is known for its prominent ring system?",
53
+
"Who directed the movie 'Inception'?",
54
+
"What is the freezing point of water in Fahrenheit?",
55
+
"Which animal is known to have the longest lifespan?",
56
+
"What language has the most native speakers worldwide?",
57
+
"What is the capital city of Canada?",
58
+
"Who is credited with inventing the World Wide Web?",
59
+
"Which metal is liquid at room temperature?",
60
+
"What is the term for an animal that eats both plants and meat?",
61
+
"Who painted 'The Starry Night'?",
62
+
"What gas do humans exhale that plants use for photosynthesis?",
63
+
"What year did World War II end?",
64
+
"Which continent has the most countries?",
65
+
"Who wrote the novel 'Frankenstein'?",
66
+
"What does DNA stand for?",
67
+
"What is the main ingredient in traditional Japanese miso soup?"
68
+
};
69
+
70
+
static std::vector<std::string> k_answers = {
71
+
"The tallest mountain in the world is Mount Everest.",
72
+
"Marie Curie was the first person to win two Nobel Prizes.",
73
+
"Paper was invented in China.",
74
+
"The heart is the organ responsible for pumping blood.",
75
+
"Saturn is known for its prominent ring system.",
76
+
"Christopher Nolan directed the movie 'Inception'.",
77
+
"The freezing point of water in Fahrenheit is 32°F.",
78
+
"The bowhead whale is known to have the longest lifespan among mammals.",
79
+
"Mandarin Chinese has the most native speakers in the world.",
80
+
"The capital city of Canada is Ottawa.",
81
+
"Tim Berners-Lee is credited with inventing the World Wide Web.",
82
+
"Mercury is the metal that is liquid at room temperature.",
83
+
"An animal that eats both plants and meat is called an omnivore.",
84
+
"'The Starry Night' was painted by Vincent van Gogh.",
85
+
"Humans exhale carbon dioxide, which plants use in photosynthesis.",
86
+
"World War II ended in 1945.",
87
+
"Africa is the continent with the most countries.",
88
+
"The novel 'Frankenstein' was written by Mary Shelley.",
89
+
"DNA stands for Deoxyribonucleic Acid.",
90
+
"The main ingredient in traditional Japanese miso soup is fermented soybean paste."
0 commit comments