HuggingFace镜像/gemma-2b-alpaca-sft
模型介绍文件和版本分析

已上传模型

  • 开发者: venkateshmurugadas
  • 许可证: apache-2.0
  • 微调自模型: google/gemma-2b

该 gemma 模型通过 Unsloth 和 Huggingface 的 TRL 库实现了 2 倍速训练。

修改内容

  • 修改示例并添加 NPU 支持;
  • 修改依赖项;

代码使用(核心部分)

import argparse
import torch
from openmind import pipeline, is_torch_npu_available
from openmind_hub import snapshot_download

if is_torch_npu_available():
  device = "npu:0"
else:
  device = "cpu"
generate_text = pipeline(
  model="SY_AICC/gemma-2b-alpaca-sft",
  torch_dtype=torch.bfloat16, 
  trust_remote_code=True,
  device=device,
)
output = generate_text(
  "Why is drinking water so healthy?",
  max_new_tokens=100
)
  print(output[0]["generated_text"])
下载使用量0