fxmarty/tiny-testing-remote-code

🤗 Hugging Face 来源image-classificationapache-2.094 MBother✓ 1 个校验和今天更新
一条命令提交

在你的模型文件夹旁边运行它。它会制作种子、将文件与 Hugging Face 比对,然后提交。你只需开始做种,并粘贴你账户中的密钥。它只读取你的文件,绝不修改。如果愿意,可以先阅读脚本。

curl -fsSL https://pirateface.co/package.sh | bash -s -- --repo fxmarty/tiny-testing-remote-code ./model-folder
需要做种者 →

Use at your own risk:

from transformers import AutoFeatureExtractor, AutoModelForImageClassification
from datasets import load_dataset
import torch

feature_extractor = AutoFeatureExtractor.from_pretrained("fxmarty/tiny-testing-remote-code")

model = AutoModelForImageClassification.from_pretrained("fxmarty/tiny-testing-remote-code", trust_remote_code=True)

dataset = load_dataset("huggingface/cats-image")
image = dataset["test"]["image"][0]

inputs = feature_extractor(image, return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

# model predicts one of the 1000 ImageNet classes
predicted_label = logits.argmax(-1).item()
print(model.config.id2label[predicted_label])