File size: 2,568 Bytes
14ebc37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Steel Material Classification Model Upload Guide

## Step 1: Get Hugging Face Token

1. Go to https://huggingface.co/settings/tokens
2. Click "New token"
3. Give it a name (e.g., "model-upload-token")
4. Select "Write" role
5. Copy the token

## Step 2: Login to Hugging Face

```bash

huggingface-cli login

# Enter your token when prompted

```

## Step 3: Create Model Repository

```bash

huggingface-cli repo create steel-material-classifier --type model

```

## Step 4: Upload Model

```bash

# Clone the repository

git clone https://huggingface.co/YOUR_USERNAME/steel-material-classifier

cd steel-material-classifier



# Copy all files from model_v24 directory

# Then commit and push

git add .

git commit -m "Initial commit: Steel material classification model"

git push

```

## Alternative: Direct Upload

```bash

# From the model_v24 directory

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



```python

from transformers import AutoTokenizer, AutoModelForSequenceClassification

import torch



# Load model

model_name = "YOUR_USERNAME/steel-material-classifier"

tokenizer = AutoTokenizer.from_pretrained(model_name)

model = AutoModelForSequenceClassification.from_pretrained(model_name)



# Predict

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})")

```