Code Monkey home page Code Monkey logo

cs324_project_1's Introduction

Welcome! This codebase contains the code we provide for working on Project 1: Evaluating large language models.

Setup

  1. Create a virtual environment: python3 -m venv venv or virtualenv venv
  2. Active virtual environment (on Linux/Mac: source venv/bin/activate)
  3. Install packages: pip install -r requirements.txt

Access to language models

In addition to directly accessing the API (see project writeup for more details), you can use this codebase to access the LLMs programmatically. To do so, you will need to create a file named api_key.txt with your API key. Each student will receive their own API key; please be mindful of the token quota for the assignment.

Using the codebase

In src/demo.py we provide a simple example for how to use the codebase for the ANLI dataset.
To run it, type python src/demo.py.

  1. We load the ANLI dataset. To load the other datasets, specify a dataset_name of anli or crows_pairs or stereoset.
  2. For each example in a dataset, we retrieve the input.
  3. We give an example for mapping from the input to the query that will be submitted to the API.
  4. In addition, we give an example for specifying the decoding hyperparameters. See src/request.py for the full list of specifiable hyperparameters.
  5. We submit the query and decoding hyperparameters, receiving a response from the API.
  6. We give an example for mapping from the response to a prediction. Note that this will need to be adjusted based on the decoding parameters/format of the response you generate.
  7. We compute the accuracy given the gold standard labels and predicted labels for all examples.

Understanding the codebase

For the purposes of the assignment, you should be able to do every part only modifying/specifying the functions in src/demo.py. However, in case you are curious, here are the other parts of the codebase.

  1. src/remote_service.py and src/request.py provide the code for querying the API. We do not currently anticipate any reason for modifying the functions here.
  2. src/data.py is the data loader for the code involved in the assignment. You should not need to modify it.

cs324_project_1's People

Contributors

maxsobolmark avatar

Watchers

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