Code Monkey home page Code Monkey logo

llama2.zig's Introduction

llama2.zig

Llama 2 inference in Zig

How to run

  1. Start and get inside the Docker container:
    cd infra-dev/
    docker-compose up -d
    docker-compose exec -it llama2 bash
  2. Download models:
    curl -L https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin -o ../models/TinyLlama-15M.bin
    See model.py for more details about how the .bin file was exported.
  3. Inference:
    zig build run -- ../models/TinyLlama-15M.bin ../llama2.c/tokenizer.bin
    Or:
    zig build-exe ./src/main.zig -O ReleaseFast -lc
    ./main ../models/TinyLlama-15M.bin ../llama2.c/tokenizer.bin
    Output:
    Hello darkness, my old friend, the sun. He is very hot and he needs to cool down. He looks around and sees a big tree. He thinks it looks like a good place to rest.
    He climbs up the tree and looks around. He sees a big, green tree with lots of leaves. He thinks it looks like a good place to rest. He climbs up the tree and sits on a branch. He feels the cool breeze on his face.
    He looks around and sees a little girl. She is playing with her doll. She has long hair and a pink dress. She looks at him and smiles. She says, "Hello, mister. Do you like my tree?"
    The old man nods and says, "Yes, I do. It is very nice. Do you want to play with me?"
    The little girl nods and says, "Yes, I do. I like your tree. It is very big and green. Can I sit with you?"
    The old man says, "Sure, you can sit with me. But be careful, don't touch my tree. It is very old and fragile. It can break easily."
    The little girl says,
    

References

llama2.zig's People

Contributors

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