Download finetune.py from hungryzebra/macro: direct link, hf CLI and curl.
- Browser
- Download file 569 Bytes
-
https://huggingface.co/datasets/hungryzebra/macro/resolve/main/finetune.py
- Command line
-
hf download hf://datasets/hungryzebra/macro/finetune.py
-
curl -L -o finetune.py https://huggingface.co/datasets/hungryzebra/macro/resolve/main/finetune.py
569 Bytes
| """Module to finetune a model in AnyScale.""" | |
| import argparse | |
| import os | |
| import openai | |
| if __name__ == '__main__': | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("file_id", help="Specify the AnyScale file ID") | |
| 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 | |
| ) | |
| job = client.fine_tuning.jobs.create( | |
| model="meta-llama/Llama-2-7b-chat-hf", | |
| training_file=args.file_id, | |
| ) | |
| print(job) |