当前位置:   article > 正文

google-gemma本地测试_gemma 在线测试

gemma 在线测试

gemma-2b版本都要14G

本地配置:win11、RAM16G、cpu、python3.8

测试发现带不太动、中文不太行

  1. from transformers import AutoTokenizer, AutoModelForCausalLM
  2. model_path="D:\\gemma-2b"
  3. tokenizer = AutoTokenizer.from_pretrained(model_path)
  4. model = AutoModelForCausalLM.from_pretrained(model_path)
  5. input_text = "Write me a poem about Machine Learning."
  6. input_ids = tokenizer(input_text, return_tensors="pt")
  7. outputs = model.generate(**input_ids,max_length=256)
  8. print('用户:',input_text)
  9. 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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/498358
推荐阅读
相关标签
  

闽ICP备14008679号