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

TypeError when running causal_trace.ipynb locally #48

Open
LuoXiaoxi-cxq opened this issue Oct 8, 2024 · 0 comments
Open

TypeError when running causal_trace.ipynb locally #48

LuoXiaoxi-cxq opened this issue Oct 8, 2024 · 0 comments

Comments

@LuoXiaoxi-cxq
Copy link

Hello, thank you for your code. When I was running the notebook causal_trace.ipynb locally, I met the following error in the fourth cell (the cell for imports).

Cell In[4], line 7
      5 sys.path.append(os.path.abspath("D://postgraduate//research//model_editing//rome"))
      6 from util import nethook
----> 7 from util.globals import DATA_DIR
      8 from experiments.causal_trace import (
      9     ModelAndTokenizer,
     10     layername,
     11     guess_subject,
     12     plot_trace_heatmap,
     13 )
     14 from experiments.causal_trace import (
     15     make_inputs,
     16     decode_tokens,
   (...)
     20     collect_embedding_std,
     21 )

File D:\postgraduate\research\model_editing\rome\util\globals.py:12
      5 with open("globals.yml", "r") as stream:
      6     data = yaml.safe_load(stream)
      9 (RESULTS_DIR, DATA_DIR, STATS_DIR, HPARAMS_DIR,) = (
     10     Path(z)
     11     for z in [
---> 12         data["RESULTS_DIR"],
     13         data["DATA_DIR"],
     14         data["STATS_DIR"],
     15         data["HPARAMS_DIR"],
     16     ]
     17 )
     19 REMOTE_ROOT_URL = data["REMOTE_ROOT_URL"]

TypeError: string indices must be integers

It seems that globals.yml is not read successfully. However, I notice that variables like RESULTS_DIR, DATA_DIR, and STATS_DIR are constant strings, can I just change them into the values in globals.yml?

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