Transformers documentation

FLAN-UL2

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

이 모델은 2023-06-20에 Hugging Face Transformers에 기여되었습니다.

FLAN-UL2

개요

Flan-UL2는 T5 아키텍처를 기반으로 한 인코더-디코더 모델입니다. 지난 해 초에 공개된 UL2 모델과 동일한 구성을 사용합니다. “Flan” 프롬프트 튜닝 및 데이터셋 수집을 통해 파인 튜닝되었습니다. Flan-T5와 마찬가지로, 모델을 파인 튜닝하지 않고 FLAN-UL2 가중치를 바로 사용할 수 있습니다:

원래 블로그에 따르면 주목할 만한 개선 사항은 다음과 같습니다:

  • UL2의 원래 모델은 receptive field가 512로만 학습되어, N이 큰 N-shot prompting에는 이상적이지 않았습니다.
  • Flan-UL2 체크포인트는 2048의 receptive field를 사용하여 few-shot in-context learning에 더 유용합니다.
  • 원래 UL2 모델에는 좋은 성능을 얻기 위해 사실상 필수적인 모드 전환 토큰이 포함되어 있었습니다. 그러나 추론 또는 파인튜닝 과정에서 변경이 자주 필요해 다소 번거로웠습니다. 이번 업데이트/변경 사항에서는 Flan 지시 튜닝을 적용하기 전에 “모드 토큰”을 잊도록 UL2 20B를 추가 100k 스텝(소규모 배치) 동안 계속 학습했습니다. 이 Flan-UL2 체크포인트는 더 이상 모드 토큰이 필요하지 않습니다. Google은 다음 변형을 공개했습니다:

원본 체크포인트는 여기에서 찾을 수 있습니다.

리소스가 제한된 기기에서 실행

모델이 상당히 무겁습니다(반정밀도 기준 약 40GB). 모델을 실행만 하려면 8bit로 모델을 로드하고, OOM 문제가 발생하지 않도록 device_map="auto"를 사용하세요!

from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, BitsAndBytesConfig


model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-ul2", quantization_config=BitsAndBytesConfig(load_in_8bit=True), device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("google/flan-ul2")

inputs = tokenizer("A step by step recipe to make bolognese pasta:", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs)
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
['In a large skillet, brown the ground beef and onion over medium heat. Add the garlic']

API 참조, 팁, 코드 예제 및 노트북에 대해서는 T5 문서 페이지를 참조하세요.

Update on GitHub