Instructions to use zai-org/glm-2b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/glm-2b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="zai-org/glm-2b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("zai-org/glm-2b", trust_remote_code=True) model = AutoModel.from_pretrained("zai-org/glm-2b", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
Fine-tuning question
#1
by Isotonic - opened
should i use DataCollatorForPermutationLanguageModeling when trying to finetune this model?
Is the finetuning process similar to XLnet with sMASK and gMASK added
or
Do we have to use AutoModelForSeq2SeqLM (below code is from the glm repo)
inputs = tokenizer(
["Tsinghua University is located in [MASK].", "One minus one equals zero, is it correct? Answer: [MASK]"],
return_tensors="pt", padding=True)
inputs = tokenizer.build_inputs_for_generation(inputs, targets=["Beijing", "No"], max_gen_length=8, padding=False)
inputs = inputs.to('cuda')
outputs = model(**inputs)
loss = outputs.loss
logits = outputs.logits```
Do you have any open-ended generation finetuning setup?