Zeel commited on
Commit
7145796
·
1 Parent(s): e685da5

try hacking unsloth for cpu only

Browse files
Files changed (2) hide show
  1. app.py +5 -0
  2. scratchpad.ipynb +22 -0
app.py CHANGED
@@ -1,5 +1,10 @@
1
  import streamlit as st
2
  from transformers import AutoProcessor
 
 
 
 
 
3
  from unsloth.chat_templates import get_chat_template, CHAT_TEMPLATES
4
  from unsloth_zoo.dataset_utils import train_on_responses_only
5
 
 
1
  import streamlit as st
2
  from transformers import AutoProcessor
3
+
4
+ import torch
5
+ # Hack unsloth to work without GPU
6
+ torch.is_cuda_available = lambda: False
7
+
8
  from unsloth.chat_templates import get_chat_template, CHAT_TEMPLATES
9
  from unsloth_zoo.dataset_utils import train_on_responses_only
10
 
scratchpad.ipynb CHANGED
@@ -260,6 +260,28 @@
260
  "CHAT_TEMPLATES.keys()"
261
  ]
262
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  {
264
  "cell_type": "code",
265
  "execution_count": 95,
 
260
  "CHAT_TEMPLATES.keys()"
261
  ]
262
  },
263
+ {
264
+ "cell_type": "code",
265
+ "execution_count": 100,
266
+ "metadata": {},
267
+ "outputs": [
268
+ {
269
+ "data": {
270
+ "text/plain": [
271
+ "False"
272
+ ]
273
+ },
274
+ "execution_count": 100,
275
+ "metadata": {},
276
+ "output_type": "execute_result"
277
+ }
278
+ ],
279
+ "source": [
280
+ "import torch\n",
281
+ "torch.cuda.is_available = lambda: False\n",
282
+ "torch.cuda.is_available()"
283
+ ]
284
+ },
285
  {
286
  "cell_type": "code",
287
  "execution_count": 95,