Run this model with HF Jobs

Run itlrc/gpt2-small on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/itlrc/gpt2-small. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/itlrc/gpt2-small on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/itlrc/gpt2-small. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/itlrc/gpt2-small. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.

GPT-2 Small (124M) treinado do zero

Modelo causal de linguagem com arquitetura equivalente ao GPT-2 Small, treinado do zero sobre o sample-10BT do FineWeb-Edu. O treinamento usou o tokenizer GPT-2 e processou aproximadamente 5,51 bilhões de tokens.

Resultados

Métrica Resultado
Parâmetros 124.439.808
Steps 10.500
Épocas lógicas completas 42
Train loss 3,3080
Validation loss 3,2915
Validation perplexity 26,88
HellaSwag 27,68% em 10.042 exemplos

Curvas de treinamento

Arquitetura

  • 12 blocos Transformer;
  • 12 cabeças de atenção;
  • embedding de 768 dimensões;
  • contexto máximo de 1.024 tokens;
  • vocabulário de 50.257 tokens;
  • pesos compartilhados entre embedding e cabeça de linguagem;
  • 124.439.808 parâmetros em FP32.

Uso com Transformers

Este repositório inclui código de arquitetura personalizado. Por isso, o carregamento requer trust_remote_code=True.

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

repo_id = "itlrc/gpt2-small"

tokenizer = AutoTokenizer.from_pretrained("gpt2")
model = AutoModelForCausalLM.from_pretrained(
    repo_id,
    trust_remote_code=True,
    torch_dtype=torch.float32,
)

inputs = tokenizer("Hi! I'm a", return_tensors="pt")
with torch.inference_mode():
    output = model.generate(
        **inputs,
        max_new_tokens=64,
        do_sample=True,
        temperature=0.8,
        top_k=50,
    )

print(tokenizer.decode(output[0], skip_special_tokens=True))

Substitua SEU_USUARIO/meu-gpt2-small pelo identificador deste repositório no Hub.

Treinamento

  • Dataset: HuggingFaceFW/fineweb-edu, configuração sample-10BT;
  • batch efetivo de 524.288 tokens por step;
  • 250 steps por época lógica;
  • AdamW com betas (0.9, 0.95) e weight decay 0.1;
  • gradient clipping em 1.0;
  • warmup e cosine decay;
  • validação em um conjunto fixo de documentos reservados.
  • aproximadamente 6 bilhões de tokens

Limitações

O modelo é um experimento educacional e não recebeu instruction tuning, RLHF ou outro alinhamento por preferências. Pode produzir informações falsas, repetições, vieses ou conteúdo inadequado.

Downloads last month
57
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train itlrc/gpt2-small