repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/components/robot/dynamixel_client_test.py | robel/components/robot/dynamixel_client_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/components/robot/robot_test.py | robel/components/robot/robot_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/components/robot/builder.py | robel/components/robot/builder.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/components/robot/hardware_robot_test.py | robel/components/robot/hardware_robot_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/components/robot/group_config_test.py | robel/components/robot/group_config_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/reset_procedure.py | robel/utils/reset_procedure.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/plotting.py | robel/utils/plotting.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/registration.py | robel/utils/registration.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/configurable_test.py | robel/utils/configurable_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/math_utils_test.py | robel/utils/math_utils_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/resources.py | robel/utils/resources.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/math_utils.py | robel/utils/math_utils.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/__init__.py | robel/utils/__init__.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/resources_test.py | robel/utils/resources_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/configurable.py | robel/utils/configurable.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/testing/mock_time.py | robel/utils/testing/mock_time.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/testing/mock_dynamixel_sdk.py | robel/utils/testing/mock_dynamixel_sdk.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/testing/mock_sim_scene.py | robel/utils/testing/mock_sim_scene.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/testing/mock_sim_scene_test.py | robel/utils/testing/mock_sim_scene_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/testing/mock_dynamixel_sdk_test.py | robel/utils/testing/mock_dynamixel_sdk_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/utils/testing/__init__.py | robel/utils/testing/__init__.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/screw_test.py | robel/dclaw/screw_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/turn.py | robel/dclaw/turn.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/turn_test.py | robel/dclaw/turn_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/screw.py | robel/dclaw/screw.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/pose_test.py | robel/dclaw/pose_test.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/scripted_reset.py | robel/dclaw/scripted_reset.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/base_env.py | robel/dclaw/base_env.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/__init__.py | robel/dclaw/__init__.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
google-research/robel | https://github.com/google-research/robel/blob/5b0fd3704629931712c6e0f7268ace1c2154dc83/robel/dclaw/pose.py | robel/dclaw/pose.py | # Copyright 2019 The ROBEL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | python | Apache-2.0 | 5b0fd3704629931712c6e0f7268ace1c2154dc83 | 2026-01-05T07:14:22.487637Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/eval_data/machine_eval/machine_metrics.py | eval_data/machine_eval/machine_metrics.py | '''
Author: anon
Date: 2022-01-27 11:39:10
LastEditors: anon
LastEditTime: 2022-02-11 17:47:14
FilePath: /crosstalk-generation/src/gpt/metrics.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
from statistics import mean
from nltk import word_tokenize
from nltk.translate.bleu_score import... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/eval_data/human_eval/human_metrics.py | eval_data/human_eval/human_metrics.py | import os,sys,io,json
import pandas as pd
this_dir = os.path.split(os.path.realpath(__file__))[0]
mode_ref_dict = {
1: "真实数据",
2:"rnn",
3:"GPT",
4:"unilm",
5:"zhouwenwang",
6:"T5",
7:"GPT3",
8:"GPT3-finetune",
9:"CPM",
10:"PANGU-a"
}
def get_score_map():
human_eval_sco... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/zhouwenwang/inference.py | src/zhouwenwang/inference.py |
import os,sys
sys.path.append('/data1/anon/crosstalk-generation/src/zhouwenwang/Fengshenbang-LM')
from fengshen import RoFormerModel
from fengshen import RoFormerConfig
from transformers import BertTokenizer
import torch
import numpy as np
max_length = 32
tokenizer = BertTokenizer.from_pretrained("/data1/ano... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/zhouwenwang/generate_eval_data.py | src/zhouwenwang/generate_eval_data.py | '''
Author: anon
Date: 2022-02-08 16:12:50
LastEditors: anon
LastEditTime: 2022-02-09 16:07:19
FilePath: /crosstalk-generation/src/gpt/generate_eval_data.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
import transformers
import torch
import os
import json
import random
import numpy a... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/wenzhong/inference.py | src/wenzhong/inference.py | from transformers import GPT2Tokenizer, GPT2Model
from transformers import pipeline, set_seed
# tokenizer = GPT2Tokenizer.from_pretrained('/data1/anon/crosstalk-generation/pretrain_model/wenzhong')
# model = GPT2Model.from_pretrained('/data1/anon/crosstalk-generation/pretrain_model/wenzhong')
text = "给大家拜个年."
generator... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/wenzhong/generate_eval_data.py | src/wenzhong/generate_eval_data.py | '''
Author: anon
Date: 2022-02-08 16:12:50
LastEditors: anon
LastEditTime: 2022-02-09 16:07:19
FilePath: /crosstalk-generation/src/gpt/generate_eval_data.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
import transformers
import torch
import os
import json
import random
import numpy a... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/pangu-a/inference.py | src/pangu-a/inference.py | '''
Author: anon
Date: 2022-02-07 20:18:18
LastEditors: anon
LastEditTime: 2022-02-10 16:09:11
FilePath: /crosstalk-generation/src/cpm/inference.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
from transformers import TextGenerationPipeline, AutoTokenizer, AutoModelForCausalLM
toke... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/pangu-a/configuration_gptpangu.py | src/pangu-a/configuration_gptpangu.py | from transformers.configuration_utils import PretrainedConfig
class GPTPanguConfig(PretrainedConfig):
model_type = "gpt_pangu"
keys_to_ignore_at_inference = ["past_key_values"]
def __init__(
self,
vocab_size=40000,
max_position_embeddings=1024,
hidden_size=2560,
in... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/pangu-a/modeling_gptpangu.py | src/pangu-a/modeling_gptpangu.py | """PyTorch PanguAlpha GPT2 Model"""
# from .configuration_gptpangu import GPTPanguConfig
from typing import Tuple
import math
import torch
from torch import nn
from transformers.activations import ACT2FN
from transformers.modeling_utils import PreTrainedModel
from transformers.modeling_outputs import BaseModelOutput... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/pangu-a/generate_eval_data.py | src/pangu-a/generate_eval_data.py | '''
Author: anon
Date: 2022-02-08 16:12:50
LastEditors: anon
LastEditTime: 2022-02-10 17:07:36
FilePath: /crosstalk-generation/src/cpm/generate_eval_data.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
import transformers
import torch
import os
import json
import random
import numpy a... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/pangu-a/dataset.py | src/pangu-a/dataset.py | from torch.utils.data import Dataset
import torch
class MyDataset(Dataset):
"""
"""
def __init__(self, input_list, max_len):
self.input_list = input_list
self.max_len = max_len
def __getitem__(self, index):
input_ids = self.input_list[index]
input_ids = input_ids[:se... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/pangu-a/tokenization_gptpangu.py | src/pangu-a/tokenization_gptpangu.py | from transformers.tokenization_utils import PreTrainedTokenizer
import torch
import sentencepiece
import jieba
class GPTPanguTokenizer(PreTrainedTokenizer):
# Ref: https://git.openi.org.cn/PCL-Platform.Intelligence/PanGu-Alpha/src/branch/master/tokenization_jieba.py
vocab_files_names = {
"model_file"... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/interact.py | src/gpt/interact.py | import transformers
import torch
import os
import json
import random
import numpy as np
import argparse
from torch.utils.tensorboard import SummaryWriter
from datetime import datetime
from tqdm import tqdm
from torch.nn import DataParallel
import logging
from transformers import GPT2TokenizerFast, GPT2LMHeadModel, GPT2... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/pytorchtools.py | src/gpt/pytorchtools.py | import numpy as np
import torch
from os.path import join
import os
class EarlyStopping:
"""Early stops the training if validation loss doesn't improve after a given patience."""
def __init__(self, patience=7, verbose=False, delta=0, save_path="."):
"""
Args:
patience (int): How long... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/metrics.py | src/gpt/metrics.py | '''
Author: anon
Date: 2022-01-27 11:39:10
LastEditors: anon
LastEditTime: 2022-02-08 17:28:13
FilePath: /crosstalk-generation/src/gpt/metrics.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
from statistics import mean
from nltk import word_tokenize
from nltk.translate.bleu_score impo... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/train.py | src/gpt/train.py | import argparse
from lib2to3.pgen2 import token
import math
import time
from urllib import response
import torch
import torch.nn.functional as F
import torch.optim as optim
import logging
from datetime import datetime
import os
from torch.utils.data import Dataset, DataLoader
from os.path import join, exists
from torch... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/draw_loss.py | src/gpt/draw_loss.py | import numpy as np
import matplotlib.pyplot as plt
train_loss = [44.48271321031384, 6.583550890944058, 5.2243800984289415, 4.793724752727308, 4.509950302328382, 4.293438681534359, 4.118832167109153, 3.9655399139662433, 3.8359335477190806, 3.7205823993324336, 3.6183518121117038, 3.529470994508356, 3.454126060367527, 3... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/generate_dialogue_subset.py | src/gpt/generate_dialogue_subset.py | import argparse
from os.path import join
import numpy as np
from collections import Counter
import matplotlib.pyplot as plt
from matplotlib.pyplot import MultipleLocator
def generate_subset():
"""
用于生成训练子集
:return:
"""
parser = argparse.ArgumentParser()
parser.add_argument('--raw_data_path', d... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/data_parallel.py | src/gpt/data_parallel.py | from torch.nn.parallel import DataParallel
import torch
from torch.nn.parallel._functions import Scatter
from torch.nn.parallel.parallel_apply import parallel_apply
def scatter(inputs, target_gpus, chunk_sizes, dim=0):
r"""
Slices tensors into approximately equal chunks and
distributes them across given G... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/generate_testdatasets.py | src/gpt/generate_testdatasets.py | import transformers
import torch
import os
import json
import random
import numpy as np
import argparse
from torch.utils.tensorboard import SummaryWriter
from datetime import datetime
from tqdm import tqdm
from torch.nn import DataParallel
import logging
from transformers import GPT2TokenizerFast, GPT2LMHeadModel, GPT2... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/generate_eval_data.py | src/gpt/generate_eval_data.py | '''
Author: anon
Date: 2022-02-08 16:12:50
LastEditors: anon
LastEditTime: 2022-02-09 16:07:19
FilePath: /crosstalk-generation/src/gpt/generate_eval_data.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
import transformers
import torch
import os
import json
import random
import numpy a... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/dataset.py | src/gpt/dataset.py | from torch.utils.data import Dataset
import torch
class MyDataset(Dataset):
"""
"""
def __init__(self, input_list, max_len):
self.input_list = input_list
self.max_len = max_len
def __getitem__(self, index):
input_ids = self.input_list[index]
input_ids = input_ids[:se... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/__init__.py | src/gpt/__init__.py | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false | |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/preprocess.py | src/gpt/preprocess.py | from tokenizers import BertWordPieceTokenizer
from transformers import BertTokenizer
from transformers import BertTokenizerFast
import argparse
import pandas as pd
import pickle,os
import jieba.analyse
from tqdm import tqdm
from transformers import GPT2TokenizerFast, GPT2LMHeadModel
import logging
import numpy as np
... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/gpt/another_way_rouge.py | src/gpt/another_way_rouge.py | from statistics import mean
from nltk import word_tokenize
from nltk.translate.bleu_score import corpus_bleu
from nltk.translate.gleu_score import corpus_gleu
from nltk.translate.meteor_score import meteor_score
from nltk.translate.bleu_score import SmoothingFunction
from rouge import Rouge
from sumeval.metrics.roug... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/statistic_t5_results.py | src/t5/statistic_t5_results.py | import argparse
import os,io,json
import pandas as pd
from generate_eval_data import get_machine_metric_datas
from metrics import cal_metrics
from t5_tokenizer import T5PegasusTokenizer
from transformers import MT5ForConditionalGeneration, T5Tokenizer
base_path = '/data1/anon/crosstalk-generation/trained_model_dir/t5-... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/pytorchtools.py | src/t5/pytorchtools.py | '''
Author: anon
Date: 2022-02-07 11:07:16
LastEditors: anon
LastEditTime: 2022-02-07 11:07:16
FilePath: /crosstalk-generation/src/gpt/pytorchtools.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
import numpy as np
import torch
from os.path import join
import os
class EarlyStopping:
... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/metrics.py | src/t5/metrics.py | '''
Author: anon
Date: 2022-01-27 11:39:10
LastEditors: anon
LastEditTime: 2022-02-11 17:47:14
FilePath: /crosstalk-generation/src/gpt/metrics.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
from statistics import mean
from nltk import word_tokenize
from nltk.translate.bleu_score impo... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/train.py | src/t5/train.py | import argparse
from lib2to3.pgen2 import token
import math
import time
from urllib import response
import torch
import torch.nn.functional as F
import torch.optim as optim
import logging
from datetime import datetime
import os
from torch.utils.data import Dataset, DataLoader
from os.path import join, exists
from torch... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/draw_loss.py | src/t5/draw_loss.py | '''
Author: anon
Date: 2022-02-07 11:05:00
LastEditors: anon
LastEditTime: 2022-02-07 11:05:00
FilePath: /crosstalk-generation/src/gpt/draw_loss.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
import numpy as np
import matplotlib.pyplot as plt
train_loss = [44.48271321031384, 6.5835... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/t5_tokenizer.py | src/t5/t5_tokenizer.py | '''
Author: anon
Date: 2022-02-07 11:17:02
LastEditors: anon
LastEditTime: 2022-02-07 14:31:51
FilePath: /crosstalk-generation/src/t5/t5_tokenizer.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
import jieba
from transformers import BertTokenizer
from transformers import MT5ForCondi... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/data_parallel.py | src/t5/data_parallel.py | from torch.nn.parallel import DataParallel
import torch
from torch.nn.parallel._functions import Scatter
from torch.nn.parallel.parallel_apply import parallel_apply
def scatter(inputs, target_gpus, chunk_sizes, dim=0):
r"""
Slices tensors into approximately equal chunks and
distributes them across given G... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/generate_eval_data.py | src/t5/generate_eval_data.py | '''
Author: anon
Date: 2022-02-09 17:05:01
LastEditors: anon
LastEditTime: 2022-02-09 17:16:53
FilePath: /crosstalk-generation/src/t5/generate_eval_data.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
'''
Author: anon
Date: 2022-02-08 16:12:50
LastEditors: anon
LastEditTime: 2022-02-0... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/dataset.py | src/t5/dataset.py | '''
Author: anon
Date: 2022-02-09 14:58:23
LastEditors: anon
LastEditTime: 2022-02-09 15:00:21
FilePath: /crosstalk-generation/src/t5/dataset.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
from torch.utils.data import Dataset
import torch,json
class MyDataset(Dataset):
"""
... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/__init__.py | src/t5/__init__.py | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false | |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/t5/preprocess.py | src/t5/preprocess.py | from tokenizers import BertWordPieceTokenizer
from transformers import BertTokenizer
from transformers import BertTokenizerFast
import argparse
import pandas as pd
import pickle,os
import jieba.analyse
from tqdm import tqdm
import logging,json
import numpy as np
from t5_tokenizer import T5PegasusTokenizer
def creat... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/metric_result_correlation.py | src/beta_code/metric_result_correlation.py | import os
from scipy.stats import pearsonr, spearmanr
import pandas as pd
from beta_code.get_human_check_data_eval_score_pairs import mode_ref_dict
from human_metrics import get_score_map
from beta_code.machine_metrics import cal_metrics
import numpy as np
import matplotlib.pyplot as plt
machine_data_base_path = '/ev... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/indicator_correlation.py | src/beta_code/indicator_correlation.py | import json,sys
sys.path.append('.')
from beta_code import machine_metrics
from collections import defaultdict
def get_metrics(references, candidates):
distinct_1 = machine_metrics.calc_distinct_ngram(candidates, 1)
distinct_2 = machine_metrics.calc_distinct_ngram(candidates, 2)
belu_scores = machine_metri... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/machine_metrics.py | src/beta_code/machine_metrics.py | '''
Author: anon
Date: 2022-01-27 11:39:10
LastEditors: anon
LastEditTime: 2022-02-11 17:47:14
FilePath: /crosstalk-generation/src/gpt/metrics.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
from statistics import mean
from nltk import word_tokenize
from nltk.translate.bleu_score import... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/muti_heatmap_demo.py | src/beta_code/muti_heatmap_demo.py | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
vegetables = ["cucumber", "tomato", "lettuce", "asparagus",
"potato", "wheat", "barley"]
farmers = ["Farmer Joe", "Upland Bros.", "Smith Gardening",
"Agrifun", "Organiculture", "BioGoods Ltd.", "Cornylee Corp."]
harvest = ... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/Simple_relation.py | src/beta_code/Simple_relation.py | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false | |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/out_excel.py | src/beta_code/out_excel.py | import pandas as pd
from beta_code.get_human_check_data_eval_score_pairs import mode_ref_dict
from beta_code.indicator_correlation import load_model_results,load_human_results,correlation
model_r = load_model_results()
human_r = load_human_results()
correlation_result,model_split_dict = correlation(model_r, human_r)
... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/__init__.py | src/beta_code/__init__.py | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false | |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/matlibplot_heatmap.py | src/beta_code/matlibplot_heatmap.py | import numpy as np
import matplotlib.pyplot as plt
from beta_code.indicator_correlation import load_model_results,load_human_results,correlation
model_r = load_model_results()
human_r = load_human_results()
correlation_result,model_split_dict = correlation(model_r, human_r)
line_head = ['bleu_1','bleu_2','bleu_3','b... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/get_human_check_data_eval_score_pairs.py | src/beta_code/get_human_check_data_eval_score_pairs.py | import os,json,io
import pandas as pd
this_dir = os.path.split(os.path.realpath(__file__))[0]
'''
generate_completions.json 生成的后10段文本
meta_prompt.json 50个前10段文本
score_records.json 评分记录
user_list.json 评分用户
'''
# 模型id对应表
mode_ref_dict = {
1: "真实数据",
2:"rnn",... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/gpt3_finetune_guide/__init__.py | src/beta_code/gpt3_finetune_guide/__init__.py | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false | |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/gpt3_prompt_generate/Prompt_rule_generator.py | src/beta_code/gpt3_prompt_generate/Prompt_rule_generator.py | import os,sys,io,json,random
from pathlib import Path
this_dir = os.path.split(os.path.realpath(__file__))[0]
'''
多热点,多模板多样性
'''
def get_filter_prompt():
human_ref_data_dir = os.path.join(Path(this_dir).parent.parent,'eval_data','human_eval')
filter_prompt_file_path = os.path.join(human_ref_data_dir,'data','... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/gpt3_prompt_generate/Gpt3_Generator.py | src/beta_code/gpt3_prompt_generate/Gpt3_Generator.py |
import io,os
from tqdm import tqdm
from beta_code.gpt3_prompt_generate.GPT3_Call import call_gpt3
this_dir = os.path.split(os.path.realpath(__file__))[0]
prompt_file_path = os.path.join(this_dir,'human_filter_prompt.txt')
completion_file_path = os.path.join(this_dir,'candi_completion.txt')
def main():
# input... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/gpt3_prompt_generate/GPT3_Call.py | src/beta_code/gpt3_prompt_generate/GPT3_Call.py | import os
import openai
def call_gpt3(prompt_text):
response = openai.Completion.create(
model="davinci",
prompt=prompt_text,
temperature=0.2,
max_tokens=256,
top_p=1,
frequency_penalty=0.85,
presence_penalty=0.4
)
return response
if __name__ == '__main__':
input_text = '###美... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/beta_code/gpt3_prompt_generate/__init__.py | src/beta_code/gpt3_prompt_generate/__init__.py | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false | |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/cpm/inference.py | src/cpm/inference.py | '''
Author: anon
Date: 2022-02-07 20:18:18
LastEditors: anon
LastEditTime: 2022-02-10 16:09:11
FilePath: /crosstalk-generation/src/cpm/inference.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
from transformers import TextGenerationPipeline, AutoTokenizer, AutoModelWithLMHead,Conver... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/cpm/generate_eval_data.py | src/cpm/generate_eval_data.py | '''
Author: anon
Date: 2022-02-08 16:12:50
LastEditors: anon
LastEditTime: 2022-02-10 17:07:36
FilePath: /crosstalk-generation/src/cpm/generate_eval_data.py
Description:
Copyright (c) 2022 by anon/Ultrapower, All Rights Reserved.
'''
import transformers
import torch
import os,re
import json
import random
import nump... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/cpm/dataset.py | src/cpm/dataset.py | from torch.utils.data import Dataset
import torch
class MyDataset(Dataset):
"""
"""
def __init__(self, input_list, max_len):
self.input_list = input_list
self.max_len = max_len
def __getitem__(self, index):
input_ids = self.input_list[index]
input_ids = input_ids[:se... | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false |
FreedomIntelligence/crosstalk-generation | https://github.com/FreedomIntelligence/crosstalk-generation/blob/d7baa296339722cd0804dd68c7a25622b472f5d1/src/cpm/__init__.py | src/cpm/__init__.py | python | Apache-2.0 | d7baa296339722cd0804dd68c7a25622b472f5d1 | 2026-01-05T07:14:13.078808Z | false | |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/setup.py | setup.py | from setuptools import setup
if __name__ == '__main__':
setup()
| python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/tests/conftest.py | tests/conftest.py | from pathlib import Path
import pytest
from BibaAndBoba import BibaAndBoba
TEST_DATA_PATH = Path(__file__).parent.resolve() / "data"
def data_file(filename: str):
return TEST_DATA_PATH / filename
@pytest.fixture(scope="session")
def chat_1_file():
return data_file("test_chat_1.json").open("rb").read()
... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/tests/test_comparator.py | tests/test_comparator.py | import pytest
from BibaAndBoba.comparator import Comparator
@pytest.fixture(scope="module")
def biba_and_boba_comparator(biba_and_boba):
return Comparator(biba_and_boba, biba_and_boba)
def test_type_error():
with pytest.raises(Exception) as e_info:
# noinspection PyTypeChecker
Comparator(""... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/tests/__init__.py | tests/__init__.py | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false | |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/tests/test_reader.py | tests/test_reader.py | import pytest
from BibaAndBoba.utils.reader import Reader
@pytest.fixture()
def reader(chat_1_file):
return Reader(file=chat_1_file)
def test_get_companion_id(reader):
companion_id_actual = reader.get_companion_id()
companion_id_expected = "483571608"
assert companion_id_actual == companion_id_exp... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/tests/test_biba_and_boba.py | tests/test_biba_and_boba.py | import pandas as pd
from pandas.testing import assert_frame_equal
def test_freq_dist(biba_and_boba):
freq_dist_actual = biba_and_boba.parasite_words()
freq_dist_expected = pd.DataFrame(
{
'Word': ["hi", "павло"],
'Count': [1, 1],
'Quotient': [0.5, 0.5],
}
... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/tests/test_nltk_punkt_downloader.py | tests/test_nltk_punkt_downloader.py | import logging
import nltk
from BibaAndBoba.utils.nltk_punkt_downloader import download_punkt
def test_download_punkt(caplog):
try:
nltk.data.find('tokenizers/punkt')
except LookupError:
with caplog.at_level(logging.WARNING):
download_punkt()
assert 'Successfully downloade... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/biba_and_boba.py | BibaAndBoba/biba_and_boba.py | import pandas as pd
from nltk.probability import FreqDist
from BibaAndBoba.utils.reader import FileInput
from BibaAndBoba.utils.reader import Reader
from BibaAndBoba.utils.tokenizer import tokenize
from BibaAndBoba.utils.logger import logger
class BibaAndBoba:
"""
BibaAndBoba is a class that for analyzing t... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/comparator.py | BibaAndBoba/comparator.py | from BibaAndBoba.biba_and_boba import BibaAndBoba
def _max_correlation(n: int) -> float:
"""
The max_correlation function computes the maximum correlation between two frequency distributions.
:param n: :obj:`int`: Specify the length of the frequency distributions
:return: The maximum correlation
... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/__init__.py | BibaAndBoba/__init__.py | from BibaAndBoba.comparator import Comparator
from BibaAndBoba.biba_and_boba import BibaAndBoba
from BibaAndBoba.utils.reader import Reader
from BibaAndBoba.utils.logger import logger
try:
import nltk
nltk.data.find('tokenizers/punkt')
except LookupError:
logger.warning("NLTK punkt tokenizer is not instal... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/service/dictionary.py | BibaAndBoba/service/dictionary.py | with open("BibaAndBoba/base.lst.txt", "r") as dictionary:
with open("../dictionaries/base_ua.txt", "w") as base:
for line in dictionary:
word = line.split()[0]
base.write(word + "\n")
| python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/utils/languages.py | BibaAndBoba/utils/languages.py | from googletrans import Translator
from googletrans.constants import LANGUAGES
NLTK_SUPPORTED_LANGUAGES = ['czech',
'danish',
'dutch',
'english',
'estonian',
'finnish',
... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/utils/cacher.py | BibaAndBoba/utils/cacher.py | import pickle
import os
from functools import wraps
from pathlib import Path
from BibaAndBoba.utils.logger import logger
# Creates a cache directory called BibaAndBoba/cache.
CACHE_DIR_PATH = Path("BibaAndBoba/cache")
CACHE_DIR_PATH.mkdir(parents=True, exist_ok=True)
def cache_file_path(companion_id: str) -> Path:
... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/utils/reader.py | BibaAndBoba/utils/reader.py | import json
from typing import Union, TextIO, BinaryIO
from io import BufferedReader, BytesIO, TextIOWrapper
FileInput = Union[str, bytes, BufferedReader, BinaryIO, BytesIO, TextIO]
def _parse_file_input(file: FileInput):
if isinstance(file, str):
if not file.endswith('.json'):
extension = fi... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/utils/logger.py | BibaAndBoba/utils/logger.py | import logging
class CustomFormatter(logging.Formatter):
white = '\033[97m'
gray = '\033[37m'
green = '\033[32m'
blue = '\033[94m'
yellow = '\033[93m'
red = '\033[91m'
reset = "\x1b[0m"
format = "%(message)s"
FORMATS = {
logging.DEBUG: white + format + reset,
loggi... | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
andylvua/bibaandboba | https://github.com/andylvua/bibaandboba/blob/b2c5ee1ad241fe3384394c7e8cf18e1feb930457/BibaAndBoba/utils/__init__.py | BibaAndBoba/utils/__init__.py | python | MIT | b2c5ee1ad241fe3384394c7e8cf18e1feb930457 | 2026-01-05T07:14:26.497544Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.