Giter Site home page Giter Site logo

nmt-corrector's Introduction

update 23-09-17

  • 新增v2版本
  • 调用数据按照json格式存在file_dir 文件夹里,每条要调用的数据存为一个json文件
  • 同样数据调用结果同源数据以源文件名存在output_dir文件夹里

流程如下图:

流程图

该脚本若中途中断,可直接再次运行即可继续调用。

update 23-05-24

  • 将多进程调用框架提取出来到 multiprocess_call.py 文件里。
  • 顺着if name=="main": 读,实现相应的功能即可
  • 注意logger,默认的输出级别是warning。
  • 保存每个进程结果的时候,每个进程是并行执行的,所以顺序会乱,最好每个每个进程先分别保存,最后整合。

update 23-05-23

主要流程 get_cor.py

  • 将全部数据读入列表src_ref_pre_filt,自动根据进程数num_thread计算每个进程需处理得数据,并存入thread_src_ref_pre
  • 进程开启会调用thread_fun函数,并在元组传入参数
p = pool.apply_async(thread_fun, (i, r'\d+\.', num_sent_per_api,
                                          None, thread_src_ref_pre[i], None))
  • 进程函数内部使用get_prompt_input获取每次调用api时的prompt
  • 取得prompt用get_response调用
  • get_result_from_response解析返回结果

update

  • get_cor.py里增加了每5次请求完成就保存一次的功能,如果出现异常,那么在退出前会保存
  • 更改了结果的re匹配方式先用\n分割句子,然后用re匹配
  • utils里增加新的prompt完成别的任务

增加了continue,如果在运行get_cor.py的时候数据没有请求完就因为不知名原因断了,可以运行continue接着继续

nmt-corrector

get_cor.py是我自己调用api的原始代码 chatgpt_api.py 是整理后的,如有错误以get_cor.py文件的为准

结果保存结构的目录结构, ur-en-23k 是数据目录

image

nmt-corrector's People

Contributors

xdeepazure avatar

Stargazers

Charlton Liu avatar Douzi avatar cipo lee avatar  avatar  avatar  avatar  avatar Walle avatar

Watchers

 avatar

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.