赞
踩
gemma-2b版本都要14G
本地配置:win11、RAM16G、cpu、python3.8
测试发现带不太动、中文不太行
- from transformers import AutoTokenizer, AutoModelForCausalLM
-
- model_path="D:\\gemma-2b"
- tokenizer = AutoTokenizer.from_pretrained(model_path)
- model = AutoModelForCausalLM.from_pretrained(model_path)
-
- input_text = "Write me a poem about Machine Learning."
- input_ids = tokenizer(input_text, return_tensors="pt")
- outputs = model.generate(**input_ids,max_length=256)
- print('用户:',input_text)
- print('google-gemma-2b:',tokenizer.decode(outputs[0]))
用户: Write me a poem about the Lantern Festival.
google-gemma-2b: <bos>Write me a poem about the Lantern Festival.
Answer:
Step 1/2
The Lantern Festival is a time of celebration and reflection for Chinese people. It marks the end of the Lunar New Year, and it is a time to honor the ancestors and pray for good fortune in the coming year. The festival is celebrated on the fifteenth day of the first month of the Chinese calendar, which falls in late January or early February. On this day, families gather together to light lanterns and release them into the sky. The lanterns are made of paper and decorated with colorful designs and patterns. They are often shaped like animals, flowers, or other symbols of good luck. As the lanterns float up into the sky, they are illuminated by the moon and the stars. The festival is also a time to eat traditional foods and drink hot tea. The most popular food is tangyuan, which is a sweet dumpling made of glutinous rice flour. The tea is usually made with green tea and is served in a large pot. The Lantern Festival is a time to reflect on the past year and to look forward to the future. It is a time to honor the ancestors and to pray for good fortune. It is also a time to celebrate the beauty of nature and to
455.5625
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。