Hub documentation

TF-Keras (레거시)

Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

TF-Keras (레거시)

tf-keras는 Keras 2.x 버전에 부여된 이름입니다. 현재는 여기에서 별도의 GitHub 저장소로 호스팅되고 있습니다. 레거시 프레임워크이지만, Hub에는 여전히 4,500개 이상의 모델이 호스팅되어 있습니다. 이러한 모델은 huggingface_hub 라이브러리를 사용하여 로드할 수 있습니다. 사용자의 머신에는 tf-keras 또는 keras<3.x 중 하나가 설치되어 있어야 합니다.

Keras 3.x 지원에 관심이 있으시다면 이 가이드를 확인해 보세요.

설치 후 from_pretrained_keras 메서드를 사용하여 Hub에서 모델을 로드하면 됩니다. from_pretrained_keras에 대한 자세한 내용은 여기에서 확인하세요.

from huggingface_hub import from_pretrained_keras

model = from_pretrained_keras("keras-io/mobile-vit-xxs")
prediction = model.predict(image)
prediction = tf.squeeze(tf.round(prediction))
print(f'The image is a {classes[(np.argmax(prediction))]}!')

<CopyLLMTxtMenu containerStyle="float: inline-end; margin-inline-start: 10px; display: inline-flex; position: relative; z-index: 10;"></CopyLLMTxtMenu>

# The image is a sunflower!

tf-keras 모델을 Hub에 호스팅할 수도 있습니다. 다만 tf-keras는 레거시 프레임워크라는 점을 유의하세요. 최대한 많은 사용자에게 도달하려면, Keras 3.x를 사용하여 모델을 생성하고 위에서 설명한 대로 네이티브로 공유하는 것을 권장합니다. tf-keras 모델 업로드에 대한 자세한 내용은 push_to_hub_keras 문서를 확인하세요.

from huggingface_hub import push_to_hub_keras

push_to_hub_keras(model,
    "your-username/your-model-name",
    "your-tensorboard-log-directory",
    tags = ["object-detection", "some_other_tag"],
    **model_save_kwargs,
)

추가 리소스

Update on GitHub