许可证:apache-2.0
标签:
- generated_from_keras_callback
模型索引:
- 名称:kasrahabib/KM35NCDF
结果:[]
小部件:
- 文本:"应用需要跟踪任务中的子任务。"
示例标题:"需求1"
- 文本:"系统应允许用户以多种不同格式输入时间。"
示例标题:"需求2"
- 文本:"系统应允许持有ORES/ORELSE/PROVIDER任一密钥的用户被视为临床用户,并拥有所有问题列表选项的完全访问权限。"
示例标题:"需求3"
kasrahabib/KM35NCDF
该模型是基于sentence-transformers/all-MiniLM-L6-v2在软件需求数据集(SWARD)上微调的版本,用于分类19种非功能性需求。需注意,根据文献,19类中的两类(数据和行为)属于功能性软件需求的类型。在评估集上达到以下结果:
- 训练损失:0.1691
- 验证损失:0.7548
- 训练轮次:14
- 最终宏F1分数:0.79
标签:
0或A -> 可用性;
1或AC -> 访问控制;
2或AU -> 审计;
3或B -> 行为;
4或D -> 数据;
5或FT -> 容错性;
6或I -> 接口/互操作性;
7或LE -> 法律;
8或LF -> 外观;
9或MN -> 可维护性;
10或O -> 操作性;
11或PE -> 性能;
12或PO -> 可移植性;
13或RL -> 可靠性;
14或SA -> 安全性;
15或SC -> 可扩展性;
16或SE -> 安全;
17或ST -> 稳定性;
18或US -> 可用性;
使用流程
from transformers import pipeline
frame_work = 'tf'
task = 'text-classification'
model_ckpt = 'kasrahabib/KM35NCDF'
software_requirment_cls = pipeline(task=task, model=model_ckpt, framework=frame_work)
example_1_US = '应用需要跟踪任务中的子任务。'
example_2_PE = '系统应允许用户以多种不同格式输入时间。'
example_3_AC = '系统应允许持有ORES/ORELSE/PROVIDER任一密钥的用户被视为临床用户,并拥有所有问题列表选项的完全访问权限。'
software_requirment_cls([example_1_US, example_2_PE, example_3_AC])
[{'label': 'US', 'score': 0.9712953567504883},
{'label': 'PE', 'score': 0.9457865953445435},
{'label': 'AC', 'score': 0.9639136791229248}]
模型推理:
import numpy as np
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
model_ckpt = 'kasrahabib/KM35NCDF'
tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
model = TFAutoModelForSequenceClassification.from_pretrained(model_ckpt)
example_1_US = '应用需要跟踪任务中的子任务。'
example_2_PE = '系统应允许用户以多种不同格式输入时间。'
example_3_AC = '系统应允许持有ORES/ORELSE/PROVIDER任一密钥的用户被视为临床用户,并拥有所有问题列表选项的完全访问权限。'
requirements = [example_1_US, example_2_PE, example_3_AC]
encoded_requirements = tokenizer(requirements, return_tensors='np', padding='longest')
y_pred = model(encoded_requirements).logits
classifications = np.argmax(y_pred, axis=1)
classifications = [model.config.id2label[output] for output in classifications]
print(classifications)
['US', 'PE', 'AC']
本地下载使用(如GitHub):
1 - 克隆仓库:
git lfs install
git clone 仓库地址
2 - 定位下载目录路径
3 - 将路径链接写入model_ckpt
变量
然后修改代码如下:
import numpy as np
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
model_ckpt = '路径其余部分/KM35NCDF'
tokenizer = AutoTokenizer.from_pretrained(model_ckpt)
model = TFAutoModelForSequenceClassification.from_pretrained(model_ckpt)
example_1_US = '应用需要跟踪任务中的子任务。'
example_2_PE = '系统应允许用户以多种不同格式输入时间。'
example_3_AC = '系统应允许持有ORES/ORELSE/PROVIDER任一密钥的用户被视为临床用户,并拥有所有问题列表选项的完全访问权限。'
requirements = [example_1_US, example_2_PE, example_3_AC]
encoded_requirements = tokenizer(requirements, return_tensors='np', padding='longest')
y_pred = model(encoded_requirements).logits
classifications = np.argmax(y_pred, axis=1)
classifications = [model.config.id2label[output] for output in classifications]
print(classifications)
训练超参数
训练时使用以下超参数:
- 优化器:{'name': 'Adam', 'weight_decay': None, 'clipnorm': None, 'global_clipnorm': None, 'clipvalue': None, 'use_ema': False, 'ema_momentum': 0.99, 'ema_overwrite_frequency': None, 'jit_compile': True, 'is_legacy_optimizer': False, 'learning_rate': {'class_name': 'PolynomialDecay', 'config': {'initial_learning_rate': 2e-05, 'decay_steps': 6735, 'end_learning_rate': 0.0, 'power': 1.0, 'cycle': False, 'name': None}}, 'beta_1': 0.9, 'beta_2': 0.999, 'epsilon': 1e-08, 'amsgrad': False}
- 训练精度:float32
框架版本
- Transformers 4.26.1
- TensorFlow 2.11.0
- Datasets 2.10.0
- Tokenizers 0.13.2