Downloads · 30 days
11
28% of all-time downloads
yugh/music_ent_classification
music_ent_classification is a text classification model from yugh. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
should probably proofread and complete it, then remove this comment. --
Downloads · 30 days
11
28% of all-time downloads
All-time downloads
39
Public
Parameters
102M
409 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors409 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of hfl/chinese-roberta-wwm-ext on an unknown dataset. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Accuracy |
|---|---|---|---|---|
| 0.4408 | 1.0 | 54 | 0.1763 | 0.9459 |
| 0.1407 | 2.0 | 108 | 0.1221 | 0.9628 |
| 0.0762 | 3.0 | 162 | 0.1123 | 0.9640 |
| 0.0563 | 4.0 | 216 | 0.1226 | 0.9718 |
| 0.0423 | 5.0 | 270 | 0.1230 | 0.9662 |
export WANDB_MODE=disabled # 禁用交互式登录
export CUDA_VISIBLE_DEVICES=0,1,2,3 # 确保识别 4 张 V100
# 变量定义
model="hfl/chinese-roberta-wwm-ext"
transformers_root="transformers"
output_dir="./models/music_ent_classification"
mkdir ${output_dir} -p
# 使用 torchrun 启动
torchrun --nproc_per_node=4 \
${transformers_root}/examples/pytorch/text-classification/run_classification.py \
--model_name_or_path ${model} \
--train_file "./data/*.train.json" \
--validation_file "./data/*.test.json" \
--trust_remote_code True \
--do_train \
--do_eval \
--shuffle_train_dataset \
--metric_name accuracy \
--text_column_name sentence1 \
--label_column_name label \
--max_seq_length 256 \
--per_device_train_batch_size 32 \
--learning_rate 2e-5 \
--num_train_epochs 5 \
--logging_steps 50 \
--save_strategy epoch \
--eval_strategy epoch \
--fp16 True \
--output_dir ${output_dir} \
--overwrite_output_dir
# 启动分布式推理
torchrun --nproc_per_node=$(echo $CUDA_DEVICES | tr ',' '\n' | wc -l) \
transformers/examples/pytorch/text-classification/run_classification.py \
--model_name_or_path "${MODEL_PATH}" \
--train_file "${TRAIN_DATA}" \
--validation_file "${TRAIN_DATA}" \
--test_file "${INPUT_FILE}" \
--text_column_name "sentence1" \
--label_column_name "label" \
--do_predict \
--max_seq_length 128 \
--per_device_eval_batch_size 256 \
--output_dir "${OUTPUT_DIR}" \
--fp16 True \
--trust_remote_code True \
--overwrite_output_dir
if [ $? -eq 0 ]; then
echo "✅ [Infer] 推理完成。"
else
echo "❌ [Infer] 推理失败。"
exit 1
fi