Run this model with HF Jobs
Run Berketarak/Product-Matching-Classifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Berketarak/Product-Matching-Classifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Berketarak/Product-Matching-Classifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Berketarak/Product-Matching-Classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Berketarak/Product-Matching-Classifier with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Berketarak/Product-Matching-Classifier") model = AutoModel.from_pretrained("Berketarak/Product-Matching-Classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Upload model.py with huggingface_hub
Browse files12345678910111213141516171819202122232425262728293031323334353637class CustomBertModel(BertPreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.bert = BertModel(config)
# Freeze first 6 layers
for param in self.bert.encoder.layer[:6].parameters():
param.requires_grad = False
self.dropout = nn.Dropout(0.22)
self.fc1 = nn.Linear(768, 512)
self.relu1 = nn.ReLU()
self.fc2 = nn.Linear(512, 512)
self.relu2 = nn.ReLU()
self.fc3 = nn.Linear(512, 128)
self.relu3 = nn.ReLU()
self.fc4 = nn.Linear(128, 1)
self.sigmoid = nn.Sigmoid()
self.init_weights()
def forward(self, input_ids, attention_mask=None, token_type_ids=None):
outputs = self.bert(
input_ids,
attention_mask=attention_mask,
token_type_ids=token_type_ids,
)
pooled_output = outputs.pooler_output
x = self.dropout(pooled_output)
x = self.fc1(x)
x = self.relu1(x)
x = self.fc2(x)
x = self.relu2(x)
x = self.fc3(x)
x = self.relu3(x)
x = self.fc4(x)
logits = self.sigmoid(x)
return logitsmodel.pyAdded+37