Giter VIP home page Giter VIP logo

chinese_sentiment's People

Contributors

dependabot[bot] avatar linguishi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chinese_sentiment's Issues

tensorflow版本问题

目前tensorflow没有1x版本了但是代码还是1x的版本的,在代码中采取.compat.v1的方式之后,有部分代码依旧无法使用AttributeError: module 'tensorflow._api.v2.compat.v1.compat.v1' has no attribute 'estimator'
请问如何解决

你好,运行python build_embedings.py报错,该如何解决。

C:\ai\chinese_sentiment\venv\Scripts\python.exe C:\ai\chinese_sentiment\data\hotel_comment\build_embedings.py
Traceback (most recent call last):
File "C:\ai\chinese_sentiment\data\hotel_comment\build_embedings.py", line 6, in
word_to_idx = {line.strip(): idx for idx, line in enumerate(f)}
File "C:\ai\chinese_sentiment\data\hotel_comment\build_embedings.py", line 6, in
word_to_idx = {line.strip(): idx for idx, line in enumerate(f)}
File "C:\Program Files\Python38\lib\codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd7 in position 3382: invalid continuation byte

Process finished with exit code 1

score_report.py: error: the following arguments are required: file

你好,我在运行CNN目录下的score_report.py的时候,出现了如下的错误:
usage: score_report.py [-h] file
score_report.py: error: the following arguments are required: file
这个该如何解决呢?谢谢。

还有就是在训练CNN目录下的main.py的时候,最终的准确率非常低。
Saving dict for global step 16074: acc = 0.610625, global_step = 16074, loss = 0.6398508, precision = 0.5851781, recall = 0.76
Saving 'checkpoint_path' summary for global step 16074: results/model\model.ckpt-16074
Loss for final step: 0.586049.

AttributeError: 'str' object has no attribute 'decode'

Traceback (most recent call last):
File "···/chinese_sentiment-master/data/hotel_comment/raw_data/fix_coupus.py", line 30, in
fix_corpus(POS, FIX_POS)
File "···/chinese_sentiment-master/data/hotel_comment/raw_data/fix_coupus.py", line 15, in fix_corpus
fix_s = s.decode('gb2312')
AttributeError: 'str' object has no attribute 'decode'
代码如下:
def fix_corpus(dir_s, dir_t):
for item in os.listdir(dir_s):
with open(os.path.join(dir_s, item), 'r',) as f:
try:
s = f.read()
fix_s = s.decode('gb2312')
except UnicodeDecodeError:
try:
fix_s = s.decode('gbk')
except UnicodeDecodeError:
fix_s = s.decode('gb2312', errors='ignore')
with codecs.open(os.path.join(dir_t, item), 'w', encoding='utf8') as ff:
ff.write(fix_s)

模型预测时候输出的日志信息在哪里

2023-10-18 17:24:37.709628: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
2023-10-18 17:24:37.716526: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2023-10-18 17:24:37.721962: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2023-10-18 17:24:37.728865: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_100.dll
2023-10-18 17:24:37.735798: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_100.dll
2023-10-18 17:24:37.747056: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_100.dll
2023-10-18 17:24:37.752686: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_100.dll
2023-10-18 17:24:37.764038: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2023-10-18 17:24:37.769760: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2023-10-18 17:24:37.776367: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2023-10-18 17:24:37.783494: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165] 0
2023-10-18 17:24:37.788907: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0: N
2023-10-18 17:24:37.793320: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4831 MB memory) -> physical GPU

这种信息是哪个模块输出的,找了一大圈没找到

1

Hello, may I ask how to solve the fitting phenomenon

模块运行报错

main.py 文件中第72行和第73行 embeddings = tf.nn.embedding_lookup(w2v_var, word_ids)
nn.embedding_lookup有个模块已经停用了,如果在cpu上跑不会返回零tesor会报错。请问该怎么办呢?
InvalidArgumentError (see above for traceback): indices[18,130] = 21492 is not in [0, 3621)
[[node embedding_lookup (defined at main.py:73) = GatherV2[Taxis=DT_INT32, Tindices=DT_INT64, Tparams=DT_FLOAT, _device="/
job:localhost/replica:0/task:0/device:CPU:0"](Variable/read, string_to_index_Lookup, embedding_lookup/axis)]]

你好

我最近在学习有关情感分析的内容,在运行你的代码时进行到最后一步没有找到模型导出的save_model.py是否能请您上传一下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.