ariG23498 HF Staff commited on
Commit
3d4d9c9
·
verified ·
1 Parent(s): 25fc557

Upload datalab-to_chandra_1.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. datalab-to_chandra_1.py +8 -6
datalab-to_chandra_1.py CHANGED
@@ -11,10 +11,11 @@
11
  # ///
12
 
13
  try:
14
- # Use a pipeline as a high-level helper
15
- from transformers import pipeline
16
 
17
- pipe = pipeline("image-to-text", model="datalab-to/chandra")
 
18
  with open('datalab-to_chandra_1.txt', 'w', encoding='utf-8') as f:
19
  f.write('Everything was good in datalab-to_chandra_1.txt')
20
  except Exception as e:
@@ -29,10 +30,11 @@ except Exception as e:
29
  with open('datalab-to_chandra_1.txt', 'a', encoding='utf-8') as f:
30
  import traceback
31
  f.write('''```CODE:
32
- # Use a pipeline as a high-level helper
33
- from transformers import pipeline
34
 
35
- pipe = pipeline("image-to-text", model="datalab-to/chandra")
 
36
  ```
37
 
38
  ERROR:
 
11
  # ///
12
 
13
  try:
14
+ # Load model directly
15
+ from transformers import AutoProcessor, AutoModelForVision2Seq
16
 
17
+ processor = AutoProcessor.from_pretrained("datalab-to/chandra")
18
+ model = AutoModelForVision2Seq.from_pretrained("datalab-to/chandra")
19
  with open('datalab-to_chandra_1.txt', 'w', encoding='utf-8') as f:
20
  f.write('Everything was good in datalab-to_chandra_1.txt')
21
  except Exception as e:
 
30
  with open('datalab-to_chandra_1.txt', 'a', encoding='utf-8') as f:
31
  import traceback
32
  f.write('''```CODE:
33
+ # Load model directly
34
+ from transformers import AutoProcessor, AutoModelForVision2Seq
35
 
36
+ processor = AutoProcessor.from_pretrained("datalab-to/chandra")
37
+ model = AutoModelForVision2Seq.from_pretrained("datalab-to/chandra")
38
  ```
39
 
40
  ERROR: