GithubHelp home page GithubHelp logo

Comments (8)

yug2023 avatar yug2023 commented on May 22, 2024

prompt = "// language: Java\n#write a bubble sort function\n" 你的prompt改错了,用这个可以正常返回

from codegeex2.

Zz-dong avatar Zz-dong commented on May 22, 2024

@yug2023 我个人的想法是这个prompt是写了两行注释 然后通过注释生成代码 所以我认为 prompt 应该是 "// language: Java\n //write a bubble sort function\n" 而且其他语言的prompt我也是按照这一想法修改的 都没有问题。 所以我不太清楚prompt的正确格式应该是什么样的。 你有尝试过其他语言只修改最前面的注释字符token。 @Stanislas0 您好,请问可以在这方面详细说明一下吗?

from codegeex2.

Stanislas0 avatar Stanislas0 commented on May 22, 2024

@yug2023 我个人的想法是这个prompt是写了两行注释 然后通过注释生成代码 所以我认为 prompt 应该是 "// language: Java\n //write a bubble sort function\n" 而且其他语言的prompt我也是按照这一想法修改的 都没有问题。 所以我不太清楚prompt的正确格式应该是什么样的。 你有尝试过其他语言只修改最前面的注释字符token。 @Stanislas0 您好,请问可以在这方面详细说明一下吗?

你的prompt没有写错,CodeGeeX2是一个基座模型,prompt格式就是按照正常编程习惯来写。这里出现空行比较奇怪,我试了是可以正常出东西的,估计是精度原因导致,不知道你的模型是否经过了量化。如果要更好的引导模型生成函数体,只需要再加上一些关键字就行了,比如“public”,模型就会继续完成函数体。

from codegeex2.

toufunao avatar toufunao commented on May 22, 2024

你好,我也是用java生成冒泡排序失败。两种prompt都尝试过,“// language: Java\n //write a bubble sort function\n”,“prompt = "// language: Java\n#write a bubble sort function\n"”。都是打印大量空行,没有任何内容。使用的是单卡32G V100,模型没有经过量化。

from codegeex2.

Zz-dong avatar Zz-dong commented on May 22, 2024

@toufunao Stanislas0 提到可能是模型精度问题。

你的prompt没有写错,CodeGeeX2是一个基座模型,prompt格式就是按照正常编程习惯来写。这里出现空行比较奇怪,我试了是可以正常出东西的,估计是精度原因导致,不知道你的模型是否经过了量化。如果要更好的引导模型生成函数体,只需要再加上一些关键字就行了,比如“public”,模型就会继续完成函数体。

V100机器不支持bfloat16,所以需要按照README中的教程修改代码

如果显卡不支持bfloat16格式,将会输出错误的内容,需要将模型转换成float16格式:

model = AutoModel.from_pretrained("THUDM/codegeex2-6b", trust_remote_code=True).half().cuda()

我没有进行尝试,如果你成功了希望你可以回复一下

from codegeex2.

toufunao avatar toufunao commented on May 22, 2024

@Zz-dong 你好,我刚刚尝试过了,可以输出Java代码,但仍存在大量的空行。
而且还会出现以下提示:“The attention mask and the pad token id were not set. As a sequence, you may observe unexpected behavior. Please pass your inputs's 'attention_mask' to obtain reliable results. Setting 'pad_token_id' to 'eos_token_id':2 for open-ended generation. ”

ps:
我下一步会考虑进行微调,有相关微调数据预处理的教程吗?

from codegeex2.

Zz-dong avatar Zz-dong commented on May 22, 2024

@toufunao 我似乎也遇到过这样的warning,或许这就是空行存在的原因,可以请教一下@Stanislas0#47#16 中都有提到微调的需求但是官方似乎没有提供相应的教程,这也是我的需求。希望官方可以更新一下,期待 !

from codegeex2.

zhouenxian avatar zhouenxian commented on May 22, 2024

我也出现了大量空行,还有warning提示
The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's attention_mask to obtain reliable results.
Setting pad_token_id to eos_token_id:2 for open-end generation.
并且原封不动的吧Prompt的内容打印出来,最奇怪的是代码一个字也没生成。我没有对模型进行量化。
image

from codegeex2.

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.