readme: ---
  language:
  - es
  tags:
  - pytorch
  - causal-lm
  license: apache-2.0
  datasets:
  - bertin-project/mc4-es-sampled
  
  ---
  
  - [✨Version v1✨](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1): August 25th, 2022 (*[full](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1) and [half-precision weights](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1-half)*, at step 1M)
  - [Version v1beta3](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1beta3): July 22nd, 2022 (*[full](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1beta3) and [half-precision weights](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1beta3-half)*, at step 850k)
  - [Version v1beta2](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1beta2): June 6th, 2022 (*[full](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1beta2) and [half-precision weights](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1beta2-half)*, at step 616k)
  - [Version v1beta1](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/v1beta1-half): April 28th, 2022 (*half-precision weights only*, at step 408k)
  - <details><summary>All checkpoints</summary>
  
    - [Checkpoint 130k](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/6c116e533a00db027bf0a2e0b5e06d3e0772e2d0).
    - [Checkpoint 275k](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/20f424ebcc7c500d5328ed45a8c911a2a75583f1).
    - [Checkpoint 408k](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/c51db24abee958efe83e52fddf6d19e5f065b818).
    - [Checkpoint 616k](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/abafe00bfb03330e72a67ed9fc0958c7399f2181).
    - [Checkpoint 850k](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/59d5064b65043f2ff2b2549e4a076854eec22b2e).
    - [Checkpoint 1M](https://huggingface.co/bertin-project/bertin-gpt-j-6B/tree/153dab8ad6bc0bfe84346a58834992d46e83662a).
  
  </details>
  
  # BERTIN GPT-J-6B
  
  <div align=center>
  <img alt="BERTIN logo" src="https://huggingface.co/bertin-project/bertin-roberta-base-spanish/resolve/main/images/bertin.png" width="200px">
  </div>
  
  ## Demo: https://huggingface.co/spaces/bertin-project/bertin-gpt-j-6B
  
  ## Model Description
  
  BERTIN-GPT-J-6B is a Spanish finetuned version of GPT-J 6B, a transformer model trained using Ben Wang's [Mesh Transformer JAX](https://github.com/kingoflolz/mesh-transformer-jax/). "GPT-J" refers to the class of model, while "6B" represents the number of trainable parameters.
  
  <figure>
  
  | Hyperparameter       | Value      |
  |----------------------|------------|
  | \\(n_{parameters}\\) | 6053381344 |
  | \\(n_{layers}\\)     | 28&ast;    |
  | \\(d_{model}\\)      | 4096       |
  | \\(d_{ff}\\)         | 16384      |
  | \\(n_{heads}\\)      | 16         |
  | \\(d_{head}\\)       | 256        |
  | \\(n_{ctx}\\)        | 2048       |
  | \\(n_{vocab}\\)      | 50257/50400&dagger; (same tokenizer as GPT-2/3)  |
  | Positional Encoding  | [Rotary Position Embedding (RoPE)](https://arxiv.org/abs/2104.09864) |
  | RoPE Dimensions      | [64](https://github.com/kingoflolz/mesh-transformer-jax/blob/f2aa66e0925de6593dcbb70e72399b97b4130482/mesh_transformer/layers.py#L223) |
  <figcaption><p><strong>&ast;</strong> Each layer consists of one feedforward block and one self attention block.</p>
  <p><strong>&dagger;</strong> Although the embedding matrix has a size of 50400, only 50257 entries are used by the GPT-2 tokenizer.</p></figcaption></figure>
  
  The model consists of 28 layers with a model dimension of 4096, and a feedforward dimension of 16384. The model
  dimension is split into 16 heads, each with a dimension of 256. Rotary Position Embedding (RoPE) is applied to 64
  dimensions of each head. The model is trained with a tokenization vocabulary of 50257, using the same set of BPEs as
  GPT-2/GPT-3.
  
  ## Training data
  
  BERTIN-GPT-J-6B was finetuned on [mC4-es-sampled (gaussian)](https://huggingface.co/datasets/bertin-project/mc4-es-sampled), a Spanish subset of mC4 sampled using perplexity values.
  
  ## Training procedure
  
  This model was finetuned for ~65 billion tokens (65,536,000,000) over 1,000,000 steps on a single TPU v3-8 VM. It was trained as an autoregressive language model, using cross-entropy loss to maximize the likelihood of predicting the next token correctly. Training took roughly 6 months.
  
  ## Intended Use and Limitations
  
  BERTIN-GPT-J-6B learns an inner representation of the Spanish language that can be used to extract features useful for downstream tasks. The model is best at what it was pretrained for however, which is generating text from a prompt.
  
  ### How to use
  
  This model can be easily loaded using the `AutoModelForCausalLM` functionality:
  
  ```python
  from transformers import AutoTokenizer, AutoModelForCausalLM
  
  tokenizer = AutoTokenizer.from_pretrained("bertin-project/bertin-gpt-j-6B")
  model = AutoModelForCausalLM.from_pretrained("bertin-project/bertin-gpt-j-6B")
  ```
  
  ### Limitations and Biases
  
  As the original GPT-J model, t