Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: remove tutorial notebook, add model recipe document #39

Merged
merged 4 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,31 @@ print(res.choices[0].message.content)

```

更多功能介绍,请参阅 [PAI Python SDK文档](https://alipai.readthedocs.io/) 。
- 微调预训练模型

通过PAI提供的微调脚本,提交一个模型微调任务

```python

from pai.model import ModelTrainingRecipe

training_recipe = ModelTrainingRecipe(
model_name="qwen2-0.5b-instruct",
model_provider="pai",
instance_type="ecs.gn6e-c12g1.3xlarge",
)

training_recipe.train(
inputs={
# 本地或是阿里云OSS上的数据路径(oss://<bucketname>/path/to/data)
"train": "<YourTrainingDataPath>"
}
)


```

通过访问PAI提供的示例仓库,可以了解更多使用示例:[pai-examples](https://github.com/aliyun/pai-examples/tree/master/pai-python-sdk)

## 🤝 贡献代码

Expand Down
33 changes: 32 additions & 1 deletion README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,38 @@ print(res.choices[0].message.content)

```

For more details, please refer to the [PAI Python SDK Documentation](https://alipai.readthedocs.io/).
- Fine-tune the pretrained model
-
Submit a model fine-tuning task using the fine-tuning script provided by PAI.

```python

from pai.model import ModelTrainingRecipe

# Retrieve the Qwen2-0.5b-instruct model training recipe provided by PAI
training_recipe = ModelTrainingRecipe(
model_name="qwen2-0.5b-instruct",
model_provider="pai",
instance_type="ecs.gn6e-c12g1.3xlarge",
)

# Submit the training job
job = training_recipe.train(
inputs={
# Data path on local or Alibaba Cloud OSS (oss://<bucketname>/path/to/data)
"train": "<YourTrainingDataPath>"
}
)

# Get output model path
print(training_recipe.model_data())

# Deploy the fine-tuned model
predictor = training_recipe.deploy(service_name="qwen2_finetune")

```

You can learn more usage examples by visiting the PAI example repository: [pai-examples](https://github.com/aliyun/pai-examples/tree/master/pai-python-sdk)

## 🤝 Contributing

Expand Down
10 changes: 0 additions & 10 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ PAI Python SDK 文档
user-guide/processing-job


.. toctree::
:maxdepth: 1
:caption: 示例教程

tutorial/framework
tutorial/train
tutorial/predict
tutorial/advance


.. toctree::
:maxdepth: 1
:caption: Reference
Expand Down
9 changes: 0 additions & 9 deletions docs/source/tutorial/.gitignore

This file was deleted.

10 changes: 0 additions & 10 deletions docs/source/tutorial/advance.rst

This file was deleted.

Loading