kyegomez / tree-of-thoughts

Plug in and Play Implementation of Tree of Thoughts: Deliberate Problem Solving with Large Language Models that Elevates Model Reasoning by atleast 70%

Home Page:https://discord.gg/qUtxnK2NMf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Errors come one by one when deploying

wqw547243068 opened this issue · comments

The installation guide in the Readme doesn't work for me. It need to be updated in Mac, Python 3.10.9.

git clone https://github.com/kyegomez/tree-of-thoughts
cd tree-of-thoughts
cd tree_of_thoughts
python3 treeofthoughts.py --problem "design an new transportation system for an all-new city" --search_algorithm="BFS"

error info:

(1) Error 1 -- [solved]

Updated:

  • Linux environment works, maybe some thing wrong with my Mac.
  • No need to execcute pip install .

ModuleNotFoundError: No module named 'tree_of_thoughts'

Then, installed from source code

pip install .

(2) Error 2 -- [solved]

The error above disappeared, while another one poped up

ModuleNotFoundError: No module named 'dotenv'

I tried to install dotenv

TQV9MF4NXR:tree-of-thoughts bytedance$ pip install dotenv
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting dotenv
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/e2/46/3754073706e31670eed18bfa8a879305b56a471db15f20523c2427b10078/dotenv-0.0.5.tar.gz (2.4 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install backend dependencies did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
      Collecting distribute
        Using cached https://pypi.tuna.tsinghua.edu.cn/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip (145 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Preparing metadata (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [6 lines of output]
            usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
               or: setup.py --help [cmd1 cmd2 ...]
               or: setup.py --help-commands
               or: setup.py cmd --help
      
            error: invalid command 'dist_info'
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: metadata-generation-failed
      
      × Encountered error while generating package metadata.
      ╰─> See above for output.
      
      note: This is an issue with the package mentioned above, not pip.
      hint: See above for details.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install backend dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

pip install dotenv failed, and I tried another package py-dotenv, then updated the file guidanceModels.py

#from dotenv import load_dotenv
#load_dotenv()

from py_dotenv import read_dotenv

#dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
dotenv_path = "/root/tree-of-thoughts/.env"
read_dotenv(dotenv_path)

Finally, it works.

Error 3 -- [solved]

Run command:

python tree_of_thoughts/treeofthoughts.py --problem "design an new transportation system for an all-new city" --search_algorithm="BFS"

New error:

(base) mlxlabgjosxvkh644ba1db-20230428103717-lefyc9-master:tree-of-thoughts# python tree_of_thoughts/treeofthoughts.py --problem "design an new transportation system for an all-new city" --search_algorithm="BFS"
2023-05-29 18:36:03.549785: I tensorflow/core/util/port.cc:110] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2023-05-29 18:36:03.616323: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Namespace(problem='design an new transportation system for an all-new city', version=1, search_algorithm='BFS', k=3, T=10, b=5, vth=0.4, timeout=10, confidence=0.8, max_iterations=40, convergence_threshold=0.01, convergence_count=5)
Using api_model text-davinci-003
Traceback (most recent call last):
  File "/root/tree-of-thoughts/tree_of_thoughts/treeofthoughts.py", line 231, in <module>
    best_state = optimized_tree_of_thoughts.solve(args.problem, k=args.k, T=args.T, b=args.b, vth=args.vth)
TypeError: TreeofThoughts.solve() got an unexpected keyword argument 'k'

TypeError: TreeofThoughts.solve() got an unexpected keyword argument 'k'

Why?

  • The method solve in superclass TreeofThoughts is overloaded by the subclass OptimizedTreeofThoughts.
  • So, the argument 'k' was not identified.

How to solve?

  • Modify this code line 228 in file treeofthoughts.py
    #optimized_tree_of_thoughts = TreeofThoughts(model, search_algorithm=args.search_algorithm)
    optimized_tree_of_thoughts = OptimizedTreeofThoughts(model, search_algorithm=args.search_algorithm)

Summary

A a lot of errors to overcome by myself... The readme file is outdated

Please excuse us for the errors

  • Added dotenv to requirements
  • and fixed treeofthoughts.py