mirror of
https://github.com/HazyResearch/manifest
synced 2024-10-31 15:20:26 +00:00
28 lines
580 B
Python
28 lines
580 B
Python
import asyncio
|
|
import time
|
|
|
|
from manifest import Manifest
|
|
|
|
|
|
def main():
|
|
|
|
manifest = Manifest(
|
|
client_name="openaichat",
|
|
)
|
|
|
|
print("Running in serial")
|
|
prompts = [f"Tell me something interesting about {i}" for i in range(50)]
|
|
st = time.time()
|
|
for pmt in prompts:
|
|
_ = manifest.run(pmt)
|
|
print(f"For loop: {time.time() - st :.2f}")
|
|
|
|
print("Running with async")
|
|
st = time.time()
|
|
_ = asyncio.run(manifest.arun_batch(prompts, max_tokens=30))
|
|
print(f"Async loop: {time.time() - st :.2f}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|