You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importtorchfromtransformersimportAutoTokenizer, AutoModelForCausalLMmodel_path="/home/ubuntu/model_test/THUDM/codegen"tokenizer=AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model=AutoModelForCausalLM.from_pretrained(model_path)
prompt="// language: Java\n // Write a class with fields for name, ID, age, address, and company\n"inputs=tokenizer(prompt, return_tensors="pt")
sample=model.generate(**inputs, max_length=128)
print(tokenizer.decode(sample[0]))
output:
// language: Java
// Write a class with fields for name, ID, age, address, and company
// and a constructor that takes the name, ID, age, address, and company as parameters
// and initializes the fields.
//
// Write a method that returns the age of the employee.
//
// Write a method that returns the address of the employee.
//
// Write a method that returns the company of the employee.
//
// Write a method that returns the name of the employee.
//
// Write a method that returns the ID of the employee.
//
The output is comments, not code
output:
// language: Java
// Write a class with fields for name, ID, age, address, and company
// and a constructor that takes the name, ID, age, address, and company as parameters
// and initializes the fields.
//
// Write a method that returns the age of the employee.
//
// Write a method that returns the address of the employee.
//
// Write a method that returns the company of the employee.
//
// Write a method that returns the name of the employee.
//
// Write a method that returns the ID of the employee.
//
model use this
Salesforce/codegen25-7b-mono_P · HF Mirror
https://hf-mirror.com/Salesforce/codegen25-7b-mono_P
The text was updated successfully, but these errors were encountered: