Conversation
|
|
||
| %{ | ||
| pooled_state: pooled_state, | ||
| hidden_states: Axon.container({input, pooled_state}) |
There was a problem hiding this comment.
I'm not sure what to do with hidden_state and hidden_states
There was a problem hiding this comment.
hidden_states is a tuple (effectively a list) of intermediate states between various blocks (see Bumblebee.Vision.ResNet for example). By default we actually prune it and only return if the user configures output_hidden_states: true. We conventionally do it for most models to mirror hf/transformers, but is not a requirement, and it should be fine to not return it.
|
This model isn't part of the transformers library so there's no valid architecture for config.json on huggingface. Thus I'm not sure if it makes sense to include this in Bumblebee or if it should be in a separate library? |
Hey @zacharydenton! Yeah, so far we've only been adding models that are available in hf/transformers, since the main idea is to be able to search on HF Hub and load pretrained models from there in the standardized format. Given that the model implementation is pretty self-contained, a separate library sounds like a valid approach to me. It is also worth looking around if there are some newer models in hf/transformers for this specific task. |
This is a port of https://github.com/timesler/facenet-pytorch/blob/master/models/inception_resnet_v1.py.
I'm using this to generate facenet512 embeddings for face recognition:
I've tested this implementation and compared to the embeddings generated by the facenet-pytorch library. The embeddings match the pytorch implementation with 0.9995 average cosine similarity (with latest Axon - see elixir-nx/axon#622 for details).
n.b. I want to add unit tests but I didn't find any suitable weights in https://huggingface.co/hf-internal-testing - open to advice!