microsoft / TransformerCompression

For releasing code related to compression methods for transformers, accompanying our publications
MIT License
354 stars 31 forks source link

NotImplementedError: xx is neither a Hugging Face model nor a supported local model. #138

Closed qxpBlog closed 4 months ago

qxpBlog commented 4 months ago

@mtodd @tpope @sverrejoh @radical @ijbaird When use the following command to prune the model llama-7b:

CUDA_VISIBLE_DEVICES=0 python run_slicegpt.py \
    --model /home/iotsc01/llama-7b-hf \
    --save-dir sliced_model \
    --sparsity 0.20 \
    --device cuda:0 \
    --eval-baseline \
    --no-wandb

the following problem happend:

Running SliceGPT experiment.
PyTorch device: cuda:0
Number of available cuda devices: 1
Loading /home/iotsc01/llama-7b-hf config and model weights from /home/iotsc01/xinpengq/LLM-Pruner-main/llama-7b-hf
Traceback (most recent call last):
  File "/home/iotsc01/TransformerCompression-main/experiments/run_slicegpt.py", line 274, in <module>
    slicing_main(slicing_args)
  File "/home/iotsc01/TransformerCompression-main/experiments/run_slicegpt.py", line 149, in slicing_main
    model_adapter, tokenizer = hf_utils.get_model_and_tokenizer(
  File "/home/iotsc01/TransformerCompression-main/src/slicegpt/hf_utils.py", line 33, in wrapper
    result = func(*args, **kwargs)
  File "/home/iotsc01/TransformerCompression-main/src/slicegpt/hf_utils.py", line 91, in get_model_and_tokenizer
    model_adapter = ModelAdapter.from_model(
  File "/home/iotsc01/TransformerCompression-main/src/slicegpt/model_adapter.py", line 361, in from_model
    raise NotImplementedError(f"{model_path} is neither a Hugging Face model nor a supported local model.")
NotImplementedError: /home/iotsc01/llama-7b-hf is neither a Hugging Face model nor a supported local model.

How can i solve it?

peterhucuc commented 3 months ago

老哥上面那个问题是咋解决的呀?我用自己服务器上的LLama-2的模型也遇到了这个问题,还没有解决,老哥能分享一下解决方法吗

zlz-123 commented 1 month ago

这个问题解决了嘛,可以分享一下解决方法嘛