alpaca-lora icon indicating copy to clipboard operation
alpaca-lora copied to clipboard

How to inference based on export_hf result?

Open cokuehuang opened this issue 1 year ago • 6 comments

Results with export_hf_checkpoint.py: ├── config.json ├── generation_config.json ├── pytorch_model-00001-of-00007.bin ├── pytorch_model-00002-of-00007.bin ├── pytorch_model-00003-of-00007.bin ├── pytorch_model-00004-of-00007.bin ├── pytorch_model-00005-of-00007.bin ├── pytorch_model-00006-of-00007.bin ├── pytorch_model-00007-of-00007.bin └── pytorch_model.bin.index.json While convert llama to hf format as follows: ├── config.json ├── generation_config.json ├── pytorch_model-00001-of-00007.bin ├── pytorch_model-00002-of-00007.bin ├── pytorch_model-00003-of-00007.bin ├── pytorch_model-00004-of-00007.bin ├── pytorch_model-00005-of-00007.bin ├── pytorch_model-00006-of-00007.bin ├── pytorch_model-00007-of-00007.bin ├── pytorch_model.bin.index.json ├── special_tokens_map.json ├── tokenizer_config.json └── tokenizer.model Is the result of export_hf correct ? As missing special_tokens_map.json、tokenizer_config.json、tokenizer.model files,inference with from_pretrained from export_hf's result occurs error: tokenizer = LlamaTokenizer.from_pretrained(export_hf_dir) model = LlamaForCausalLM.from_pretrained(export_hf_dir, torch_dtype="auto", device_map="auto") OSError: Can't load tokenizer for '/xx/export_hf_dir/'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure '/xx/export_hf_dir/' is the correct path to a directory containing all relevant files for a LlamaTokenizer tokenizer Should I copy special_tokens_map.json、tokenizer_config.json、tokenizer.model files from llama path to export_hf path?

cokuehuang avatar Apr 13 '23 12:04 cokuehuang