5

I've been exploring the implementation of models like Llama in Hugging Face’s transformers library, for example:
Hugging Face's Llama model implementation.

I’m curious about how these implementations work:

  • Are the model codes in Hugging Face’s transformers library (e.g., for Llama) written directly by the creators of the models, or is it Hugging Face’s attempt to reproduce the functionality based on documentation or papers released by the model's original creators?
  • How closely do these implementations follow the specifications or official codebases (if available) provided by the model authors?
mlibre
  • 175
  • 4

2 Answers2

5

You can actually see the author of this code if you look at the first few lines of the file.

To save you clicking the link again:

# coding=utf-8
# Copyright 2022 EleutherAI and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differences compared
# to GPT-NeoX and OPT used by the Meta AI team that trained the model.
#

So this file is not written by meta.

You can find code written by the meta team that implements llama inference here: https://github.com/Meta-Llama/llama and https://github.com/meta-llama/llama/blob/main/llama/model.py

The main difference between these two implementations is that the EleutherAI/Huggingface implementation is built on top of the transformers API (which I will point out does use pytorch), whereas the meta implementation is written just on top of pytorch. If you are familiar with the transformers API, the EleutherAI/Huggingface implementation may be a little bit more convenient to use.

Aleph 0
  • 111
  • 3
1

Are the model implementations in Hugging Face’s transformers library created by the original model authors or by Hugging Face?

Depends on the model.

Franck Dernoncourt
  • 3,473
  • 2
  • 21
  • 39