Code Monkey home page Code Monkey logo

spelltrans's Introduction

中二技能翻譯

這是一個 LangChain 練習專案,透過 LLM 結合 Riot API 取得的英雄技能翻譯,以 Few-Shot Prompt 的方式獲得中二的技能翻譯。

Demo

環境

  • Ubuntu 22.04
  • Python 3.11
pip install -r requirements.txt

檔案

  • app.py 啟動網頁介面的主程式。
  • crawl_data.py 爬取英雄資料。
  • create_dataset.py 根據英雄技能建立資料集。
  • data/datasets.json 從 Riot API 得到的技能翻譯資料。
  • data/icon.png 網頁介面使用的圖示,來源

模型

使用 Hugging Face Text Generation Inference Docker Image 架設 LLM Backend,可以使用 Taiwan LlamaCKIP Llama,建議至少要有 8GB 以上的 GPU 記憶體。

參考指令如下:

docker run --gpus all --shm-size 1g -p 8080:80 \
    ghcr.io/huggingface/text-generation-inference \
    --model-id ckiplab/CKIP-Llama-2-7b-chat \
    --quantize bitsandbytes-nf4

根據網路速度不同,此指令需要數十分鐘才能完成下載、轉換與啟動。

用法

  • 架設 LLM Backend,請參考上面的指令。
  • (Optional) 執行 crawl_data.py 爬取最新版本的英雄資料。
  • (Optional) 如果有爬取新資料,需要執行 create_dataset.py 建立翻譯資料集。
  • 執行 app.py 啟動網頁介面主程式之後,可在 http://127.0.0.1:7860/ 使用。

授權

MIT License

spelltrans's People

Contributors

penut85420 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.