Could not load model meta-llama/Llama-2-7b-chat-hf with any of the following classes

i fix my same problem with following, not sure which one make it.
1.i remove model.sagetensors.index.json ,model-00001-of-00002.safetensors, model-00002-of-00002.safetensors files
2. your model path name must be the same with meta’s
model = “*****/Llama-2-7b-chat-hf”

tokenizer = AutoTokenizer.from_pretrained(model)

pipeline = transformers.pipeline(
“text-generation”,
model=model,
tokenizer=tokenizer,
torch_dtype=torch.float16,
device_map=“auto”,
)
in config.json,i rewrite it with:
{
“_name_or_path”: “Llama-2-7b-chat-hf”,
“architectures”: [
“LlamaForCausalLM”
],
“bos_token_id”: 1,
“eos_token_id”: 2,
“hidden_act”: “silu”,
“hidden_size”: 4096,
“initializer_range”: 0.02,
“intermediate_size”: 11008,
“max_position_embeddings”: 4096,
“model_type”: “llama”,
“num_attention_heads”: 32,
“num_hidden_layers”: 32,
“num_key_value_heads”: 32,
“pretraining_tp”: 1,
“rms_norm_eps”: 1e-05,
“rope_scaling”: null,
“tie_word_embeddings”: false,
“torch_dtype”: “float16”,
“transformers_version”: “4.31.0”,
“use_cache”: true,
“vocab_size”: 32000
}
also,in command line using this to run “CUDA_VISIBLE_DEVICES=1 python inference.py” if you have many gpus.

you update your pytorch to latest.your error will be solved.i just so.sure,you should select correct version cuda/cpu/python torch