-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added pytorch 2.0 benchmark and results
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/sh | ||
|
||
n=5 | ||
|
||
|
||
echo "Testing compile" | ||
for _ in $(seq 1 ${n}); do | ||
rm -r cache/ | ||
python compiled_pytorch.py | ||
done | ||
|
||
echo "Testing no compile" | ||
for _ in $(seq 1 ${n}); do | ||
rm -r cache/ | ||
python warm_start_cache.py | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import time | ||
|
||
import torch | ||
from loguru import logger | ||
from tqdm import tqdm | ||
|
||
from debeir import NIRPipeline | ||
|
||
logger.disable("debeir") | ||
|
||
|
||
def run_all_queries(p): | ||
for topic_num in tqdm(p.engine.query.topics): | ||
p.engine.query.generate_query_embedding(topic_num) | ||
|
||
|
||
if __name__ == "__main__": | ||
p = NIRPipeline.build_from_config(config_fp="./config.toml", | ||
engine="elasticsearch", | ||
nir_config_fp="./nir.toml") | ||
|
||
p.run_config.encoder.model = torch.compile(p.run_config.encoder.model, mode="reduce-overhead") | ||
|
||
start = time.time() | ||
run_all_queries(p) | ||
end = time.time() | ||
|
||
print(end - start) |