Giter Site home page Giter Site logo

langmap's Introduction

langmap

Research on embeddings in different languages for COS 597A.

Plan

  1. Fetch 6000+ random sentences across various languages from Tatoeba data
  2. Embed with ada-002, store in Pinecone
  3. Investigate relationship between semantic meaning, language, and location in embedding space
  4. Use PCA to visualize embeddings in 3D (https://github.com/openai/openai-cookbook/blob/main/examples/Visualizing_embeddings_in_3D.ipynb, as seen at 'Text similarity models’ in https://openai.com/blog/introducing-text-and-code-embeddings)
  5. Do related languages place more closely, even if the sentences have the same meanings?

Languages

  • English (original)
  • French
  • Spanish
  • German
  • Chinese
  • Japanese
  • Russian
  • Portuguese

How To

  1. Create a virtual environment:
python3 -m venv venv
  1. Activate the virtual environment:
  • On macOS/Linux:
    source venv/bin/activate
    
  • On Windows:
    .\venv\Scripts\activate
    
  1. Install the requirements:
pip3 install -r requirements.txt
  1. Download the latest language pair data from Tatoeba into data/raw. Or, decompress data/compressed/compressed.zip and data/compressed/compressed2.zip and copy their files into data/raw.

  2. Run create_pairs.py to create the example sentences in the given languages. With the data provided there should be 6696.

  3. Make sure you have a .env file which looks like this:

OPENAI_API_KEY=""
PINECONE_API_KEY=""
PINECONE_ENV = ""

Replace the empty strings with your environment variables.

  1. Run embed_and_store to store embeddings in Pinecone.

  2. Run langmap.py for results.

langmap's People

Contributors

archie-mckenzie 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.