Local Invocation of Llama3 Large Model Development

Local Invocation of Llama3 Large Model Development

1. Test using the trained weights from transformers import AutoModelForCausalLM,AutoTokenizer,TextGenerationPipeline import torch tokenizer = AutoTokenizer.from_pretrained(r"E:\大模型AI开发\AI大模型\projects\gpt2\model\models–uer–gpt2-chinese-cluecorpussmall\snapshots\c2c0249d8a2731f269414cc3b22dff021f8e07a3") model = AutoModelForCausalLM.from_pretrained(r"E:\大模型AI开发\AI大模型\projects\gpt2\model\models–uer–gpt2-chinese-cluecorpussmall\snapshots\c2c0249d8a2731f269414cc3b22dff021f8e07a3") # Load our own trained weights (Chinese poetry) model.load_state_dict(torch.load("net.pt")) # Use the system's built-in pipeline tool to generate content pipline = TextGenerationPipeline(model,tokenizer,device=0) print(pipline("天高", max_length=24)) The performance is actually not good: 2. Post-process the AI-generated results # Customized … Read more