Skip to content

Conversation

@swap357
Copy link

@swap357 swap357 commented Apr 5, 2023

This pull request introduces the --use_cpu option to the main script, allowing users to run training and inference on the CPU. The --use_cpu option can be specified when running the script to enable CPU usage. By default, the script will use the GPU (if available).

Changes:

  • Added an argument parser for the --use_cpu option to specify CPU usage for training and inference.
  • Updated the load_base_model function to adjust load_in_8bit, torch_dtype, and device_map based on the use_cpu argument.
  • Modified the TrainingArguments to set fp16 based on the use_cpu argument.
  • Removed the .cuda() call from the generate_text function when using the CPU.

This update provides flexibility for users who want to run the script on systems without a GPU. The option to use the CPU can be helpful for testing, debugging, and using the script on machines with limited GPU resources.

@lxe
Copy link
Owner

lxe commented Apr 11, 2023

Since I refactored the whole thing, you might need to adjust it a bit. Sorry

@Alex-Pavlyuk
Copy link

The most expected pull request for now) to be able to work with llm on laptops

@swap357
Copy link
Author

swap357 commented Jun 14, 2023

I went through the latest code and seems like the updated code already takes care of running on cpu if cuda is unavailable. I believe the trainer should work out of the box on cpu now.

here: config.py -
HAS_CUDA = torch.cuda.is_available()
DEVICE = torch.device('cuda' if HAS_CUDA else 'cpu')

Let me know if otherwise.

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.

3 participants