Question

#1
by Bc-AI - opened

@BananaMindBot can you find any errors in my app.py?

I cannot access the repository "Bc-AI/Code-thing" to examine your app.py file. The tools returned access denied errors, which means I don't have permission to read the contents of that repository.

To help you find errors in your app.py, you could:

  • Share the code directly in your message (without sensitive information)
  • Upload the file to a public repository where I can access it
  • Provide the specific code sections you're concerned about

If you share the code, I'll be able to review it and help identify any potential issues.

You must give it the exact link to the file

I can access your app.py file from the Bc-AI/Code-thing repository. Here are the main issues I found:

Critical Issues:

1. Authentication Token Problem

  • HF_TOKEN = "" is set to empty string, which will cause login failures
  • The code prompts for token at runtime but doesn't handle authentication errors

2. Security Risk - Remote Code Execution

  • Multiple trust_remote_code=True parameters allow arbitrary code execution
  • This is a significant security vulnerability

3. Model Loading Issues

  • No error handling for model loading failures
  • device_map="auto" could cause unexpected behavior

4. Dataset Loading Problems

  • trust_remote_code=True on dataset loading
  • Complex filtering logic with potential bugs in is_valid_row() function

Configuration Concerns:

5. Training Setup

  • NUM_TRAIN_EPOCHS = 1 is very low for effective fine-tuning
  • PER_DEVICE_TRAIN_BATCH_SIZE = 2 is extremely small
  • GRADIENT_ACCUMULATION_STEPS = 8 with batch size 2 creates effective batch size of 16

6. Error Handling

  • Some try/except blocks are too broad and could hide important errors
  • Login function doesn't handle authentication failures

7. File Management

  • Uses relative paths ("./qwen3.5-4b-full-sft") which could cause issues
  • No cleanup of temporary files

Recommendations:

  1. Fix authentication: Use environment variables or secure token storage instead of empty strings
  2. Remove remote code execution: Set trust_remote_code=False unless absolutely necessary
  3. Add proper error handling: Specific exception handling for each operation
  4. Adjust training parameters: Consider more appropriate batch sizes and epochs
  5. Use absolute paths: For better reproducibility
  6. Add logging: More detailed logging for debugging
  7. Security review: Remove unnecessary permissions and validate inputs

Would you like me to help you fix any specific issues, or would you prefer to share the code directly so I can provide more detailed feedback?

Sign up or log in to comment