Run this model with HF Jobs
Run zai-org/chatglm-6b on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/zai-org/chatglm-6b. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/zai-org/chatglm-6b on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use zai-org/chatglm-6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zai-org/chatglm-6b with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("zai-org/chatglm-6b", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
duzx16 commited on
Commit ·
f82b180
1
Parent(s): fb23542
Fix position ids expand
Browse files679 unmodified lines6806816826836846856863 unmodified lines690691692693694695696679 unmodified linesbatch_size, seq_length = input_ids.shapecontext_lengths = [seq.tolist().index(self.config.bos_token_id) for seq in input_ids]if self.position_encoding_2d:position_ids = torch.arange(seq_length, dtype=torch.long, device=device).expand(batch_size, seq_length)for i, context_length in enumerate(context_lengths):position_ids[i, context_length:] = mask_positions[i]block_position_ids = [torch.cat((3 unmodified linesblock_position_ids = torch.stack(block_position_ids, dim=0)position_ids = torch.stack((position_ids, block_position_ids), dim=1)else:position_ids = torch.arange(seq_length, dtype=torch.long, device=device).expand(batch_size, seq_length)if not gmask:for i, context_length in enumerate(context_lengths):position_ids[context_length:] = mask_positions[i]679 unmodified lines6806816826836846856863 unmodified lines690691692693694695696679 unmodified linesbatch_size, seq_length = input_ids.shapecontext_lengths = [seq.tolist().index(self.config.bos_token_id) for seq in input_ids]if self.position_encoding_2d:position_ids = torch.arange(seq_length, dtype=torch.long, device=device).unsqueeze(0).repeat(batch_size, 1)for i, context_length in enumerate(context_lengths):position_ids[i, context_length:] = mask_positions[i]block_position_ids = [torch.cat((3 unmodified linesblock_position_ids = torch.stack(block_position_ids, dim=0)position_ids = torch.stack((position_ids, block_position_ids), dim=1)else:position_ids = torch.arange(seq_length, dtype=torch.long, device=device).unsqueeze(0).repeat(batch_size, 1)if not gmask:for i, context_length in enumerate(context_lengths):position_ids[context_length:] = mask_positions[i]
modeling_chatglm.py+2-2