Skip to content

Commit

Permalink
doc: remove tutorial notebook, add model recipe document (#39)
Browse files Browse the repository at this point in the history
* feat: estimator support config output channel value

* fix: ensure the workspace_id is type string

* doc: remove tutorial example

* doc: add model_training_recipe document
  • Loading branch information
pitt-liang authored Aug 22, 2024
1 parent 74d1362 commit 9649fc4
Show file tree
Hide file tree
Showing 36 changed files with 142 additions and 9,321 deletions.
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

0 comments on commit 9649fc4

Please sign in to comment.