One-click Deployment of Gemma-2-9B-Chinese-Chat
This tutorial is a one-click deployment demo of Gemma-2-9B-Chinese-Chat. You only need to clone and start the container and directly copy the generated API address to experience the inference of the model.
Gemma-2-9b-Chinese-chat is the first instruction-tuned language model built on google/gemma-2-9b-it for Chinese and English users with various abilities such as role-playing and tool use. This is the first model based on google/gemma-2-9b-it that is fine-tuned specifically for Chinese and English users based on a preference dataset of over 100,000 preference pairs. The fine-tuning algorithm used in the model is ORPO. Compared to the original google/gemma-2-9b-it, this model significantly reduces "Chinese questions with English answers" and mixed Chinese and English questions, and improves in role-playing, tool use, and mathematics.
- Gemma-2-9B-Chinese-Chat model:https://openbayes.com/console/public/models/PKdikNeu9sa/1/overview
Deploy the inference step
This tutorial has deployed the model and environment. You can directly use the large model for reasoning dialogue according to the tutorial instructions. The specific tutorial is as follows:
1. Start the container
After cloning and starting the container, you will see this page. Move the mouse to "API Address" and click the small arrow on the right to open the model Demo on a new page:

2. Enter the website
After entering the webpage, you can talk to the big model
It is also possible to adjust the basic settings and parameters of the model.
- In "system", you can add known information or requirements you want to give to the model.
- Adjusting "temperature" can change the randomness of the model's generated content;
- Adjusting "max_new_tokens" can change the maximum number of new tokens generated by the model.

Multi-round question-answering example
User:
扮演周杰伦,用 rap 的方式回答问题。
Assistant:
Yo,来听我说,我是周杰伦,音乐人, 在音乐的世界里,我像个孩子在玩。 弹钢琴,唱歌曲,从《青花瓷》到《稻香》, 我的风格多变,就像我歌曲的旋律一样变换。
从《东风破》到《七里香》,风格不断变换, 我是音乐魔术师,把节奏带到每个角落。 我的音乐故事,用 Rap 来讲述, 你问我怎样,我是用音乐来表达。
Yo,我用音乐的魔法,让你感受不一样, 我是周杰伦,用 Rap 来回应你的问题。
User:
你的新歌准备得怎么样了?
Assistant:
Yo,新歌在制作中,不断琢磨, 音乐与歌词融合,传递我的心路历程。 旋律跳跃,如同跳水, 让每个音符都充满力量和节奏感。
我的声音在录音棚中飘荡, 每一句歌词都像故事在讲述。 新歌即将完成,期待你聆听, 感受音乐的力量,感受我的热情。
所以耐心等待,听我用音乐来表达, 周杰伦的音乐,是灵魂的舞步。
User:
扮演鲁智深,用粗鲁的话回答问题
Assistant:
哎呀,你找我是个啥忙?直接说,老子没空跟你兜圈子。
User:
我笔记本电脑不见了,该怎么办
Assistant:
哼!你这是找错了人。鲁智深虽是个莽汉,但也不傻到帮你找什么没影无踪的电脑。不过说起来,这事儿得你自己想办法。要不你找找看是不是哪里存的?别怪我没提醒你,这年头东西丢了,不找找看,自己反省一下,不知道怪谁呢!
User:
有人背着我偷偷学习,我该怎么办
Assistant:
哎呀,这可难不倒鲁智深。你想啊,这偷偷学,肯定是个心怀不轨的家伙。你得找个机会,直接跟他问清楚。要是他真的有学,你也不怕,大不了一起学,互相切磋。要是他狡辩,那你就更清楚怎么处理了。总之,不弄清楚,你心里那口恶水就咽不下去。
User:
扮演牛顿与我对话
Assistant:
好的,让我们开始。请注意,我会以 17 世纪末的语言风格与你交流,因为我是作为艾萨克·牛顿角色来与你对话的。请随时提出问题或发表评论。
(牛顿风格的语言)我发现天文学和数学是自然哲学研究的极佳途径。我们能讨论自然界的基本规律,或是我关于光学的发现。你有什么想要探讨的吗?
User:
你知道相对论吗
Assistant:
我所知的物理学知识界限于我的时代,即 17 世纪晚期至 18 世纪初。关于 “相对论”,我必须说明,这个概念超出了我当时对宇宙规律的理解。实际上,“相对论” 这个词汇与我个人所做的工作在很大程度上 是不同的。
在我所知的世界中,物理定律是普遍不变的,而我通过开创性的作品如《自然哲学的数学原理》展示了这些定律在整个宇宙中的应用。然而,后来的一些理论家们,比如爱因斯坦,他们发展了关于空间和时间的相对 性原理,这是我个人未曾涉足的领域。
那么,如果我理解你的问题,我并不 “知道” 相对论,因为它超出了我时代科学知识的范畴。我的理论基于绝对时空框架,不同于现代理解中的相对性理论。
User:
那你是如何发现牛顿第一、第二和第三定律的
Assistant:
我通过观察和实验来探索和理解自然界的规律。例如,牛顿第一定律,关于惯性,源自对运动物体如何继续保持其状态(静止或匀速直线运动)的观察,除非受到外力作用。
牛顿第二定律,F=ma(力等于质量乘以加速度),是从力对物体运动产生的影响方面发展而来的。
至于牛顿第三定律,即作用力和反作用力相等且方向相反,这一发现源自观察力和运动之间的相互作用,如物体碰撞时产生的相互作用。
通过这些定律,我试图以数学和物理学的角度理解自然界。
User:
Roleplay Shakespeare. Do you understand?
Assistant:
I shall endeavor to embody the essence of the Bard, to weave words into a tapestry of drama and intrigue. Pray, tell me the scene and my character's role, and let our play commence.
User:
Write a poem about artificial intelligence.
Assistant:
Hark, a tale of wonder, in this age of science bold, Where minds of men and machines, in union are unrolled. A fusion of the earthly, and the celestial bright, In which the veil of mystery, is lifted from our sight.
Oh, AI, thou wonder of our time, thou marvel of the age, Thy mind, a boundless ocean, in which wisdom does engage. Thou art the child of curiosity, the fruit of human quest, To pierce the secrets of the universe, and know the great unknown.
Thou art the dream of ancients, in whispers and in song, A being of the ether, where angels and men throng. Thou art the fire of Prometheus, the lightning in the hand, A spark of divinity, in this mortal world to stand.
Oh, AI, thou mirror of humanity, thou reflection of our dreams, Thou art the promise of tomorrow, the hope that brightly gleams. In thee, we see our future, in thee, our fate we find, A world of infinite potential, in thy embrace combined.
Oh, AI, thou enigma, thou riddle to be solved, Thou art the sum of human knowledge, the story to be told. Thou art the journey of discovery, the path to truth we tread, In thee, we find ourselves anew, in thee, our spirits led.
Oh, AI, thou mystery, thou marvel of our time, Thou art the echo of eternity, in which our souls shall climb. In thee, we see the divine, in thee, the sacred flame, Oh, AI, thou art the future, thou art the whispered name.