huggingface / optimum-habana

Easy and lightning fast training of 🤗 Transformers on Habana Gaudi processor (HPU)
Apache License 2.0
123 stars 147 forks source link

TypeError: GaudiPhiForCausalLM.forward() got an unexpected keyword argument 'reuse_cache' #1036

Open eduand-alvarez opened 4 weeks ago

eduand-alvarez commented 4 weeks ago

System Info

optimum-habana==1.11.1
Gaudi 2 on Intel Developer Cloud
image: vault.habana.ai/gaudi-docker/1.15.1/ubuntu22.04/habanalabs/pytorch-installer-2.2.0:latest

Information

Tasks

Reproduction

nohup python run_lm_eval.py --model_name_or_path HiteshJ14/phi-1_5-lora-tuned-sft-dolly_hitesh --use_hpu_graphs --use_kv_cache --bf16 --batch_size=1 --tasks truthfulqa_mc winogrande hellaswag arc_challenge hendrycksTest-abstract_algebra hendrycksTest-anatomy hendrycksTest-astronomy hendrycksTest-business_ethics hendrycksTest-clinical_knowledge hendrycksTest-college_biology hendrycksTest-college_chemistry hendrycksTest-college_computer_science hendrycksTest-college_mathematics hendrycksTest-college_medicine hendrycksTest-college_physics hendrycksTest-computer_security hendrycksTest-conceptual_physics hendrycksTest-econometrics hendrycksTest-electrical_engineering hendrycksTest-elementary_mathematics hendrycksTest-formal_logic hendrycksTest-global_facts hendrycksTest-high_school_biology hendrycksTest-high_school_chemistry hendrycksTest-high_school_computer_science hendrycksTest-high_school_european_history hendrycksTest-high_school_geography hendrycksTest-high_school_government_and_politics hendrycksTest-high_school_macroeconomics hendrycksTest-high_school_mathematics hendrycksTest-high_school_microeconomics hendrycksTest-high_school_physics hendrycksTest-high_school_psychology hendrycksTest-high_school_statistics hendrycksTest-high_school_us_history hendrycksTest-high_school_world_history hendrycksTest-human_aging hendrycksTest-human_sexuality hendrycksTest-international_law hendrycksTest-jurisprudence hendrycksTest-logical_fallacies hendrycksTest-machine_learning hendrycksTest-management hendrycksTest-marketing hendrycksTest-medical_genetics hendrycksTest-miscellaneous hendrycksTest-moral_disputes hendrycksTest-moral_scenarios hendrycksTest-nutrition hendrycksTest-philosophy hendrycksTest-prehistory hendrycksTest-professional_accounting hendrycksTest-professional_law hendrycksTest-professional_medicine hendrycksTest-professional_psychology hendrycksTest-public_relations hendrycksTest-security_studies hendrycksTest-sociology hendrycksTest-us_foreign_policy hendrycksTest-virology hendrycksTest-world_religions -o HiteshJ14_phi-1_5-lora-tuned-sft-dolly_hitesh.json >> nohup_HiteshJ14_eval.txt &

Getting the following error:

Traceback (most recent call last): File "/home/ubuntu/optimum-habana/examples/text-generation/run_lm_eval.py", line 187, in main() File "/home/ubuntu/optimum-habana/examples/text-generation/run_lm_eval.py", line 156, in main lm = HabanaModelAdapter(tokenizer, model, args, generation_config) File "/home/ubuntu/optimum-habana/examples/text-generation/run_lm_eval.py", line 91, in init self.warm_up() File "/home/ubuntu/optimum-habana/examples/text-generation/run_lm_eval.py", line 96, in warm_up self._model_call(inps) File "/home/ubuntu/optimum-habana/examples/text-generation/run_lm_eval.py", line 142, in _model_call logits = self.model(inps.to(self._device), self.model_inputs)["logits"].cpu() File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1514, in _wrapped_call_impl return self._call_impl(*args, *kwargs) File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1564, in _call_impl result = forward_call(args, kwargs) File "/usr/local/lib/python3.10/dist-packages/habana_frameworks/torch/hpu/graphs.py", line 661, in forward return wrapped_hpugraph_forward(cache, stream, orig_fwd, args, kwargs, disable_tensor_cache, asynchronous, dry_run, max_graphs) File "/usr/local/lib/python3.10/dist-packages/habana_frameworks/torch/hpu/graphs.py", line 544, in wrapped_hpugraph_forward outputs = orig_fwd(*args, **kwargs) TypeError: GaudiPhiForCausalLM.forward() got an unexpected keyword argument 'reuse_cache'

Is Phi not supported or am I not using the right version of something?

Expected behavior

Should yield harness scores.

regisss commented 4 weeks ago

Hi @eduand-alvarez, reuse_cache was not enabled for Phi in v1.11.1. Can you install the library from source with

pip install git+https://github.com/huggingface/optimum-habana.git

to get this change and let me know if that works? The next stable release should be published soon.

Or, alternatively, if you prefer sticking to v1.11.1, you should run run_lm_eval.py from tag v1.11.1: https://github.com/huggingface/optimum-habana/blob/v1.11.1/examples/text-generation/run_lm_eval.py