Giter Site home page Giter Site logo

comment_mengzit5's Introduction

language license datasets metrics
zh
apache-2.0
TencentKuaibao
bleu
rouge

模型

生成评论

  • 在线API只能生成一种评论,模型通过设置model.generate()参数是可以生成多种评论的
t5_tokenizer = T5Tokenizer.from_pretrained("Langboat/mengzi-t5-base")


model = T5ForConditionalGeneration.from_pretrained("wawaup/MengziT5-Comment")


def generate_comment(input_ids):

    outputs = model.generate(input_ids,

                            max_length=128,

                            do_sample=True,

                            temperature=0.9,

                            early_stopping=True,

                            repetition_penalty=10.0,

                            top_p=0.5)

    print(outputs) 

    preds_cleaned = [t5_tokenizer.decode(ids, skip_special_tokens=True, 

                            clean_up_tokenization_spaces=True) for ids in outputs]

    print(preds_cleaned)

    return preds_cleaned

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.