Download upload.py from hungryzebra/macro: direct link, hf CLI and curl.
- Browser
- Download file 596 Bytes
-
https://huggingface.co/datasets/hungryzebra/macro/resolve/main/upload.py
- Command line
-
hf download hf://datasets/hungryzebra/macro/upload.py
-
curl -L -o upload.py https://huggingface.co/datasets/hungryzebra/macro/resolve/main/upload.py
596 Bytes
| """Module to upload a file into Anyscale for fine-tuning.""" | |
| import argparse | |
| import os | |
| import openai | |
| if __name__ == '__main__': | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("filename", help="Specify the filename to upload") | |
| args = parser.parse_args() | |
| api_key = os.environ.get('ANYSCALE_API_KEY') | |
| client = openai.OpenAI( | |
| base_url="https://api.endpoints.anyscale.com/v1", | |
| api_key=api_key | |
| ) | |
| # Upload file to Anyscale | |
| with open(args.filename, "rb") as f: | |
| file = client.files.create(file=f, purpose="fine-tune") | |
| print(file) | |