-
Notifications
You must be signed in to change notification settings - Fork 12
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
bash: lm-saes: command not found #83
Comments
I'm sorry, but the current README and examples are actually outdated. We'll update them as soon as we have enough capacity. Currently we recommend to use uv as the package manager (as a drop-in replacement of import torch
from lm_saes import (
ActivationFactoryConfig,
ActivationFactoryDatasetSource,
ActivationFactoryTarget,
InitializerConfig,
SAEConfig,
TrainerConfig,
TrainSAESettings,
WandbConfig,
train_sae,
)
if __name__ == "__main__":
settings = TrainSAESettings(
sae=SAEConfig(
hook_point_in="blocks.3.ln1.hook_normalized",
hook_point_out="blocks.3.ln1.hook_normalized",
d_model=768,
expansion_factor=8,
act_fn="topk",
norm_activation="token-wise",
sparsity_include_decoder_norm=True,
top_k=50,
dtype=torch.float32,
device="cuda",
),
initializer=InitializerConfig(
init_search=True,
state="training",
),
trainer=TrainerConfig(
lp=1,
initial_k=768 / 2,
lr=4e-4,
lr_scheduler_name="constantwithwarmup",
total_training_tokens=600_000_000,
log_frequency=1000,
eval_frequency=1000000,
n_checkpoints=5,
check_point_save_mode="linear",
exp_result_path="results",
),
wandb=WandbConfig(
wandb_project="pythia-160m-test",
exp_name="pythia-160m-test",
),
activation_factory=ActivationFactoryConfig(
sources=[
ActivationFactoryDatasetSource(
name="openwebtext",
)
],
target=ActivationFactoryTarget.BATCHED_ACTIVATIONS_1D,
hook_points=["blocks.3.ln1.hook_normalized"],
batch_size=2048,
buffer_size=None,
ignore_token_ids=[],
),
sae_name="pythia-160m-test-L3",
sae_series="pythia-160m-test",
)
train_sae(settings) Hope to know if this setup works! |
Hi,
|
Hi, (llama_scope) [email protected]:/Language-Model-SAEs$ python examples/configuration/train.py
/opt/conda/envs/llama_scope/lib/python3.10/site-packages/torch/_subclasses/functional_tensor.py:275: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at /pytorch/torch/csrc/utils/tensor_numpy.cpp:81.)
cpu = _conversion_method_template(device=torch.device("cpu"))
Traceback (most recent call last):
File "/Language-Model-SAEs/examples/configuration/train.py", line 3, in <module>
from lm_saes import (
ModuleNotFoundError: No module named 'lm_saes' Can you please take a look and help me with it? |
Sorry for the late reply.
Once you have
Yes.
You should run
It should work smoothly with the above steps. Please let me know if there are any further problems! |
Hi, (llama-scope) [email protected]:/Language-Model-SAEs$ uv run ./examples/configuration/train.py
Traceback (most recent call last):
File "/Language-Model-SAEs/./examples/configuration/train.py", line 64, in <module>
train_sae(settings)
File "/Language-Model-SAEs/src/lm_saes/runner.py", line 286, in train_sae
activations_stream = activation_factory.process()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Language-Model-SAEs/src/lm_saes/activation/factory.py", line 281, in process
streams = [processor(**kwargs) for processor in self.pre_aggregation_processors]
^^^^^^^^^^^^^^^^^^^
File "/Language-Model-SAEs/src/lm_saes/activation/factory.py", line 98, in process_dataset
assert datasets is not None, "`datasets` must be provided for dataset sources"
AssertionError: `datasets` must be provided for dataset sources I tried using the dataset from Huggingface path |
Have you tried the script above in this issue? The example script has not been up-to-date yet. |
Hi, import torch
from lm_saes import (
ActivationFactoryConfig,
ActivationFactoryDatasetSource,
ActivationFactoryTarget,
InitializerConfig,
SAEConfig,
TrainerConfig,
TrainSAESettings,
WandbConfig,
train_sae,
)
if __name__ == "__main__":
settings = TrainSAESettings(
sae=SAEConfig(
hook_point_in="blocks.3.ln1.hook_normalized",
hook_point_out="blocks.3.ln1.hook_normalized",
d_model=768,
expansion_factor=8,
act_fn="topk",
norm_activation="token-wise",
sparsity_include_decoder_norm=True,
top_k=50,
dtype=torch.float32,
device="cuda",
),
initializer=InitializerConfig(
init_search=True,
state="training",
),
trainer=TrainerConfig(
lp=1,
initial_k=768 / 2,
lr=4e-4,
lr_scheduler_name="constantwithwarmup",
total_training_tokens=600_000_000,
log_frequency=1000,
eval_frequency=1000000,
n_checkpoints=5,
check_point_save_mode="linear",
exp_result_path="results",
),
wandb=WandbConfig(
wandb_project="pythia-160m-test",
exp_name="pythia-160m-test",
),
activation_factory=ActivationFactoryConfig(
sources=[
ActivationFactoryDatasetSource(
name="openwebtext",
)
],
target=ActivationFactoryTarget.BATCHED_ACTIVATIONS_1D,
hook_points=["blocks.3.ln1.hook_normalized"],
batch_size=2048,
buffer_size=None,
ignore_token_ids=[],
),
sae_name="pythia-160m-test-L3",
sae_series="pythia-160m-test",
)
train_sae(settings) Can you please take a look and help me fix the bug? |
Hi, |
Thank you! Please update asap |
Hi, I am new to this repo, and I got this error when I followed the readme to train the SAE:
I created a conda environment with python 3.10, then I followed the instruction:
pdm install
, then downloadedbun
, then runlm-saes train examples/configuration/train.toml
. That is where I got the error.Can you please take a look?
Thank you
The text was updated successfully, but these errors were encountered: