Giter Site home page Giter Site logo

Comments (4)

akiori avatar akiori commented on May 17, 2024 1

吴恩达的课讲过的,这个没有指令微调,不懂指令,只是补全/续写罢了

比如: 法国的首都是什么?
指令微调的模型会告诉你是巴黎, 没有调过的会续写成 **的首都是什么?美国的首都是什么?日本的首都是什么?

from baichuan-7b.

WuNein avatar WuNein commented on May 17, 2024

这个是生成的参数问题。官方没给参数,

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

tokenizer = AutoTokenizer.from_pretrained("baichuan-7B", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("baichuan-7B", device_map="auto", trust_remote_code=True, torch_dtype=torch.float16)

input_text = """折木奉太郎:
寒暄省略。
我目前在贝拿勒斯(注)。日本人大多是这么称呼它吧,但感觉旧名「瓦拉纳西」的发音似乎更接近当地方言。
奉太郎,这个城市很神奇哦,简直是个葬礼之都,因为这里不停地举办葬礼,好像只要死在这里就进得了天国,有没有搞错啊?喔,听说是能脱离轮回,如成仙一般。在**得经过长年修行才能超脱,不过在这里只要死了就成。
这么说来,**人还真可怜。
虽然是迟来的祝贺,恭喜你考上高中。原来你要读的是神山啊,真没创意,不过也罢,总之恭喜你啦。
我这姐姐要给顺利考上高中的你一个建议。
加入古籍研究社吧。
古籍研究社在神高是深具传统的学艺类社团,而且,我不清楚你知不知道,它也是我待过的社团。
据说我们这个深具传统的古籍研究社已经连续三年没招到新进社员,现在社员人数挂零,如果今年还是没人加入就等同废社了。我身为古籍研究社的前社员,"""

inputs = tokenizer(input_text, return_tensors='pt')
inputs = inputs.to('cuda')
pred = model.generate(**inputs, max_new_tokens=200,do_sample = True, top_k = 3, top_p = 0.9, temperature = 0.8, repetition_penalty=1.1, length_penalty = 1.1)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True)[len(input_text):])

image

image
感觉是见过冰菓这本书的(^_^)

from baichuan-7b.

maojinyang avatar maojinyang commented on May 17, 2024

这个模型应该没有经过instruct tuning,需要以ICL的形式构造prompt来获得相关的回答。

from baichuan-7b.

cristianohello avatar cristianohello commented on May 17, 2024

@smartest-water
你好,下面你这个包装接口的api代码怎么写的?能提供让我借鉴一下吗

curl -X POST "http://10.20.20.221:8000/" -H 'Content-Type: application/json' -d '{"prompt": "**有什么好吃的"}'
{"response":"**有什么好吃的?\n**有什么好吃的?\n**的美食很多,有**的特色小吃,有**的特色菜,有**的特色甜点,有**的特色饮料,有**的特色水果,有**的特色海鲜,有**的特色小吃,有**的特色小吃","status":200,"time":"2023-06-15 19:06:16"}

from baichuan-7b.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.