Instructions to use recursionpharma/OpenPhenom with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use recursionpharma/OpenPhenom with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="recursionpharma/OpenPhenom", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("recursionpharma/OpenPhenom", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
| import pytest | |
| import torch | |
| # huggingface_openphenom_model_dir = "." | |
| huggingface_modelpath = "recursionpharma/OpenPhenom" | |
| from .huggingface_mae import MAEModel | |
| def huggingface_model(): | |
| # This step downloads the model to a local cache, takes a bit to run | |
| huggingface_model = MAEModel.from_pretrained(huggingface_modelpath) | |
| huggingface_model.eval() | |
| return huggingface_model | |
| def test_model_predict(huggingface_model, C, return_channelwise_embeddings): | |
| example_input_array = torch.randint( | |
| low=0, | |
| high=255, | |
| size=(2, C, 256, 256), | |
| dtype=torch.uint8, | |
| device=huggingface_model.device, | |
| ) | |
| huggingface_model.return_channelwise_embeddings = return_channelwise_embeddings | |
| embeddings = huggingface_model.predict(example_input_array) | |
| expected_output_dim = 384 * C if return_channelwise_embeddings else 384 | |
| assert embeddings.shape == (2, expected_output_dim) | |