Skip to content

Update timm.md #1194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2024
Merged

Update timm.md #1194

merged 1 commit into from
Jan 22, 2024

Conversation

kadirnar
Copy link
Contributor

@kadirnar kadirnar commented Jan 22, 2024

import timm
import torch
from PIL import Image
from timm.data import resolve_data_config
from timm.data.transforms_factory import create_transform

# Load from Hub 🔥
model = timm.create_model(
    'hf-hub:nateraw/resnet50-oxford-iiit-pet',
    pretrained=True
)

# Set model to eval mode for inference
model.eval()

# Create Transform
transform = create_transform(**resolve_data_config(model.pretrained_cfg, model=model))
print(model.pretrained_cfg)

Output:

{'url': 'https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-rsb-weights/resnet50_a1_0-14fe96d1.pth',
 'hf_hub_id': 'nateraw/resnet50-oxford-iiit-pet',
 'source': 'hf-hub',
 'architecture': 'resnet50',
 'custom_load': False,
 'input_size': [3, 224, 224],
 'fixed_input_size': False,
 'interpolation': 'bicubic',
 'crop_pct': 0.95,
 'crop_mode': 'center',
 'mean': [0.485, 0.456, 0.406],
 'std': [0.229, 0.224, 0.225],
 'num_classes': 37,
 'label_names': ['Abyssinian',
  'american_bulldog',
  'american_pit_bull_terrier',
  'basset_hound',
  'beagle',
  'Bengal',
  'Birman',
  'Bombay',
  'boxer',
  'British_Shorthair',
  'chihuahua',
  'Egyptian_Mau',
...
  'wheaten_terrier',
  'yorkshire_terrier'],
 'pool_size': [7, 7],
 'first_conv': 'conv1',
 'classifier': 'fc'}

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@pcuenca pcuenca requested a review from merveenoyan January 22, 2024 13:56
Copy link
Contributor

@merveenoyan merveenoyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed reproduced this, thank you!

@merveenoyan merveenoyan merged commit fb706cd into huggingface:main Jan 22, 2024
@kadirnar kadirnar deleted the patch-1 branch January 22, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants