IC4T commited on
Commit
2f5c466
1 Parent(s): 4aa221b
Files changed (2) hide show
  1. requirements.txt +1 -0
  2. training/generate.py +10 -5
requirements.txt CHANGED
@@ -13,3 +13,4 @@ torch==2.0.0
13
  transformers @ git+https://github.com/huggingface/transformers@ef42c2c487260c2a0111fa9d17f2507d84ddedea
14
  unstructured==0.6.2
15
  xformers==0.0.19
 
 
13
  transformers @ git+https://github.com/huggingface/transformers@ef42c2c487260c2a0111fa9d17f2507d84ddedea
14
  unstructured==0.6.2
15
  xformers==0.0.19
16
+ ctransformers
training/generate.py CHANGED
@@ -1,10 +1,11 @@
1
  import logging
2
  import re
3
  from typing import List, Tuple
 
4
 
5
  import numpy as np
6
  from transformers import (
7
- AutoModelForCausalLM,
8
  AutoTokenizer,
9
  Pipeline,
10
  PreTrainedModel,
@@ -32,10 +33,14 @@ def load_model_tokenizer_for_generate(
32
  Returns:
33
  Tuple[PreTrainedModel, PreTrainedTokenizer]: model and tokenizer
34
  """
35
- tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path, padding_side="left", cache_dir="/media/siiva/DataStore/LLMs/cache/dollyV2")
36
- model = AutoModelForCausalLM.from_pretrained(
37
- pretrained_model_name_or_path, device_map="auto", trust_remote_code=True, cache_dir="/media/siiva/DataStore/LLMs/cache/dollyV2"
38
- )
 
 
 
 
39
  return model, tokenizer
40
 
41
 
 
1
  import logging
2
  import re
3
  from typing import List, Tuple
4
+ from ctransformers import AutoModelForCausalLM
5
 
6
  import numpy as np
7
  from transformers import (
8
+ # AutoModelForCausalLM,
9
  AutoTokenizer,
10
  Pipeline,
11
  PreTrainedModel,
 
33
  Returns:
34
  Tuple[PreTrainedModel, PreTrainedTokenizer]: model and tokenizer
35
  """
36
+ # tokenizer = AutoTokenizer.from_pretrained(pretrained_model_name_or_path, padding_side="left")#, cache_dir="/media/siiva/DataStore/LLMs/cache/dollyV2")
37
+ # model = AutoModelForCausalLM.from_pretrained(
38
+ # pretrained_model_name_or_path, device_map="auto", trust_remote_code=True)#, cache_dir="/media/siiva/DataStore/LLMs/cache/dollyV2"
39
+ #)
40
+ tokenizer = AutoTokenizer.from_pretrained('dolly-v2')
41
+
42
+ model = AutoModelForCausalLM.from_pretrained(pretrained_model_name_or_path, model_type='dolly-v2')
43
+
44
  return model, tokenizer
45
 
46