初始化项目,由ModelHub XC社区提供模型
Model: FlameF0X/Qwen2-0.2B-pt Source: Original Platform
This commit is contained in:
43
README.md
Normal file
43
README.md
Normal file
@@ -0,0 +1,43 @@
|
||||
---
|
||||
library_name: transformers
|
||||
license: apache-2.0
|
||||
datasets:
|
||||
- Salesforce/wikitext
|
||||
- roneneldan/TinyStories
|
||||
- FlameF0X/arXiv-AI-ML
|
||||
- Skylion007/openwebtext
|
||||
- flytech/python-codes-25k
|
||||
- bookcorpus/bookcorpus
|
||||
---
|
||||
|
||||
## Model usage
|
||||
|
||||
```py
|
||||
import torch
|
||||
from transformers import AutoTokenizer, AutoModelForCausalLM
|
||||
|
||||
model_path = "FlameF0X/Qwen2-0.2B-pt"
|
||||
|
||||
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
||||
model = AutoModelForCausalLM.from_pretrained(
|
||||
model_path,
|
||||
torch_dtype="auto",
|
||||
device_map="auto",
|
||||
trust_remote_code=True
|
||||
)
|
||||
|
||||
prompt = "The future of Artificial Intelligence is"
|
||||
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
||||
|
||||
output_ids = model.generate(
|
||||
**inputs,
|
||||
max_new_tokens=50,
|
||||
do_sample=True,
|
||||
temperature=0.7,
|
||||
top_p=0.9,
|
||||
repetition_penalty=1.1
|
||||
)
|
||||
|
||||
response = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
||||
print(f"--- Base Model Completion ---\n{response}")
|
||||
```
|
||||
Reference in New Issue
Block a user