--- license: apache-2.0 datasets: - shibing624/alpaca-zh language: - zh tags: - LoRA - LLaMA - Alpaca - PEFT - int8 --- # Model Card for llama-7b-alpaca-zh-20k ## Uses ### Direct Use ```python from peft import PeftModel from transformers import GenerationConfig, LlamaForCausalLM, LlamaTokenizer max_memory = {i: "15GIB" for i in range(torch.cuda.device_count())} tokenizer = LlamaTokenizer.from_pretrained(base_model) model = LlamaForCausalLM.from_pretrained( base_model, load_in_8bit=True, torch_dtype=torch.float16, device_map="auto" max_memory=max_memory ) model = PeftModel.from_pretrained( model, lora_weights, torch_dtype=torch.float16, max_memory=max_memory ) ```