Text Classification
Transformers
Safetensors
English
hs6_classifier
feature-extraction
hs-code
hs6
harmonized-system
hts
tariff
tariff-classification
customs
customs-clearance
trade-compliance
import-export
international-trade
logistics
supply-chain
ecommerce
product-classification
product-categorization
multi-class-classification
english
xlm-roberta
bge-m3
custom_code
Instructions to use Kenpache/hs-code-classifier-en with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kenpache/hs-code-classifier-en with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Kenpache/hs-code-classifier-en", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Kenpache/hs-code-classifier-en", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
| """Configuration for the HS6 product classifier. | |
| Subclasses XLMRobertaConfig, so every encoder field (hidden_size, num_hidden_layers, | |
| ...) keeps its usual name and meaning. Only the classification head and the label | |
| spaces for the coarser HS levels are added on top. | |
| """ | |
| from transformers.models.xlm_roberta.configuration_xlm_roberta import XLMRobertaConfig | |
| class HS6ClassifierConfig(XLMRobertaConfig): | |
| model_type = "hs6_classifier" | |
| def __init__( | |
| self, | |
| n2: int = 97, | |
| n4: int = 1266, | |
| n6: int = 6750, | |
| head_dropout: float = 0.15, | |
| pooling: str = "cls", | |
| recommended_max_length: int = 1024, | |
| id2hs4=None, | |
| id2hs2=None, | |
| **kwargs, | |
| ): | |
| super().__init__(**kwargs) | |
| self.n2 = n2 | |
| self.n4 = n4 | |
| self.n6 = n6 | |
| self.head_dropout = head_dropout | |
| self.pooling = pooling | |
| # Training used 512 tokens; inference at 1024 is free (the encoder has 8194 | |
| # positions) and worth +2.91 points on texts longer than 1500 characters. | |
| self.recommended_max_length = recommended_max_length | |
| # HS4 / HS2 code strings, indexed by class id. Used to name the marginal logits. | |
| self.id2hs4 = id2hs4 or [] | |
| self.id2hs2 = id2hs2 or [] | |