Configuring BOS Connector for Pytorch
Updated at:2025-11-03
Configure access credentials
The following 3 methods are supported; completing any one of them is sufficient, and the priority is as follows:
1. Use static configuration file
$ mkdir -p ~/.baidubce/ && vim ~/.baidubce/credentials
Add the following configurations:
Bash
1[Defaults]
2Ak=xxx
3Sk=xxx
Description of specific configuration items
| ConfigMap | Required or not | Description |
|---|---|---|
| Ak | Yes | AccessKey ID of Baidu AI Cloud; |
| Sk | Yes | AccessKey Secret of Baidu AI Cloud; |
| Sts | No | When using STS temporary credentials, both the AccessKey ID and AccessKey Secret should correspond to the temporary credentials. |
Note:
- The default configuration supports user-level isolation. When running bostorchconnector under a certain user, the configuration in the corresponding ~/ path will be used; if a unified configuration is required, the absolute path can be configured in the credentials_path of bos_client_config;
- When using STS temporary credentials, ensure you manage their validity period. Utilizing an expired STS Token will result in a failure to access resources.
2. If you have used the bcecmd tool and the default configuration is in ~/.go-bcecli/credentials, no additional operations are required
$ cat ~/.go-bcecli/credentials
3. Using the temporary environment variable method
Bash
1export BCE_ACCESS_KEY_ID=xxx
2export BCE_SECRET_ACCESS_KEY=xxx
