axolotl icon indicating copy to clipboard operation
axolotl copied to clipboard

Successful pip Installation Results in ModuleNotFoundError

Open casey-martin opened this issue 1 year ago • 6 comments

Please check that this issue hasn't been reported before.

  • [X] I searched previous Bug Reports didn't find any similar reports.

Expected Behavior

Following the Quickstart instructions, I installed the axolotl module without any errors. I would expect to be able to load axolotl using the python interpreter or by executing scripts through axolotl.cli.inference.

Current behaviour

Attempting to load the module or run any scripts results in a ModuleNotFoundError.

Steps to reproduce

$ mamba create -n phi python=3.9
$ mamba activate phi
$ pip3 install "axolotl[flash-attn,deepspeed] @ git+https://github.com/OpenAccess-AI-Collective/axolotl"
$ accelerate launch -m axolotl.cli.train ./phi-ft.yml --deepspeed ./deepspeed/zero1.json                                                                                                                                                                                        
The following values were not passed to `accelerate launch` and had defaults used instead:
        `--num_processes` was set to a value of `1`                          
        `--num_machines` was set to a value of `1`                            
        `--mixed_precision` was set to a value of `'no'`                                                                                                     
        `--dynamo_backend` was set to a value of `'no'`                       
To avoid this warning pass in values for each of the problematic parameters or run `accelerate config`.                                                      
/home/user/mambaforge/envs/phi/bin/python3.9: Error while finding module specification for 'axolotl.cli.train' (ModuleNotFoundError: No module named 'axolotl.cli')

Config yaml

base_model: microsoft/phi-1_5
model_type: PhiForCausalLM
tokenizer_type: AutoTokenizer
is_llama_derived_model: false
trust_remote_code: true

load_in_8bit: false
load_in_4bit: false
strict: false

datasets:
  - path: garage-bAInd/Open-Platypus
    type: alpaca

dataset_prepared_path:
val_set_size: 0.05
output_dir: ./phi-sft-out

sequence_len: 2048
sample_packing: true
pad_to_sequence_len:

adapter:
lora_model_dir:
lora_r:
lora_alpha:
lora_dropout:
lora_target_linear:
lora_fan_in_fan_out:

wandb_project:
wandb_entity:
wandb_watch:
wandb_run_id:
wandb_log_model:

gradient_accumulation_steps: 1
micro_batch_size: 1
num_epochs: 4
optimizer: adamw_torch
adam_beta2: 0.95
adam_epsilon: 0.00001
max_grad_norm: 1.0
lr_scheduler: cosine
learning_rate: 0.000003

train_on_inputs: false
group_by_length: true
bf16: true
fp16: false
tf32: true

gradient_checkpointing:
early_stopping_patience:
resume_from_checkpoint:
local_rank:
logging_steps: 1
xformers_attention:
flash_attention:

warmup_steps: 100
eval_steps: 0.05
save_steps:
debug:
deepspeed:
weight_decay: 0.1
fsdp:
fsdp_config:
resize_token_embeddings_to_32x: true
special_tokens:
  bos_token: "<|endoftext|>"
  eos_token: "<|endoftext|>"
  unk_token: "<|endoftext|>"
  pad_token: "<|endoftext|>"

Possible solution

Installation using the git instructions is successful.

$ accelerate launch -m axolotl.cli.train ./phi-ft.yml --deepspeed ./deepspeed/zero1.json                                                                                                                                                                                        
The following values were not passed to `accelerate launch` and had defaults used instead:                                                                                                                                                                                                                                 
        `--num_processes` was set to a value of `1`                                                                                                                                                                                                                                                                        
        `--num_machines` was set to a value of `1`                                                                                                                                                                                                                                                                         
        `--mixed_precision` was set to a value of `'no'`                                                                                                                                                                                                                                                                   
        `--dynamo_backend` was set to a value of `'no'`                                                                                                                                                                                                                                                                    
