Giter Site home page Giter Site logo

global-decoding's Introduction

Global vs Local Decoding for Large Language Models

This repository provides a Python script for generating text sequences using various large language models (LLMs), conducting Markov Chain Monte Carlo (MCMC) analysis, and evaluating the generated sequences. The script explores different decoding strategies, focusing on local versus global normalization techniques to understand their effects on the quality and diversity of the generated text.

Requirements

  • Python 3.8.6 or higher

Installation

Clone the repository to your local machine:

git clone https://github.com/lowlypalace/global-decoding.git
cd global-decoding

Install the required Python packages:

pip install -r requirements.txt

Usage

The script can be run from the command line with various arguments to customize the text generation, MCMC analysis, and evaluation process.

Basic Command

python src/main.py \
  --top_k 100 \
  --sequence_count 1000 \
  --batch_size_seq 32 \
  --batch_size_prob 16 \
  --model_name gpt2-medium \
  --mcmc_rate 10 \
  --mcmc_burnin 0.2 \
  --eval_num_sequences 100 \
  --seed 0

Arguments

Run python src/main.py --help to see all available arguments and their descriptions.

Testing

To run the tests, use the following command:

  python -m unittest

Output

Outputs are saved in the specified --output_dir directory, including generated sequences, logs, and evaluation results.

Linting

To lint the code, use the following command:

black .

Contributing

Contributions to this project are welcome! Please fork the repository, make your changes, and submit a pull request.

global-decoding's People

Contributors

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