Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First run of Unitxt after install is slow #1496

Open
yoavkatz opened this issue Jan 12, 2025 · 1 comment
Open

First run of Unitxt after install is slow #1496

yoavkatz opened this issue Jan 12, 2025 · 1 comment

Comments

@yoavkatz
Copy link
Member

It takes over 30 seconds for unitxt to run after first install:

conda create -n unitxt2 python=3.10
conda activate unitxt2
python -m cProfile -s cumtime examples/qa_evaluation.py

  ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      192    0.019    0.000  132.975    0.693 __init__.py:1(<module>)
       13    0.000    0.000   40.048    3.081 api.py:1(<module>)
   2492/1    0.083    0.000   32.400   32.400 {built-in method builtins.exec}
        1    0.000    0.000   32.400   32.400 qa_evaluation.py:1(<module>)
   1862/1    0.009    0.000   32.381   32.381 <frozen importlib._bootstrap>:1022(_find_and_load)
   1742/1    0.006    0.000   32.381   32.381 <frozen importlib._bootstrap>:987(_find_and_load_unlocked)
   1667/1    0.008    0.000   32.380   32.380 <frozen importlib._bootstrap>:664(_load_unlocked)
   1450/1    0.003    0.000   32.380   32.380 <frozen importlib._bootstrap_external>:877(exec_module)
   2283/1    0.002    0.000   32.380   32.380 <frozen importlib._bootstrap>:233(_call_with_frames_removed)
1667/1655    0.004    0.000   30.633    0.019 <frozen importlib._bootstrap>:564(module_from_spec)
  210/207    0.002    0.000   30.584    0.148 <frozen importlib._bootstrap_external>:1174(create_module)
  210/207   30.559    0.146   30.580    0.148 {built-in method _imp.create_dynamic}
  735/193    0.001    0.000   22.587    0.117 {built-in method builtins.__import__}
 1745/836    0.003    0.000   20.420    0.024 <frozen importlib._bootstrap>:1053(_handle_fromlist)
        1    0.000    0.000   16.150   16.150 card.py:1(<module>)
        1    0.000    0.000   16.093   16.093 task.py:1(<module>)
        1    0.000    0.000   16.050   16.050 metrics.py:1(<module>)
        1    0.000    0.000   14.487   14.487 arrow_dataset.py:1(<module>)
        1    0.000    0.000   14.277   14.277 _stats_py.py:1(<module>)
  210/169    0.001    0.000    6.719    0.040 <frozen importlib._bootstrap_external>:1182(exec_module)
  210/169    0.083    0.000    6.718    0.040 {built-in method _imp.exec_dynamic}
  143/136    0.000    0.000    6.655    0.049 __init__.py:108(import_module)
  143/136    0.000    0.000    6.655    0.049 <frozen importlib._bootstrap>:1038(_gcd_import)
35797/31732    0.006    0.000    6.630    0.000 {built-in method builtins.hasattr}
    32/30    0.000    0.000    5.863    0.195 __init__.py:132(__getattr__)
        1    0.000    0.000    3.403    3.403 distributions.py:1(<module>)
        1    0.000    0.000    3.337    3.337 _laplacian.py:1(<module>)
        1    0.000    0.000    2.525    2.525 arrow_reader.py:1(<module>)
        3    0.000    0.000    2.372    0.791 generic.py:1(<module>)
        1    0.000    0.000    2.031    2.031 _continuous_distns.py:1(<module>)
        1    0.000    0.000    1.845    1.845 _geometric_slerp.py:1(<module>)
        1    0.000    0.000    1.844    1.844 distance.py:1(<module>)
        1    0.000    0.000    1.793    1.793 iterative.py:1(<module>)
        1    0.000    0.000    1.702    1.702 pyarrow.py:1(<module>)
        1    0.000    0.000    1.598    1.598 inspect.py:1(<module>)
        1    0.000    0.000    1.598    1.598 load.py:1(<module>)
       10    0.000    0.000    1.553    0.155 __init__.py:326(__getattr__)
        1    0.000    0.000    1.407    1.407 download_manager.py:1(<module>)
        2    0.000    0.000    1.404    0.702 parquet.py:1(<module>)
@yoavkatz
Copy link
Member Author

on second run:


        2417627 function calls (2254936 primitive calls) in 1.249 seconds

   Ordered by: cumulative time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      192    0.003    0.000    3.818    0.020 __init__.py:1(<module>)
       13    0.000    0.000    1.301    0.100 api.py:1(<module>)
   2492/1    0.048    0.000    1.252    1.252 {built-in method builtins.exec}
        1    0.000    0.000    1.252    1.252 qa_evaluation.py:1(<module>)
   1862/1    0.003    0.000    1.232    1.232 <frozen importlib._bootstrap>:1022(_find_and_load)
   1742/1    0.003    0.000    1.232    1.232 <frozen importlib._bootstrap>:987(_find_and_load_unlocked)
   1667/1    0.003    0.000    1.232    1.232 <frozen importlib._bootstrap>:664(_load_unlocked)
   1450/1    0.002    0.000    1.232    1.232 <frozen importlib._bootstrap_external>:877(exec_module)
   2283/1    0.001    0.000    1.232    1.232 <frozen importlib._bootstrap>:233(_call_with_frames_removed)
 1745/836    0.001    0.000    0.586    0.001 <frozen importlib._bootstrap>:1053(_handle_fromlist)
        1    0.000    0.000    0.575    0.575 arrow_dataset.py:1(<module>)
  735/193    0.001    0.000    0.545    0.003 {built-in method builtins.__import__}
        1    0.000    0.000    0.498    0.498 card.py:1(<module>)
        1    0.000    0.000    0.450    0.450 task.py:1(<module>)
        1    0.000    0.000    0.409    0.409 metrics.py:1(<module>)
        1    0.000    0.000    0.316    0.316 _stats_py.py:1(<module>)
  143/136    0.000    0.000    0.289    0.002 __init__.py:108(import_module)
  143/136    0.000    0.000    0.289    0.002 <frozen importlib._bootstrap>:1038(_gcd_import)
35803/31738    0.004    0.000    0.262    0.000 {built-in method builtins.hasattr}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant