THUDM / CodeGeeX2

CodeGeeX2: A More Powerful Multilingual Code Generation Model
https://codegeex.cn
Apache License 2.0
7.6k stars 536 forks source link

用SQL建个表都出不来,问题出在哪呢? #91

Open wa2003 opened 10 months ago

wa2003 commented 10 months ago

代码如下: import torch from modelscope import AutoModel, AutoTokenizer

model_id = 'ZhipuAI/codegeex2-6b' tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) model = AutoModel.from_pretrained(model_id, device_map={'': 'cuda:0'}, # auto torch_dtype=torch.bfloat16, trust_remote_code=True) model = model.eval() prompt = "# language: SQL\n# Can you write SQL queries in PostgreSQL 14 that create a table 'customers' with the columns 'customer_id','username','email','join_date','last_purchase_date'. Include relevant constraints and index \n" inputs = tokenizer.encode(prompt, return_tensors="pt").to(model.device) outputs = model.generate(inputs, max_length=1024) response = tokenizer.decode(outputs[0]) print(response)

输出如下: Loading widget... The attention mask and the pad token id were not set. As a consequence, you may observe unexpected behavior. Please pass your input's attention_mask to obtain reliable results. Setting pad_token_id to eos_token_id:2 for open-end generation.

language: SQL

Can you write SQL queries in PostgreSQL 14 that create a table 'customers' with the columns 'customer_id','username','email','join_date','last_purchase_date'. Include relevant constraints and index

是语句用的不对吗,代码没有出来,求教!

Yang-xiao-zhen commented 7 months ago

Did you solve this problem?