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

Create data from remote api. #102

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

PoTaTo-Mika
Copy link

This pull request built a python script which uses DeepSeek R1 API to solve math problems, then it will build a json file for further training and so on.
As inferring the full R1 is unaffordable for most developers (at least 8*H200), I made this part to reduce the cost, so more and more people can make contribution to this landmark project.
I know my code is very rudimentary, so I hope more people can join in, add more and better features to it, and make it more stable at the same time!

Copy link

@vins2win vins2win left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is better to avoid hard coding of API keys :

instead of
client = OpenAI(api_key="Your Deepseek API", base_url="https://api.deepseek.com")

use


api_key = os.getenv("DEEPOSEEK_API_KEY")
client = OpenAI(api_key=api_key, base_url="https://api.deepseek.com")

add exception handling :

example :

with open(math_problems, "r") as file: math_problems = file.readlines()

to

try: with open(math_problems, "r") as file: math_problems = file.readlines() except FileNotFoundError: print(f"File {math_problems} not found.") exit(1)

@PoTaTo-Mika
Copy link
Author

it is better to avoid hard coding of API keys :

instead of client = OpenAI(api_key="Your Deepseek API", base_url="https://api.deepseek.com")

use


api_key = os.getenv("DEEPOSEEK_API_KEY")
client = OpenAI(api_key=api_key, base_url="https://api.deepseek.com")

add exception handling :

example :

with open(math_problems, "r") as file: math_problems = file.readlines()

to

try: with open(math_problems, "r") as file: math_problems = file.readlines() except FileNotFoundError: print(f"File {math_problems} not found.") exit(1)

Thanks, I've changed my code to make it eazier to manage the api key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants