Steel Material Classification Model Upload Guide
Step 1: Get Hugging Face Token
- Go to https://huggingface.co/settings/tokens
- Click "New token"
- Give it a name (e.g., "model-upload-token")
- Select "Write" role
- Copy the token
Step 2: Login to Hugging Face
huggingface-cli login
Step 3: Create Model Repository
huggingface-cli repo create steel-material-classifier --type model
Step 4: Upload Model
git clone https://huggingface.co/YOUR_USERNAME/steel-material-classifier
cd steel-material-classifier
git add .
git commit -m "Initial commit: Steel material classification model"
git push
Alternative: Direct Upload
huggingface-cli upload YOUR_USERNAME/steel-material-classifier . --include "*.json,*.safetensors,*.pkl,*.md,*.txt,*.py"
Files to Upload
Required Files:
- β
config.json
- β
model.safetensors
- β
tokenizer.json
- β
tokenizer_config.json
- β
special_tokens_map.json
- β
label_mapping.json
Optional Files:
- β
classifier.pkl
- β
label_embeddings.pkl
- β
label_embeddings.pkl.backup
Documentation Files:
- β
README.md
- β
requirements.txt
- β
inference.py
- β
preprocessor.py
- β
model_card.md
- β
usage.md
Model Information
- Model Name: steel-material-classifier
- Base Model: XLM-RoBERTa
- Task: Sequence Classification
- Labels: 66 steel industry materials
- Languages: Korean, English
- Model Size: ~1GB
Usage After Upload
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_name = "YOUR_USERNAME/steel-material-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
text = "μ² κ΄μμ κ³ λ‘μμ νμνμ¬ μ μ² μ μ μ‘°νλ κ³Όμ "
inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = torch.argmax(predictions, dim=1).item()
label = model.config.id2label[predicted_class]
confidence = predictions[0][predicted_class].item()
print(f"Predicted: {label} (Confidence: {confidence:.4f})")