ariG23498 HF Staff commited on
Commit
f05c34b
·
verified ·
1 Parent(s): 4d1738b

Upload ByteDance-Seed_Stable-DiffCoder-8B-Instruct_1.txt with huggingface_hub

Browse files
ByteDance-Seed_Stable-DiffCoder-8B-Instruct_1.txt ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ```CODE:
2
+ # Load model directly
3
+ from transformers import AutoTokenizer, AutoModelForCausalLM
4
+
5
+ tokenizer = AutoTokenizer.from_pretrained("ByteDance-Seed/Stable-DiffCoder-8B-Instruct", trust_remote_code=True)
6
+ model = AutoModelForCausalLM.from_pretrained("ByteDance-Seed/Stable-DiffCoder-8B-Instruct", trust_remote_code=True)
7
+ messages = [
8
+ {"role": "user", "content": "Who are you?"},
9
+ ]
10
+ inputs = tokenizer.apply_chat_template(
11
+ messages,
12
+ add_generation_prompt=True,
13
+ tokenize=True,
14
+ return_dict=True,
15
+ return_tensors="pt",
16
+ ).to(model.device)
17
+
18
+ outputs = model.generate(**inputs, max_new_tokens=40)
19
+ print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))
20
+ ```
21
+
22
+ ERROR:
23
+ Traceback (most recent call last):
24
+ File "/tmp/ByteDance-Seed_Stable-DiffCoder-8B-Instruct_1qMhcVJ.py", line 39, in <module>
25
+ outputs = model.generate(**inputs, max_new_tokens=40)
26
+ File "/tmp/.cache/uv/environments-v2/d3eb16abd23c0167/lib/python3.13/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
27
+ return func(*args, **kwargs)
28
+ File "/tmp/.cache/huggingface/modules/transformers_modules/ByteDance_hyphen_Seed/Stable_hyphen_DiffCoder_hyphen_8B_hyphen_Instruct/d0808fa34fa03de9163a29cabfc7107294a535a8/modeling_seed_diffcoder.py", line 24, in generate
29
+ output_ids, nfe = generate_block(
30
+ ~~~~~~~~~~~~~~^
31
+ model=self,
32
+ ^^^^^^^^^^^
33
+ prompt=prompt,
34
+ ^^^^^^^^^^^^^^
35
+ **kwargs,
36
+ ^^^^^^^^^
37
+ )
38
+ ^
39
+ File "/tmp/.cache/uv/environments-v2/d3eb16abd23c0167/lib/python3.13/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
40
+ return func(*args, **kwargs)
41
+ TypeError: generate_block() got an unexpected keyword argument 'attention_mask'