Instructions to use Ramos-Ramos/emb-gam-resnet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Scikit-learn
How to use Ramos-Ramos/emb-gam-resnet with Scikit-learn:
from huggingface_hub import hf_hub_download import joblib model = joblib.load( hf_hub_download("Ramos-Ramos/emb-gam-resnet", "model.pkl") ) # only load pickle files from sources you trust # read more about it here https://skops.readthedocs.io/en/stable/persistence.html - Notebooks
- Google Colab
- Kaggle
Commit ·
82be63b
1
Parent(s): 617c3e2
Update README.md
Browse files
README.md
CHANGED
|
@@ -99,7 +99,7 @@ inputs = {k: v.to(device) for k, v in feature_extractor(img, return_tensors='pt'
|
|
| 99 |
|
| 100 |
# extract patch embeddings
|
| 101 |
with torch.no_grad():
|
| 102 |
-
patch_embeddings =
|
| 103 |
|
| 104 |
# classify
|
| 105 |
pred = logistic_regression.predict(patch_embeddings.sum(dim=0, keepdim=True))
|
|
|
|
| 99 |
|
| 100 |
# extract patch embeddings
|
| 101 |
with torch.no_grad():
|
| 102 |
+
patch_embeddings = model(**inputs).last_hidden_state[0].permute(1, 2, 0).view(7*7, 2048).cpu()
|
| 103 |
|
| 104 |
# classify
|
| 105 |
pred = logistic_regression.predict(patch_embeddings.sum(dim=0, keepdim=True))
|