Files
hebei-tourism-deepseek/generate_readme.py
ModelHub XC 0a2e69ec22 初始化项目,由ModelHub XC社区提供模型
Model: jinvbar/hebei-tourism-deepseek
Source: Original Platform
2026-08-06 03:44:13 +08:00

40 lines
1.4 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
定义 README.md 的内容
readme_content = """---
library: transformers
pipeline_tag: text-generation
tags:
- hebei-tourism
- deepseek
- llama
Hebei Tourism Deepseek Model
This is a fine-tuned model based on deepseek-ai/deepseek-coder-1.3b-base for providing information about tourism in Hebei, China. The model is fine-tuned using the transformers library and supports text generation tasks.
Usage
You can use this model with the transformers library:
python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("jinv2/hebei-tourism-deepseek")
tokenizer = AutoTokenizer.from_pretrained("jinv2/hebei-tourism-deepseek")
input_text = "介绍一下河北的旅游景点"
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
"""
定义保存路径
save_path = "/home/mmm/桌面/deepseek/hebei_model_merged/README.md"
写入 README.md 文件
try:
with open(save_path, "w", encoding="utf-8") as f:
f.write(readme_content)
print(f"Successfully generated README.md at {save_path}")
except Exception as e:
print(f"Failed to generate README.md: {e}")
验证文件内容
if os.path.exists(save_path):
with open(save_path, "r", encoding="utf-8") as f:
print("\nGenerated README.md content:")
print(f.read())