Navigate models
모델 주는 FuriosaAI NPU를 사용해서 가속할 수 있는 모델들을 쉽게 사용할 수 있도록 모아놓은 프로젝트입니다. 먼저, 사용 가능한 모델들을 살펴보겠습니다.
In [1]:
Copied!
from furiosa.models import vision
print(dir(vision))
from furiosa.models import vision
print(dir(vision))
['EfficientNetB0', 'EfficientNetV2s', 'ResNet50', 'SSDMobileNet', 'SSDResNet34', 'YOLOv5l', 'YOLOv5m']
In [2]:
Copied!
# Or you can use the Command line tool
! furiosa-models list
# Or you can use the Command line tool
! furiosa-models list
+-----------------+------------------------------+----------------------+-------------------------+ | Model name | Model description | Task type | Available postprocesses | +-----------------+------------------------------+----------------------+-------------------------+ | ResNet50 | MLCommons ResNet50 model | Image Classification | Python | | SSDMobileNet | MLCommons MobileNet v1 model | Object Detection | Python, Rust | | SSDResNet34 | MLCommons SSD ResNet34 model | Object Detection | Python, Rust | | YOLOv5l | YOLOv5 Large model | Object Detection | Rust | | YOLOv5m | YOLOv5 Medium model | Object Detection | Rust | | EfficientNetB0 | EfficientNet B0 model | Image Classification | Python | | EfficientNetV2s | EfficientNetV2-s model | Image Classification | Python | +-----------------+------------------------------+----------------------+-------------------------+
그 중 하나인 ResNet50의 인스턴스를 만들고 Model
객체에 관해 자세히 알아보겠습니다.
In [3]:
Copied!
model = vision.ResNet50()
print(model)
print("Static fields:", list(model.model_fields.keys()))
print("Lazy loaded fields:", list(model.model_computed_fields.keys()))
model = vision.ResNet50()
print(model)
print("Static fields:", list(model.model_fields.keys()))
print("Lazy loaded fields:", list(model.model_computed_fields.keys()))
name='ResNet50' task_type=<ModelTaskType.IMAGE_CLASSIFICATION: 'IMAGE_CLASSIFICATION'> format=<Format.ONNX: 'ONNX'> family='ResNet' version='v1.5' metadata=Metadata(description='ResNet50 v1.5 int8 ImageNet-1K', publication=Publication(authors=None, title=None, publisher=None, date=None, url='https://arxiv.org/abs/1512.03385.pdf')) tags=None Static fields: ['name', 'task_type', 'format', 'family', 'version', 'metadata', 'tags', 'preprocessor', 'postprocessor'] Lazy loaded fields: ['origin', 'tensor_name_to_range']
In [4]:
Copied!
# You can see the static fields in Command line tool too
! furiosa-models desc ResNet50
# You can see the static fields in Command line tool too
! furiosa-models desc ResNet50
name: ResNet50 format: ONNX family: ResNet version: v1.5 metadata: description: ResNet50 v1.5 int8 ImageNet-1K publication: url: https://arxiv.org/abs/1512.03385.pdf task type: Image Classification available postprocess versions: Python
Actually there's one more hidden field (or, a method)
In [5]:
Copied!
_ = model.model_source(num_pe=2)
_ = model.model_source(num_pe=2)