To avoid this warning pass in values for each of the problematic parameters or run `accelerate config`.                                                                                                                                                                                                                    
/home/user/mambaforge/envs/phi/lib/python3.9/site-packages/transformers/deepspeed.py:23: FutureWarning: transformers.deepspeed module is deprecated and will be removed in a future version. Please import deepspeed modules directly from transformers.integrations                                                     
  warnings.warn(                                                                                                                                                                                                                                                                                                           
                                 dP            dP   dP                                                                                                                                                                                                                                                                     
                                 88            88   88                                                                                                                                                                                                                                                                     
      .d8888b. dP.  .dP .d8888b. 88 .d8888b. d8888P 88                                                                                                                                                                                                                                                                     
      88'  `88  `8bd8'  88'  `88 88 88'  `88   88   88                                                                                                                                                                                                                                                                     
      88.  .88  .d88b.  88.  .88 88 88.  .88   88   88                                                                                                                                                                                                                                                                     
      `88888P8 dP'  `dP `88888P' dP `88888P'   dP   dP  

Which Operating Systems are you using?

  • [X] Linux
  • [ ] macOS
  • [ ] Windows

Python Version

3.9

axolotl branch-commit

main/4d6490b

Acknowledgements

  • [X] My issue title is concise, descriptive, and in title casing.
  • [X] I have searched the existing issues to make sure this bug has not been reported yet.
  • [X] I am using the latest version of axolotl.
  • [X] I have provided enough information for the maintainers to reproduce and diagnose the issue.

casey-martin avatar Dec 04 '23 04:12 casey-martin

+1

Peter-Devine avatar Dec 06 '23 09:12 Peter-Devine

found same error with runpod quickstart template

The following values were not passed toaccelerate launchand had defaults used instead:--num_processeswas set to a value of1 --num_machineswas set to a value of1 --mixed_precisionwas set to a value of'no' --dynamo_backendwas set to a value of'no'To avoid this warning pass in values for each of the problematic parameters or runaccelerate config`. /root/miniconda3/envs/py3.10/bin/python3: Error while finding module specification for 'axolotl.cli.train' (ModuleNotFoundError: No module named 'axolotl') Traceback (most recent call last): File "/root/miniconda3/envs/py3.10/bin/accelerate", line 8, in sys.exit(main()) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/accelerate/commands/accelerate_cli.py", line 47, in main args.func(args) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/accelerate/commands/launch.py", line 994, in launch_command simple_launcher(args) File "/root/miniconda3/envs/py3.10/lib/python3.10/site-packages/accelerate/commands/launch.py", line 636, in simple_launcher raise subprocess.CalledProcessError(returncode=process.returncode, cmd=cmd) subprocess.CalledProcessError: Command '['/root/miniconda3/envs/py3.10/bin/python3', '-m', 'axolotl.cli.train', 'config.yml']' returned non-zero exit status 1.

`

XesGaDeus avatar Dec 06 '23 12:12 XesGaDeus

Odd, the code package is missing from site-packages. Temporary workaround is to make a symlink from python3.??/site-packages/axolotl to the axolotl repo's src/axolotl or copy the source.

13rac1 avatar Dec 12 '23 18:12 13rac1

Facing similar issue on a kaggle notebook, cannot see the axolotl package directory under site-packages image

Praful932 avatar Dec 16 '23 09:12 Praful932

Just running pip3 install -e '.[flash-attn,deepspeed]' once again in my venv solved the issue.

ajinkya123-robo avatar Dec 30 '23 18:12 ajinkya123-robo

I don't know if this module is supposed to run on Databricks, but the workarounds don't help there since I can't symlink or upload entire directories into the workspace. Running with subprocess.run or cloning the repo didn't help either.

karlkovaciny avatar Jan 13 '24 02:01 karlkovaciny

Closing this as duplicate of https://github.com/OpenAccess-AI-Collective/axolotl/issues/945

The current workaround is to git clone and pip install following readme : https://github.com/OpenAccess-AI-Collective/axolotl/issues/945#issuecomment-1900798307

NanoCode012 avatar Mar 30 '24 18:03 NanoCode012