-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
Is your feature request related to a problem? Please describe.
When using timm
in commercial context it is very important to use models and weights which also have a viable license. Some models already have it in the config such as
model = timm.create_model("convnextv2_pico", pretrained=False)
print(model.default_cfg['license'])
>> cc-by-nc-4.0
However, now switching to the V1 I get an error
import timm
model = timm.create_model("convnext_pico", pretrained=False)
print(model.default_cfg['license'])
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[6], line 4
1 import timm
3 model = timm.create_model("convnext_pico", pretrained=False)
----> 4 print(model.default_cfg['license'])
KeyError: 'license'
and it is not really clear whether this refers to the model implementation or the weights. Looking in the source code is also ambiguous where it says:
# ConvNeXt
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the MIT license
# ConvNeXt-V2
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree (Attribution-NonCommercial 4.0 International (CC BY-NC 4.0))
# No code was used directly from ConvNeXt-V2, however the weights are CC BY-NC 4.0 so beware if using commercially.
So if no code from the official repo was used, then it should also only fall under the license of timm
. Nonetheless, for me it is more about having the information easily accessible and consistent for each model and any changes to licenses need to be accessible as well, to ensure a previously commercially-viable model does not become an issue if the license becomes GPL or anything else which can become a problem.
Describe the solution you'd like
Instead of having to look into source code and look for every weight config at https://huggingface.co/timm/models it would make sense to make this information easily accessible through default_cfg
with entries model_license
& weights_license
For instance:
import timm
model = timm.create_model("convnextv2_pico", pretrained=True)
model.default_cfg["model_license"], model.default_cfg["weights_license"]
>> "cc-by-nc-4.0", "cc-by-nc-4.0"
or
import timm
model = timm.create_model("convnextv2_pico", pretrained=True)
model.licenses
>> {
"model": "cc-by-nc-4.0",
"weights": "cc-by-nc-4.0",
}
Describe alternatives you've considered
Currently it is just manual work everytime you want to try a new model.
Additional context
None